+ * 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;
+ }
+ }
+ }
+ }
+
+ /**