From: Jim Procter Date: Thu, 30 Oct 2014 15:51:54 +0000 (+0000) Subject: JAL-674 propagate annotation onto mapped sequence and its dataset sequence X-Git-Tag: Jalview_2_9~155^2~15^2~14 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e7235e7d60595f9e3bec5fb65317681e594461c4;p=jalview.git JAL-674 propagate annotation onto mapped sequence and its dataset sequence --- diff --git a/src/jalview/structure/StructureMapping.java b/src/jalview/structure/StructureMapping.java index 9236331..e4749c9 100644 --- a/src/jalview/structure/StructureMapping.java +++ b/src/jalview/structure/StructureMapping.java @@ -106,11 +106,27 @@ public class StructureMapping * * @param ana * @return the copy that was remapped to the mapped sequence + * @note this method will create a copy and add it to the dataset sequence for + * the mapped sequence as well as the mapped sequence (if it is not a + * dataset sequence). */ public AlignmentAnnotation transfer(AlignmentAnnotation ana) { AlignmentAnnotation ala_copy = new AlignmentAnnotation(ana); - ala_copy.remap(sequence, mapping, 0, -1, 1); + SequenceI ds = sequence; + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); + } + ala_copy.remap(ds, mapping, 0, -1, 1); + ds.addAlignmentAnnotation(ala_copy); + if (ds != sequence) + { + // mapping wasn't to an original dataset sequence, so we make a copy on + // the mapped sequence too + ala_copy = new AlignmentAnnotation(ala_copy); + sequence.addAlignmentAnnotation(ala_copy); + } return ala_copy; } }