From 768a4920722ec46f7c16e35780391e39a76d02ff Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 4 Jul 2016 15:35:13 +0100 Subject: [PATCH] JAL-2110 use shared dataset when copying alignment for split frame --- src/jalview/analysis/AlignmentUtils.java | 25 ++++--------------------- src/jalview/gui/AlignFrame.java | 2 +- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 9150d62..aa7cb18 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -2211,32 +2211,15 @@ public class AlignmentUtils * * @param seqs * @param xrefs + * @param dataset + * the alignment dataset shared by the new copy * @return */ public static AlignmentI makeCopyAlignment(SequenceI[] seqs, - SequenceI[] xrefs) + SequenceI[] xrefs, AlignmentI dataset) { AlignmentI copy = new Alignment(new Alignment(seqs)); - - /* - * add mappings between sequences to the new alignment - */ - AlignedCodonFrame mappings = new AlignedCodonFrame(); - copy.addCodonFrame(mappings); - for (int i = 0; i < copy.getHeight(); i++) - { - SequenceI from = seqs[i]; - SequenceI to = copy.getSequenceAt(i); - if (to.getDatasetSequence() != null) - { - to = to.getDatasetSequence(); - } - int start = from.getStart(); - int end = from.getEnd(); - MapList map = new MapList(new int[] { start, end }, new int[] { - start, end }, 1, 1); - mappings.addMap(to, from, map); - } + copy.setDataset(dataset); SequenceIdMatcher matcher = new SequenceIdMatcher(seqs); if (xrefs != null) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index b310ab9..19b5b8c 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4788,7 +4788,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, else { copyAlignment = AlignmentUtils.makeCopyAlignment( - sequenceSelection, xrefs.getSequencesArray()); + sequenceSelection, xrefs.getSequencesArray(), dataset); } copyAlignment.setGapCharacter(AlignFrame.this.viewport .getGapCharacter()); -- 1.7.10.2