X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignFrame.java;h=cbb5c99c62fa1bda8445c89d248df98718300fca;hb=c64a7d0a951e5ceee8cce4c8b15f86464e287b12;hp=fce74e3faffdeffe422a844f699ff0843c36c73a;hpb=52a47415c7a24b2450a6fc910541b9b24467d7ad;p=jalview.git diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index fce74e3..cbb5c99 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -25,6 +25,7 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; +import jalview.api.FeatureColourI; import jalview.api.FeatureRenderer; import jalview.api.FeatureSettingsControllerI; import jalview.api.SequenceStructureBinding; @@ -218,6 +219,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.setColumnSelection(columnSelection); } + viewport.setScaleAboveWrapped(scaleAbove.getState()); alignPanel = new AlignmentPanel(this, viewport); avc = new jalview.controller.AlignViewController(this, viewport, @@ -364,18 +366,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public boolean parseFeaturesFile(String file, String type, boolean autoenabledisplay) { - // TODO: test if importing a features file onto an alignment which already - // has features with links overwrites the original links. - - Hashtable featureLinks = new Hashtable(); boolean featuresFile = false; try { - featuresFile = new jalview.io.FeaturesFile(file, type).parse(viewport - .getAlignment(), alignPanel.seqPanel.seqCanvas - .getFeatureRenderer().getFeatureColours(), featureLinks, - true, viewport.applet.getDefaultParameter("relaxedidmatch", - false)); + Map colours = alignPanel.seqPanel.seqCanvas + .getFeatureRenderer().getFeatureColours(); + boolean relaxedIdMatching = viewport.applet.getDefaultParameter( + "relaxedidmatch", false); + featuresFile = new FeaturesFile(file, type).parse( + viewport.getAlignment(), colours, true, relaxedIdMatching); } catch (Exception ex) { ex.printStackTrace(); @@ -383,10 +382,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (featuresFile) { - if (featureLinks.size() > 0) - { - alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks; - } if (autoenabledisplay) { viewport.setShowSequenceFeatures(true); @@ -759,6 +754,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.showAllHiddenColumns(); } + viewport.sendSelection(); } } @@ -930,12 +926,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { boolean showForAlignment = showAlignmentAnnotations.getState(); boolean showForSequences = showSequenceAnnotations.getState(); - for (AlignmentAnnotation aa : alignPanel.getAlignment() + if (alignPanel.getAlignment().getAlignmentAnnotation() != null) + { + for (AlignmentAnnotation aa : alignPanel.getAlignment() .getAlignmentAnnotation()) { boolean visible = (aa.sequenceRef == null ? showForAlignment : showForSequences); aa.visible = visible; + } } alignPanel.validateAnnotationDimensions(true); validate(); @@ -1077,11 +1076,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, else if (source == invertSequenceMenuItem) { invertSequenceMenuItem_actionPerformed(); + // uncomment to slave sequence selections in split frame + // viewport.sendSelection(); } else if (source == invertColSel) { viewport.invertColumnSelection(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } else if (source == remove2LeftMenuItem) { @@ -1115,27 +1117,34 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.showAllHiddenColumns(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } else if (source == showSeqs) { viewport.showAllHiddenSeqs(); alignPanel.paintAlignment(true); + // uncomment if we want to slave sequence selections in split frame + // viewport.sendSelection(); } else if (source == hideColumns) { viewport.hideSelectedColumns(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } else if (source == hideSequences && viewport.getSelectionGroup() != null) { viewport.hideAllSelectedSeqs(); alignPanel.paintAlignment(true); + // uncomment if we want to slave sequence selections in split frame + // viewport.sendSelection(); } else if (source == hideAllButSelection) { toggleHiddenRegions(false, false); alignPanel.paintAlignment(true); + viewport.sendSelection(); } else if (source == hideAllSelection) { @@ -1144,12 +1153,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.hideAllSelectedSeqs(); viewport.hideSelectedColumns(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } else if (source == showAllHidden) { viewport.showAllHiddenColumns(); viewport.showAllHiddenSeqs(); alignPanel.paintAlignment(true); + viewport.sendSelection(); } else if (source == showGroupConsensus) { @@ -1390,7 +1401,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, return annotation; } - private Map getDisplayedFeatureCols() + private Map getDisplayedFeatureCols() { if (alignPanel.getFeatureRenderer() != null && viewport.getFeaturesDisplayed() != null) @@ -1404,15 +1415,16 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public String outputFeatures(boolean displayTextbox, String format) { String features; + FeaturesFile formatter = new FeaturesFile(); if (format.equalsIgnoreCase("Jalview")) { - features = new FeaturesFile().printJalviewFormat(viewport + features = formatter.printJalviewFormat(viewport .getAlignment().getSequencesArray(), getDisplayedFeatureCols()); } else { - features = new FeaturesFile().printGFFFormat(viewport.getAlignment() + features = formatter.printGffFormat(viewport.getAlignment() .getSequencesArray(), getDisplayedFeatureCols()); } @@ -2081,8 +2093,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, infoPanel .add(new Label(MessageManager.getString("warn.delete_all"))); - final JVDialog dialog = new JVDialog(this, title, true, 400, - 200); + final JVDialog dialog = new JVDialog(this, title, true, 400, 200); dialog.setMainPanel(infoPanel); dialog.ok.setLabel(MessageManager.getString("action.ok")); dialog.cancel.setLabel(MessageManager.getString("action.cancel")); @@ -2270,7 +2281,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ColumnSelection colSel = viewport.getColumnSelection(); int column; - if (colSel.size() > 0) + if (!colSel.isEmpty()) { if (trimLeft) { @@ -2295,18 +2306,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, TrimRegionCommand trimRegion; if (trimLeft) { - trimRegion = new TrimRegionCommand("Remove Left", - TrimRegionCommand.TRIM_LEFT, seqs, column, - viewport.getAlignment(), viewport.getColumnSelection(), - viewport.getSelectionGroup()); + trimRegion = new TrimRegionCommand("Remove Left", true, seqs, + column, viewport.getAlignment()); viewport.setStartRes(0); } else { - trimRegion = new TrimRegionCommand("Remove Right", - TrimRegionCommand.TRIM_RIGHT, seqs, column, - viewport.getAlignment(), viewport.getColumnSelection(), - viewport.getSelectionGroup()); + trimRegion = new TrimRegionCommand("Remove Right", false, seqs, + column, viewport.getAlignment()); } statusBar.setText(MessageManager.formatMessage( @@ -2610,6 +2617,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } + @Override public void changeColour(ColourSchemeI cs) { @@ -3760,6 +3768,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, this.add(statusBar, BorderLayout.SOUTH); } + @Override public void setStatus(String string) { statusBar.setText(string);