From e7235e7d60595f9e3bec5fb65317681e594461c4 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 30 Oct 2014 15:51:54 +0000 Subject: [PATCH] JAL-674 propagate annotation onto mapped sequence and its dataset sequence --- src/jalview/structure/StructureMapping.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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; } } -- 1.7.10.2