+
+ /**
+ * copy any sequence annotation onto the sequence mapped using the provided
+ * StructureMapping
+ *
+ * @param mapping
+ * - positional mapping between destination sequence and pdb resnum
+ * @param sqmpping
+ * - mapping between destination sequence and local chain
+ */
+ public void transferResidueAnnotation(
+ StructureMapping mapping, jalview.datamodel.Mapping sqmpping)
+ {
+ SequenceI sq = mapping.getSequence();
+ SequenceI dsq = sq;
+ if (sq != null)
+ {
+ while (dsq.getDatasetSequence() != null)
+ {
+ dsq = dsq.getDatasetSequence();
+ }
+ // any annotation will be transferred onto the dataset sequence
+
+ if (shadow != null && shadow.getAnnotation() != null)
+ {
+
+ for (AlignmentAnnotation ana : shadow.getAnnotation())
+ {
+ List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations(
+ ana.getCalcId(), ana.label);
+ if (transfer == null || transfer.size() == 0)
+ {
+ ana = new AlignmentAnnotation(ana);
+ ana.liftOver(sequence, shadowMap);
+ ana.liftOver(dsq, sqmpping);
+ dsq.addAlignmentAnnotation(ana);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ else
+ {
+ if (sequence != null && sequence.getAnnotation() != null)
+ {
+ for (AlignmentAnnotation ana : sequence.getAnnotation())
+ {
+ List<AlignmentAnnotation> transfer = sq
+ .getAlignmentAnnotations(ana.getCalcId(), ana.label);
+ if (transfer == null || transfer.size() == 0)
+ {
+ ana = new AlignmentAnnotation(ana);
+ ana.liftOver(dsq, sqmpping);
+ // mapping.transfer(ana);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ }
+ if (false)
+ {
+ // Useful for debugging mappings - adds annotation for mapped position
+ float min = -1, max = 0;
+ Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
+ for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
+ {
+ int prn = mapping.getPDBResNum(k + 1);
+
+ an[k] = new Annotation(prn);
+ if (min == -1)
+ {
+ min = k;
+ max = k;
+ }
+ else
+ {
+ if (min > k)
+ {
+ min = k;
+ }
+ else if (max < k)
+ {
+ max = k;
+ }
+ }
+ }
+ sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
+ "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
+ an, min, max, AlignmentAnnotation.LINE_GRAPH));
+ }
+ }
+ }