int prev_amino_end = 0;
int prev_add = 0;
for (int j = 0; j < cdsCount; j++) {
SeqSymmetry cds2genome = annot2genome.getChild(j);
SeqSpan gSpan = cds2genome.getSpan(vseq);
GlyphI cglyph = new FillRectGlyph();
//SeqSpan protSpan = cds2genome.getSpan(protein);
// coloring based on frame
colorByFrame(cglyph, gSpan.getMin() + prev_add);
prev_add += 3 - (gSpan.getLength() % 3); //Keep a track of no of complete amino acid added.
cglyph.setCoords(gSpan.getMin(), 0, gSpan.getLength(), 20);
aGlyph.addChild(cglyph);
if (amino_acid != null) {
SequenceGlyph sg = new ColoredResiduesGlyph(false);
int start = prev_amino_end;
int end = start + gSpan.getLength();
String sub_amino_acid = amino_acid.substring(start, end);
prev_amino_end += gSpan.getLength();
sg.setResidues(sub_amino_acid);
sg.setCoords(gSpan.getMin(), 0, gSpan.getLength(), 20);
sg.setForegroundColor(col_amino_acid);
sg.setBackgroundColor(cglyph.getBackgroundColor());
aGlyph.addChild(sg);
}
}
}