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 */
021package org.biojava.nbio.structure.symmetry.core;
022
023import java.io.Serializable;
024import java.util.Arrays;
025
026public class QuatSymmetryParameters implements Serializable{
027
028        private static final long serialVersionUID = 1L;
029
030        private int minimumSequenceLength = 20;
031        private int absoluteMinimumSequenceLength = 5;
032        // if the shortest sequence length is >= 0.75 * the median sequence length,
033        // then the minimum sequence length is set to shortest sequence length,
034        // but not shorter than the absoluteMinimumSequenceLength.
035        // This adaptive feature allows the consideration of very short chains, such as collagen
036        private double minimumSequenceLengthFraction = 0.75;
037        private double[] sequenceIdentityThresholds = {0.0, 0.95};
038        private double sequencePseudoSymmetryThreshold = 0.95;
039        private double alignmentFractionThreshold = 0.9;
040        private double rmsdThreshold = 7.0;
041        private double angleThreshold = 10.0; // max angle deviation for C2 solver
042        // if a structure has both cyclic and helical symmetry (i.e., 3J4F: C2 and H),
043        // then helical symmetry is assigned if Rmsd(helical) - Rmsd(cyclic) <= helixRmsdThreshold
044        // A slightly positive value gives preference to helical, if the RMSDs for the two symmetries
045        // are almost identical
046        private double helixRmsdThreshold = 0.05;
047        private double helixRmsdToRiseRatio = 0.5; // rmsd must be < 0.5 * abs(rise) (previously set to 0.75)
048        private double minimumHelixRise = 1.0;
049        private double minimumHelixAngle = 5.0; // min helix angle to differentiate it from a translational repeat
050        private int maximumLocalCombinations = 50000; // max number of combinations to try for local symmetry calculation
051        private int maximumLocalResults = 1000;
052        private int maximumLocalSubunits = 20; // maximum number of subunits for local symmetry calculations
053        private boolean localSymmetry = true;
054        private double localTimeLimit = 120; // time limit for local calculations in seconds
055        private boolean onTheFly = true;
056        private boolean verbose = false;
057
058        private static final String n = System.getProperty("line.separator");
059
060        /**
061         * @return the minimumSequenceLength
062         */
063        public int getMinimumSequenceLength() {
064                return minimumSequenceLength;
065        }
066        /**
067         * @param minimumSequenceLength the minimumSequenceLength to set
068         */
069        public void setMinimumSequenceLength(int minimumSequenceLength) {
070                this.minimumSequenceLength = minimumSequenceLength;
071        }
072
073        /**
074         * @return the absoluteMinimumSequenceLength
075         */
076        public int getAbsoluteMinimumSequenceLength() {
077                return absoluteMinimumSequenceLength;
078        }
079        /**
080         * @param absoluteMinimumSequenceLength the absoluteMinimumSequenceLength to set
081         */
082        public void setAbsoluteMinimumSequenceLength(int absoluteMinimumSequenceLength) {
083                this.absoluteMinimumSequenceLength = absoluteMinimumSequenceLength;
084        }
085        /**
086         * @return the minimumSequenceLengthFraction
087         */
088        public double getMinimumSequenceLengthFraction() {
089                return minimumSequenceLengthFraction;
090        }
091        /**
092         * @param minimumSequenceLengthFraction the minimumSequenceLengthFraction to set
093         */
094        public void setMinimumSequenceLengthFraction(
095                        double minimumSequenceLengthFraction) {
096                this.minimumSequenceLengthFraction = minimumSequenceLengthFraction;
097        }
098        /**
099         * @return the sequenceIdentityThreshold
100         */
101        public double[] getSequenceIdentityThresholds() {
102                return sequenceIdentityThresholds;
103        }
104
105        /**
106         * @param sequenceIdentityThresholds the sequenceIdentityThresholds to set
107         */
108        public void setSequenceIdentityThresholds(double[] sequenceIdentityThresholds) {
109                this.sequenceIdentityThresholds = sequenceIdentityThresholds;
110        }
111
112        /**
113         * @return the alignmentFractionThreshold
114         */
115        public double getAlignmentFractionThreshold() {
116                return alignmentFractionThreshold;
117        }
118        /**
119         * @param alignmentFractionThreshold the alignmentFractionThreshold to set
120         */
121        public void setAlignmentFractionThreshold(double alignmentFractionThreshold) {
122                this.alignmentFractionThreshold = alignmentFractionThreshold;
123        }
124        /**
125         * @return the rmsdThreshold
126         */
127        public double getRmsdThreshold() {
128                return rmsdThreshold;
129        }
130        /**
131         * @param rmsdThreshold the rmsdThreshold to set
132         */
133        public void setRmsdThreshold(double rmsdThreshold) {
134                this.rmsdThreshold = rmsdThreshold;
135        }
136        public double getAngleThreshold() {
137                return angleThreshold;
138        }
139        public void setAngleThreshold(double angleThreshold) {
140                this.angleThreshold = angleThreshold;
141        }
142
143        public double getHelixRmsdThreshold() {
144                return helixRmsdThreshold;
145        }
146        public void setHelixRmsdThreshold(double helixRmsdThreshold) {
147                this.helixRmsdThreshold = helixRmsdThreshold;
148        }
149        /**
150         * @return the helixRmsdToRiseRatio
151         */
152        public double getHelixRmsdToRiseRatio() {
153                return helixRmsdToRiseRatio;
154        }
155        /**
156         * @param helixRmsdToRiseRatio the helixRmsdToRiseRatio to set
157         */
158        public void setHelixRmsdToRiseRatio(double helixRmsdToRiseRatio) {
159                this.helixRmsdToRiseRatio = helixRmsdToRiseRatio;
160        }
161        public double getMinimumHelixRise() {
162                return minimumHelixRise;
163        }
164        public void setMinimumHelixRise(double minimumHelixRise) {
165                this.minimumHelixRise = minimumHelixRise;
166        }
167        public double getMinimumHelixAngle() {
168                return minimumHelixAngle;
169        }
170        public void setMinimumHelixAngle(double minimumHelixAngle) {
171                this.minimumHelixAngle = minimumHelixAngle;
172        }
173        public double getSequencePseudoSymmetryThreshold() {
174                return sequencePseudoSymmetryThreshold;
175        }
176
177        public void setSequencePseudoSymmetryThreshold(
178                        double sequencePseudoSymmetryThreshold) {
179                this.sequencePseudoSymmetryThreshold = sequencePseudoSymmetryThreshold;
180        }
181
182        public int getMaximumLocalCombinations() {
183                return maximumLocalCombinations;
184        }
185        public void setMaximumLocalCombinations(int maximumLocalCombinations) {
186                this.maximumLocalCombinations = maximumLocalCombinations;
187        }
188        /**
189         * @return the maximumLocalResults
190         */
191        public int getMaximumLocalResults() {
192                return maximumLocalResults;
193        }
194        /**
195         * @return the maximumLocalSubunits
196         */
197        public int getMaximumLocalSubunits() {
198                return maximumLocalSubunits;
199        }
200        /**
201         * @param maximumLocalSubunits the maximumLocalSubunits to set
202         */
203        public void setMaximumLocalSubunits(int maximumLocalSubunits) {
204                this.maximumLocalSubunits = maximumLocalSubunits;
205        }
206        /**
207         * @param maximumLocalResults the maximumLocalResults to set
208         */
209        public void setMaximumLocalResults(int maximumLocalResults) {
210                this.maximumLocalResults = maximumLocalResults;
211        }
212        public boolean isLocalSymmetry() {
213                return localSymmetry;
214        }
215        public void setLocalSymmetry(boolean localSymmetry) {
216                this.localSymmetry = localSymmetry;
217        }
218        /**
219         * @return the localTimeLimit
220         */
221        public double getLocalTimeLimit() {
222                return localTimeLimit;
223        }
224        /**
225         * @param localTimeLimit the localTimeLimit to set
226         */
227        public void setLocalTimeLimit(double localTimeLimit) {
228                this.localTimeLimit = localTimeLimit;
229        }
230        /**
231         * @return true if Jmol on the fly bioassembly generation is used
232         */
233        public boolean isOnTheFly() {
234                return onTheFly;
235        }
236        /**
237         * @param onTheFly the onTheFly to set
238         */
239        public void setOnTheFly(boolean useJmolBioAssemblies) {
240                this.onTheFly = useJmolBioAssemblies;
241        }
242
243        public boolean isVerbose() {
244                return verbose;
245        }
246        public void setVerbose(boolean verbose) {
247                this.verbose = verbose;
248        }
249
250        @Override
251        public String toString() {
252                StringBuilder s = new StringBuilder();
253                s.append("Minimum protein sequence length   : ");
254                s.append(minimumSequenceLength);
255                s.append(n);
256                s.append("Sequence identity thresholds      : ");
257                s.append(Arrays.toString(sequenceIdentityThresholds));
258                s.append(n);
259                s.append("Sequence pseudosymmetry threshold : ");
260                s.append(sequencePseudoSymmetryThreshold);
261                s.append(n);
262                s.append("Alignment fraction threshold      : ");
263                s.append(alignmentFractionThreshold);
264                s.append(n);
265                s.append("Angle threshold                   : ");
266                s.append(angleThreshold);
267                s.append(n);
268                s.append("Symmetry RMSD threshold           : ");
269                s.append(rmsdThreshold);
270                s.append(n);
271                s.append("Local symmetry                    : ");
272                s.append(localSymmetry);
273                s.append(n);
274                s.append("Verbose                           : ");
275                s.append(verbose);
276                s.append(n);
277                return s.toString();
278        }
279}