int iSize = sequences.size();
SequenceI[] seqs = new SequenceI[iSize];
SequenceI[] inorder = getSequencesInOrder(align);
-
- for (int i = 0; i < iSize; i++)
+
+ for (int i = 0,ipos=0; i < inorder.length; i++)
{
SequenceI seq = inorder[i];
- seqs[i] = seq.getSubSequence(startRes, endRes+1);
-
- seqs[i].setDescription(seq.getDescription());
- seqs[i].setDBRef(seq.getDBRef());
- seqs[i].setSequenceFeatures(seq.getSequenceFeatures());
- if (seq.getDatasetSequence() != null)
+ seqs[ipos] = seq.getSubSequence(startRes, endRes+1);
+ if (seqs[ipos]!=null)
{
- seqs[i].setDatasetSequence(seq.getDatasetSequence());
- }
+ seqs[ipos].setDescription(seq.getDescription());
+ seqs[ipos].setDBRef(seq.getDBRef());
+ seqs[ipos].setSequenceFeatures(seq.getSequenceFeatures());
+ if (seq.getDatasetSequence() != null)
+ {
+ seqs[ipos].setDatasetSequence(seq.getDatasetSequence());
+ }
- if (seq.getAnnotation() != null)
- {
- for (int a = 0; a < seq.getAnnotation().length; a++)
+ if (seq.getAnnotation() != null)
{
- AlignmentAnnotation newannot = new AlignmentAnnotation(seq.getAnnotation()[a]);
- newannot.restrict(startRes, endRes);
- newannot.setSequenceRef(seqs[i]);
- newannot.adjustForAlignment();
- seqs[i].addAlignmentAnnotation(newannot);
+ for (int a = 0; a < seq.getAnnotation().length; a++)
+ {
+ AlignmentAnnotation newannot = new AlignmentAnnotation(seq
+ .getAnnotation()[a]);
+ newannot.restrict(startRes, endRes);
+ newannot.setSequenceRef(seqs[ipos]);
+ newannot.adjustForAlignment();
+ seqs[ipos].addAlignmentAnnotation(newannot);
+ }
}
+ ipos++;
+ } else {
+ iSize--;
}
}
-
+ if (iSize!=inorder.length)
+ {
+ SequenceI[] nseqs = new SequenceI[iSize];
+ System.arraycopy(seqs, 0, nseqs, 0, iSize);
+ seqs = nseqs;
+ }
return seqs;
}