*
* @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;
}
}