- final SequenceI seq = sequence[pdbfnum][s];
- if (mapping[m].getSequence() == seq
- && (sp = alignment.findIndex(seq)) > -1)
- {
- SequenceI asp = alignment.getSequenceAt(sp);
- for (int r = 0; r < asp.getLength(); r++)
- {
- // no mapping to gaps in sequence
- if (Comparison.isGap(asp.getCharAt(r)))
- {
- continue;
- }
- int pos = mapping[m].getPDBResNum(asp.findPosition(r));
-
- if (pos < 1 || pos == lastPos)
- {
- continue;
- }
-
- Color col = getResidueColour(seq, r, sr, fr);
- /*
- * Just keep incrementing the end position for this colour range
- * _unless_ colour, PDB model or chain has changed, or there is a
- * gap in the mapped residue sequence
- */
- final boolean newColour = !col.equals(lastCol);
- final boolean nonContig = lastPos + 1 != pos;
- final boolean newChain = !mapping[m].getChain().equals(lastChain);
- if (newColour || nonContig || startModel || newChain)
- {
- if (/* lastCol != null */startPos != -1)
- {
- addColourRange(colranges, lastCol, pdbfnum, startPos,
- lastPos, lastChain, startModel);
- startModel = false;
- }
- // lastCol = null;
- startPos = pos;
- }
- lastCol = col;
- lastPos = pos;
- // lastModel = pdbfnum;
- lastChain = mapping[m].getChain();
- }
- // final colour range
- if (lastCol != null)
- {
- addColourRange(colranges, lastCol, pdbfnum, startPos,
- lastPos, lastChain, false);
- }
- break;
- }