X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2FMCview%2FPDBChain.java;fp=src%2FMCview%2FPDBChain.java;h=29b994e493108a5c96b05b74aaf4070fb989b59c;hb=de27aab70330aed476328fd0eaf131581d7d352d;hp=f4bd31c13774b3e59b3128100383ea04265fc5fe;hpb=0d55875f3c9a9781652aa869a85a9b153cf1f4f7;p=jalview.git diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index f4bd31c..29b994e 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -162,6 +162,50 @@ public class PDBChain } /** + * Annotate the residues with their corresponding positions in s1 using the + * alignment in as NOTE: This clears all atom.alignmentMapping values on the + * structure. + * + * @param as + * @param s1 + */ + public void makeExactMapping(StructureMapping mapping, SequenceI s1) + { + // first clear out any old alignmentMapping values: + for (Atom atom : atoms) + { + atom.alignmentMapping = -1; + } + SequenceI ds = s1; + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); + } + int pdboffset = 0; + for (Residue res : residues) + { + // res.number isn't set correctly for discontinuous/mismapped residues + int seqpos = mapping.getSeqPos(res.atoms.get(0).resNumber); + char strchar = sequence.getCharAt(pdboffset++); + if (seqpos == StructureMapping.UNASSIGNED_VALUE) + { + continue; + } + char seqchar = ds.getCharAt(seqpos - ds.getStart()); + + boolean sameResidue = Comparison.isSameResidue( + seqchar, strchar, false); + if (sameResidue) + { + for (Atom atom : res.atoms) + { + atom.alignmentMapping = seqpos - 1; + } + } + } + } + + /** * Copies over the RESNUM seqfeatures from the internal chain sequence to the * mapped sequence * @@ -550,6 +594,12 @@ public class PDBChain { SequenceI sq = mapping.getSequence(); SequenceI dsq = sq; + if (sqmpping == null) + { + // SIFTS mappings are recorded in the StructureMapping object... + + sqmpping = mapping.getSeqToPdbMapping(); + } if (sq != null) { while (dsq.getDatasetSequence() != null)