+ for (int i = 0; i < seqences.size(); i++)
+ {
+ SequenceI sq = seqences.get(i);
+ char[] padded = fitSequenceToResidueMap(sq.getSequence(),
+ residueMap);
+ seqences.set(i, new Sequence(sq.getName(), padded));
+ }
+ }
+ boolean[] gapMapArray = null;
+ if (submitGaps)
+ {
+ gapMapArray = new boolean[width];
+ for (int i = 0; i < width; i++)
+ gapMapArray[i] = residueMap.get(i);
+ }
+ return new AnnotationJob(seqences, gapMapArray, namesMap, start, end,
+ minSize);
+ }
+
+ private static void updateResidueMap(BitSet residueMap, SequenceI seq,
+ boolean filterNonStandardResidues)
+ {
+ for (int pos : seq.gapMap())
+ {
+ char sqchr = seq.getCharAt(pos);
+ boolean include = !filterNonStandardResidues;
+ include |= seq.isProtein() ? ResidueProperties.aaIndex[sqchr] < 20
+ : ResidueProperties.nucleotideIndex[sqchr] < 5;
+ if (include)
+ residueMap.set(pos);
+ }
+ }
+
+ /**
+ * Fits the sequence to the residue map removing empty columns where residue
+ * map is unset and padding the sequence with gaps at the end if needed.
+ */
+ private static char[] fitSequenceToResidueMap(char[] sequence,
+ BitSet residueMap)
+ {
+ int width = residueMap.cardinality();
+ char[] padded = new char[width];
+ for (int op = 0, pp = 0; pp < width; op++)
+ {
+ if (residueMap.get(op))