001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021
022package org.biojava.nbio.structure.symmetry.core;
023
024import javax.vecmath.AxisAngle4d;
025import javax.vecmath.Matrix4d;
026import java.util.List;
027
028/**
029 *
030 * @author Peter
031 */
032public class Rotation {
033        private double subunitRmsd = Double.MAX_VALUE;
034        private double traceRmsd = Double.MAX_VALUE;
035        private double traceTmScoreMin = Double.MAX_VALUE;
036        private QuatSymmetryScores scores = new QuatSymmetryScores();
037        private List<Integer> permutation;
038        private Matrix4d transformation;
039        private AxisAngle4d axisAngle;
040        private int direction;
041        private int fold;
042
043        /**
044         * @return the subunitRmsd
045         */
046        public double getSubunitRmsd() {
047                return subunitRmsd;
048        }
049
050        /**
051         * @param subunitRmsd the subunitRmsd to set
052         */
053        public void setSubunitRmsd(double subunitRmsd) {
054                this.subunitRmsd = subunitRmsd;
055        }
056
057        /**
058         * @return the traceRmsd
059         */
060        public double getTraceRmsd() {
061                return traceRmsd;
062        }
063
064        /**
065         * @param traceRmsd the traceRmsd to set
066         */
067        public void setTraceRmsd(double traceRmsd) {
068                this.traceRmsd = traceRmsd;
069        }
070
071        /**
072         * @param traceTmScoreMin the traceTmScore to set
073         */
074        public void setTraceTmScoreMin(double traceTmScoreMin) {
075                this.traceTmScoreMin = traceTmScoreMin;
076        }
077
078        /**
079         * @return the traceTmScoreMin
080         */
081        public double getTraceTmScoreMin() {
082                return traceTmScoreMin;
083        }
084
085
086        /**
087         * @return the permutation
088         */
089        public List<Integer> getPermutation() {
090                return permutation;
091        }
092
093        /**
094         * @param permutation the permutation to set
095         */
096        public void setPermutation(List<Integer> permutation) {
097                this.permutation = permutation;
098        }
099
100        /**
101         * @return the transformation
102         */
103        public Matrix4d getTransformation() {
104                return transformation;
105        }
106
107        /**
108         * @param transformation the transformation to set
109         */
110        public void setTransformation(Matrix4d transformation) {
111                this.transformation = transformation;
112        }
113
114        /**
115         * @return the fold
116         */
117        public int getFold() {
118                return fold;
119        }
120
121        /**
122         * @param fold the fold to set
123         */
124        public void setFold(int fold) {
125                this.fold = fold;
126        }
127
128        /**
129         * @return the scores
130         */
131        public QuatSymmetryScores getScores() {
132                return scores;
133        }
134
135        /**
136         * @param scores the scores to set
137         */
138        public void setScores(QuatSymmetryScores scores) {
139                this.scores = scores;
140        }
141
142        /**
143         * @return the direction
144         */
145        public int getDirection() {
146                return direction;
147        }
148
149        /**
150         * @param direction the direction to set
151         */
152        public void setDirection(int axis) {
153                this.direction = axis;
154        }
155
156        /**
157         * @return the axisAngle
158         */
159        public AxisAngle4d getAxisAngle() {
160                return axisAngle;
161        }
162
163        /**
164         * @param axisAngle the axisAngle to set
165         */
166        public void setAxisAngle(AxisAngle4d axisAngle) {
167                this.axisAngle = axisAngle;
168        }
169
170        /**
171         * Returns the number of starts if this rotation represents a helical rotation
172         */
173        public int getNStart() {
174                int nStart = 0;
175                for (int i: permutation) {
176                        if (i == -1) {
177                                nStart++;
178                        }
179                }
180                return nStart;
181        }
182
183        @Override
184        public String toString() {
185                StringBuilder sb = new StringBuilder();
186                sb.append("fold       : ");
187                sb.append(fold);
188                sb.append("/n");
189                sb.append("orientation: ");
190                sb.append("direction  : ");
191                sb.append("/n");
192                sb.append("axisAngle  : ");
193                sb.append(axisAngle);
194                sb.append("/n");
195                sb.append("permutation: ");
196                sb.append(permutation);
197                sb.append(scores);
198                return sb.toString();
199        }
200}