X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=fcf43011e1a12ca692ba1cdd2dca1fd56ece1a07;hb=ec1a819de862ef12fdb650f673a11d160c496331;hp=c7792a5398d2eb011b94ee08adf58058ba9fd364;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c7792a5..fcf4301 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -140,6 +140,7 @@ import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.UserColourScheme; import jalview.schemes.ZappoColourScheme; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; import jalview.ws.jws1.Discoverer; @@ -2849,7 +2850,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * Set the 'follow' flag on the Viewport (and scroll to position if now * true). */ - if (viewport.followHighlight = this.followHighlightMenuItem.getState()) + final boolean state = this.followHighlightMenuItem.getState(); + viewport.setFollowHighlight(state); + if (state) { alignPanel.scrollToPosition( alignPanel.getSeqPanel().seqCanvas.searchResults, false); @@ -4779,8 +4782,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sprods[s].updatePDBIds(); } Alignment al = new Alignment(sprods); - Set cf = prods.getCodonFrames(); al.setDataset(ds); + + /* + * Copy dna-to-protein mappings to new alignment + */ + // TODO 1: no mappings are set up for EMBL product + // TODO 2: if they were, should add them to protein alignment, not + // dna + Set cf = prods.getCodonFrames(); for (AlignedCodonFrame acf : cf) { al.addCodonFrame(acf); @@ -4792,12 +4802,33 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, + getTitle(); naf.setTitle(newtitle); - // remove this flag once confirmed we want a split view - boolean asSplitFrame = true; + // temporary flag until SplitFrame is released + boolean asSplitFrame = Cache.getDefault( + Preferences.ENABLE_SPLIT_FRAME, false); if (asSplitFrame) { - final Alignment copyAlignment = new Alignment(new Alignment( - AlignFrame.this.viewport.getSequenceSelection())); + /* + * Make a copy of this alignment (sharing the same dataset + * sequences). If we are DNA, drop introns and update mappings + */ + AlignmentI copyAlignment = null; + final SequenceI[] sequenceSelection = AlignFrame.this.viewport + .getSequenceSelection(); + if (dna) + { + copyAlignment = AlignmentUtils.makeExonAlignment( + sequenceSelection, cf); + al.getCodonFrames().clear(); + al.getCodonFrames().addAll(cf); + final StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(Desktop.instance); + ssm.addMappings(cf); + } + else + { + copyAlignment = new Alignment(new Alignment( + sequenceSelection)); + } AlignFrame copyThis = new AlignFrame(copyAlignment, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); copyThis.setTitle(AlignFrame.this.getTitle()); @@ -4905,9 +4936,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "label.translation_of_params", new Object[] { this.getTitle() }); af.setTitle(newTitle); - final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); - viewport.openSplitFrame(af, new Alignment(seqs), al.getCodonFrames()); - // Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH, DEFAULT_HEIGHT); + if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false)) + { + final SequenceI[] seqs = viewport.getSelectionAsNewSequence(); + viewport.openSplitFrame(af, new Alignment(seqs), + al.getCodonFrames()); + } + else + { + Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH, + DEFAULT_HEIGHT); + } } }