X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=21f4aace1c861507829d887dacb4df99d861b1ec;hb=3828a47f3ee9549412e04d91cbc1455cada45d01;hp=891fdd6bff5866a28718b6f6351671a161b88a5a;hpb=b2afeb815dcec916179fdec147523aba4dd4c9c1;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 891fdd6..21f4aac 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -2434,7 +2434,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sg.setEndRes(viewport.getAlignment().getWidth() - 1); viewport.setSelectionGroup(sg); viewport.sendSelection(); - alignPanel.paintAlignment(true); + // JAL-2034 - should delegate to + // alignPanel to decide if overview needs + // updating. + alignPanel.paintAlignment(false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); } @@ -2457,7 +2460,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setSelectionGroup(null); alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(null); alignPanel.getIdPanel().getIdCanvas().searchResults = null; - alignPanel.paintAlignment(true); + // JAL-2034 - should delegate to + // alignPanel to decide if overview needs + // updating. + alignPanel.paintAlignment(false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2484,6 +2490,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false); } + // JAL-2034 - should delegate to + // alignPanel to decide if overview needs + // updating. alignPanel.paintAlignment(true); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); @@ -2831,7 +2840,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void expandViews_actionPerformed(ActionEvent e) { - Desktop.instance.explodeViews(this); + Desktop.explodeViews(this); } /** @@ -4691,8 +4700,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param source * the database to show cross-references for */ - protected void showProductsFor(final SequenceI[] sel, final boolean _odna, - final String source) + protected void showProductsFor(final SequenceI[] sel, + final boolean _odna, final String source) { Runnable foo = new Runnable() { @@ -4711,7 +4720,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, AlignmentI dataset = alignment.getDataset() == null ? alignment : alignment.getDataset(); boolean dna = alignment.isNucleotide(); - if (_odna!=dna) + if (_odna != dna) { System.err .println("Conflict: showProducts for alignment originally " @@ -4720,8 +4729,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, + " now searching for " + (dna ? "DNA" : "Protein") + " Context."); } - AlignmentI xrefs = new CrossRef(sel, dataset) - .findXrefSequences(source, dna); + AlignmentI xrefs = new CrossRef(sel, dataset).findXrefSequences( + source, dna); if (xrefs == null) { return; @@ -4741,97 +4750,106 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, xrefsAlignment.alignAs(alignment); } - AlignFrame newFrame = new AlignFrame(xrefsAlignment, DEFAULT_WIDTH, - DEFAULT_HEIGHT); - if (Cache.getDefault("HIDE_INTRONS", true)) - { - newFrame.hideFeatureColumns(SequenceOntologyI.EXON, false); - } - String newtitle = String.format("%s %s %s", MessageManager - .getString(dna ? "label.proteins" : "label.nucleotides"), - MessageManager.getString("label.for"), getTitle()); - newFrame.setTitle(newtitle); - - if (!Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) - { - /* - * split frame display is turned off in preferences file - */ - Desktop.addInternalFrame(newFrame, newtitle, DEFAULT_WIDTH, - DEFAULT_HEIGHT); - return; // via finally clause - } - /* - * Make a copy of this alignment (sharing the same dataset + * If we are opening a splitframe, make a copy of this alignment (sharing the same dataset * sequences). If we are DNA, drop introns and update mappings */ AlignmentI copyAlignment = null; - boolean copyAlignmentIsAligned = false; - if (dna) + + if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true)) { - copyAlignment = AlignmentUtils.makeCdsAlignment(sel, dataset, - xrefsAlignment.getSequencesArray()); - if (copyAlignment.getHeight() == 0) + boolean copyAlignmentIsAligned = false; + if (dna) { - System.err.println("Failed to make CDS alignment"); - } + copyAlignment = AlignmentUtils.makeCdsAlignment(sel, dataset, + xrefsAlignment.getSequencesArray()); + if (copyAlignment.getHeight() == 0) + { + JOptionPane.showMessageDialog(AlignFrame.this, + MessageManager.getString("label.cant_map_cds"), + MessageManager.getString("label.operation_failed"), + JOptionPane.OK_OPTION); + System.err.println("Failed to make CDS alignment"); + } - /* - * pending getting Embl transcripts to 'align', - * we are only doing this for Ensembl - */ - // TODO proper criteria for 'can align as cdna' - if (DBRefSource.ENSEMBL.equalsIgnoreCase(source) - || AlignmentUtils.looksLikeEnsembl(alignment)) + /* + * pending getting Embl transcripts to 'align', + * we are only doing this for Ensembl + */ + // TODO proper criteria for 'can align as cdna' + if (DBRefSource.ENSEMBL.equalsIgnoreCase(source) + || AlignmentUtils.looksLikeEnsembl(alignment)) + { + copyAlignment.alignAs(alignment); + copyAlignmentIsAligned = true; + } + } + else { - copyAlignment.alignAs(alignment); - copyAlignmentIsAligned = true; + copyAlignment = AlignmentUtils.makeCopyAlignment(sel, + xrefs.getSequencesArray(), dataset); } - } - else - { - copyAlignment = AlignmentUtils.makeCopyAlignment(sel, - xrefs.getSequencesArray(), dataset); - } - copyAlignment.setGapCharacter(AlignFrame.this.viewport - .getGapCharacter()); + copyAlignment.setGapCharacter(AlignFrame.this.viewport + .getGapCharacter()); - StructureSelectionManager ssm = StructureSelectionManager - .getStructureSelectionManager(Desktop.instance); + StructureSelectionManager ssm = StructureSelectionManager + .getStructureSelectionManager(Desktop.instance); - /* - * register any new mappings for sequence mouseover etc - * (will not duplicate any previously registered mappings) - */ - ssm.registerMappings(dataset.getCodonFrames()); + /* + * register any new mappings for sequence mouseover etc + * (will not duplicate any previously registered mappings) + */ + ssm.registerMappings(dataset.getCodonFrames()); - if (copyAlignment.getHeight() <= 0) - { - System.err.println("No Sequences generated for xRef type " - + source); - return; + if (copyAlignment.getHeight() <= 0) + { + System.err.println("No Sequences generated for xRef type " + + source); + return; + } + /* + * align protein to dna + */ + if (dna && copyAlignmentIsAligned) + { + xrefsAlignment.alignAs(copyAlignment); + } + else + { + /* + * align cdna to protein - currently only if + * fetching and aligning Ensembl transcripts! + */ + // TODO: generalise for other sources of locus/transcript/cds data + if (dna && DBRefSource.ENSEMBL.equalsIgnoreCase(source)) + { + copyAlignment.alignAs(xrefsAlignment); + } + } } /* - * align protein to dna + * build AlignFrame(s) according to available alignment data */ - if (dna && copyAlignmentIsAligned) + AlignFrame newFrame = new AlignFrame(xrefsAlignment, + DEFAULT_WIDTH, DEFAULT_HEIGHT); + if (Cache.getDefault("HIDE_INTRONS", true)) { - xrefsAlignment.alignAs(copyAlignment); + newFrame.hideFeatureColumns(SequenceOntologyI.EXON, false); } - else + String newtitle = String.format("%s %s %s", MessageManager + .getString(dna ? "label.proteins" : "label.nucleotides"), + MessageManager.getString("label.for"), getTitle()); + newFrame.setTitle(newtitle); + + if (copyAlignment == null) { /* - * align cdna to protein - currently only if - * fetching and aligning Ensembl transcripts! + * split frame display is turned off in preferences file */ - // TODO: generalise for other sources of locus/transcript/cds data - if (dna && DBRefSource.ENSEMBL.equalsIgnoreCase(source)) - { - copyAlignment.alignAs(xrefsAlignment); - } + Desktop.addInternalFrame(newFrame, newtitle, DEFAULT_WIDTH, + DEFAULT_HEIGHT); + return; // via finally clause } - AlignFrame copyThis = new AlignFrame(copyAlignment, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); copyThis.setTitle(AlignFrame.this.getTitle());