1717import org .biojava .nbio .structure .align .multiple .MultipleAlignmentImpl ;
1818import org .biojava .nbio .structure .align .multiple .util .MultipleAlignmentScorer ;
1919import org .biojava .nbio .structure .symmetry .utils .SymmetryTools ;
20+ import org .slf4j .Logger ;
21+ import org .slf4j .LoggerFactory ;
2022
2123/**
2224 * Iterative version of CeSymm that aims at identifying all symmetry axis
3537 * @since 4.2.0
3638 */
3739public class CeSymmIterative {
40+
41+ private static Logger logger = LoggerFactory .getLogger (CeSymmIterative .class );
3842
3943 private CESymmParameters params ;
4044 private MultipleAlignment msa ;
@@ -90,7 +94,7 @@ public MultipleAlignment execute(Atom[] atoms)
9094 alignment .add (new ArrayList <Integer >());
9195 }
9296
93- iterate (atoms , 0 );
97+ iterate (atoms );
9498 buildAlignment ();
9599 recoverAxes ();
96100
@@ -102,11 +106,13 @@ public MultipleAlignment execute(Atom[] atoms)
102106 * until no more symmetries exist.
103107 *
104108 * @param atoms Coordinates of the structure atoms
105- * @param first starting position of the atom array in the original array
106109 * @throws StructureException
107110 */
108- private void iterate (Atom [] atoms , int first ) throws StructureException {
109-
111+ private void iterate (Atom [] atoms ) throws StructureException {
112+ if ( atoms .length <= params .getWinSize () || atoms .length <= params .getMinSubunitLength ()) {
113+ logger .debug ("Aborting iteration due to insufficient length: %d" ,atoms .length );
114+ return ;
115+ }
110116 //Perform the CeSymm alignment
111117 CeSymm aligner = new CeSymm ();
112118 MultipleAlignment align = aligner .analyze (atoms , params );
@@ -150,7 +156,8 @@ else if (align.getScore(MultipleAlignmentScorer.AVGTM_SCORE) <
150156 }
151157 //Iterate further
152158 Atom [] atomsR = Arrays .copyOfRange (atoms , start , end +1 );
153- iterate (atomsR , start +first );
159+
160+ iterate (atomsR );
154161 }
155162
156163 private void buildAlignment () throws StructureException {
0 commit comments