-
- /**
- * Builds a Chimera atomSpec of residues mapped from sequences, of the format
- * (#model:residues.chain)
- *
- * <pre>
- * #0:2-94.A | #1:1-93.C | #2:1-93.A
- * </pre>
- *
- * Only residues visible in the alignment are included, that is, hidden columns
- * and sequences are excluded.
- *
- * @param av
- * @return
- */
- private String getMappedResidues(AlignViewportI av)
- {
- AlignmentI alignment = av.getAlignment();
- final int width = alignment.getWidth();
-
- String[] files = getStructureFiles();
-
- StringBuilder atomSpec = new StringBuilder(256);
-
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
- {
- StructureMapping[] mappings = getSsm().getMapping(files[pdbfnum]);
-
- /*
- * Find the first mapped sequence (if any) for this PDB entry which is in
- * the alignment
- */
- final int seqCountForPdbFile = getSequence()[pdbfnum].length;
- for (int s = 0; s < seqCountForPdbFile; s++)
- {
- for (StructureMapping mapping : mappings)
- {
- final SequenceI theSequence = getSequence()[pdbfnum][s];
- if (mapping.getSequence() == theSequence
- && alignment.findIndex(theSequence) > -1)
- {
- String chainCd = mapping.getChain();
- if (!isShowChain(mapping.getPdbId(), chainCd))
- {
- continue;
- }
- Iterator<int[]> visible;
- if (isShowAlignmentOnly() && isHideHiddenRegions())
- {
- visible = alignment.getHiddenColumns()
- .getVisContigsIterator(0, width, true);
- }
- else
- {
- visible = Collections.singletonList(new int[] { 0, width })
- .iterator();
- }
- while (visible.hasNext())
- {
- int[] visibleRegion = visible.next();
- int seqStartPos = theSequence.findPosition(visibleRegion[0]);
- int seqEndPos = theSequence.findPosition(visibleRegion[1]);
- List<int[]> residueRanges = mapping
- .getPDBResNumRanges(seqStartPos, seqEndPos);
- if (!residueRanges.isEmpty())
- {
- if (atomSpec.length() > 0)
- {
- atomSpec.append("| ");
- }
- atomSpec.append(getModelSpec(pdbfnum)).append(":");
- boolean first = true;
- for (int[] range : residueRanges)
- {
- if (!first)
- {
- atomSpec.append(",");
- }
- first = false;
- atomSpec.append(range[0]).append("-").append(range[1]);
- atomSpec.append(".").append(chainCd);
- }
- }
- }
- }
- }
- }
- }
-
- return atomSpec.toString();
- }