X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructure%2FStructureMapping.java;fp=src%2Fjalview%2Fstructure%2FStructureMapping.java;h=e4749c9be07fbaec1a7cea84891ac0b55aed17e8;hb=e7235e7d60595f9e3bec5fb65317681e594461c4;hp=923633152e0821d559fcfe1c27ddcff78bda1334;hpb=9c37999eb4b461a5c7a94e10ac39583c1c29200a;p=jalview.git 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; } }