From 7b414ed4f2cd0a458ec2cc60a181b1aadd24c73e Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 27 Mar 2012 16:00:04 +0100 Subject: [PATCH] formatting --- src/jalview/gui/AlignFrame.java | 219 +++++++++++++++++++++------------------ 1 file changed, 118 insertions(+), 101 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e4d66e9..e1775d7 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -284,7 +284,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ void init() { - if (viewport.getAlignmentConservationAnnotation()== null) + if (viewport.getAlignmentConservationAnnotation() == null) { BLOSUM62Colour.setEnabled(false); conservationMenuItem.setEnabled(false); @@ -403,21 +403,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, || evt.isShiftDown() || evt.isAltDown()); } break; - - //case KeyEvent.VK_A: - // if (viewport.cursorMode) - // { - // alignPanel.seqPanel.insertNucAtCursor(false,"A"); - // //System.out.println("A"); - // } - // break; - /* - case KeyEvent.VK_CLOSE_BRACKET: - if (viewport.cursorMode) - { - System.out.println("closing bracket"); - } - break; + + // case KeyEvent.VK_A: + // if (viewport.cursorMode) + // { + // alignPanel.seqPanel.insertNucAtCursor(false,"A"); + // //System.out.println("A"); + // } + // break; + /* + * case KeyEvent.VK_CLOSE_BRACKET: if (viewport.cursorMode) { + * System.out.println("closing bracket"); } break; */ case KeyEvent.VK_DELETE: case KeyEvent.VK_BACK_SPACE: @@ -666,11 +662,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, rnahelicesColour.setEnabled(nucleotide); purinePyrimidineColour.setEnabled(nucleotide); // Remember AlignFrame always starts as protein - //if (!nucleotide) - // { - // showTr - // calculateMenu.remove(calculateMenu.getItemCount() - 2); - // } + // if (!nucleotide) + // { + // showTr + // calculateMenu.remove(calculateMenu.getItemCount() - 2); + // } } /** @@ -713,7 +709,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, showConsensusHistogram.setSelected(av.isShowConsensusHistogram()); showSequenceLogo.setSelected(av.isShowSequenceLogo()); normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo()); - + setColourSelected(ColourSchemeProperty.getColourName(av .getGlobalColourScheme())); @@ -726,7 +722,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, sortByTree.setSelected(av.sortByTree); listenToViewSelections.setSelected(av.followSelection); rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure()); - rnahelicesColour.setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); + rnahelicesColour + .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); setShowProductsEnabled(); updateEditMenuBar(); @@ -1036,10 +1033,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } FormatAdapter f = new FormatAdapter(); - String output = f.formatSequences(format, + String output = f.formatSequences( + format, (Alignment) viewport.getAlignment(), // class cast exceptions will // occur in the distant future - omitHidden, f.getCacheSuffixDefault(format), viewport.getColumnSelection()); + omitHidden, f.getCacheSuffixDefault(format), + viewport.getColumnSelection()); if (output == null) { @@ -1122,7 +1121,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, try { cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), - viewport.getAlignment(), omitHidden, viewport.getColumnSelection())); + viewport.getAlignment(), omitHidden, + viewport.getColumnSelection())); Desktop.addInternalFrame(cap, "Alignment output - " + e.getActionCommand(), 600, 500); } catch (OutOfMemoryError oom) @@ -1199,12 +1199,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void exportAnnotations_actionPerformed(ActionEvent e) { - new AnnotationExporter().exportAnnotations( - alignPanel, + new AnnotationExporter().exportAnnotations(alignPanel, viewport.showAnnotation ? viewport.getAlignment() - .getAlignmentAnnotation() : null, viewport.getAlignment() - .getGroups(), - ((Alignment) viewport.getAlignment()).alignmentProperties); + .getAlignmentAnnotation() : null, viewport + .getAlignment().getGroups(), ((Alignment) viewport + .getAlignment()).alignmentProperties); } public void associatedData_actionPerformed(ActionEvent e) @@ -1343,9 +1342,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.redoList.clear(); updateEditMenuBar(); viewport.updateHiddenColumns(); -// viewport.hasHiddenColumns = (viewport.getColumnSelection() != null -// && viewport.getColumnSelection().getHiddenColumns() != null && viewport.getColumnSelection() -// .getHiddenColumns().size() > 0); + // viewport.hasHiddenColumns = (viewport.getColumnSelection() != null + // && viewport.getColumnSelection().getHiddenColumns() != null && + // viewport.getColumnSelection() + // .getHiddenColumns().size() > 0); } } @@ -1392,16 +1392,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (originalSource != null) { - if (originalSource!=viewport) + if (originalSource != viewport) { - Cache.log.warn("Implementation worry: mismatch of viewport origin for undo"); + Cache.log + .warn("Implementation worry: mismatch of viewport origin for undo"); } originalSource.updateHiddenColumns(); -// originalSource.hasHiddenColumns = (viewport.getColumnSelection() != null -// && viewport.getColumnSelection().getHiddenColumns() != null && viewport.getColumnSelection() -// .getHiddenColumns().size() > 0); - originalSource.firePropertyChange("alignment", null, - originalSource.getAlignment().getSequences()); + // originalSource.hasHiddenColumns = (viewport.getColumnSelection() != + // null + // && viewport.getColumnSelection().getHiddenColumns() != null && + // viewport.getColumnSelection() + // .getHiddenColumns().size() > 0); + originalSource.firePropertyChange("alignment", null, originalSource + .getAlignment().getSequences()); } } @@ -1428,16 +1431,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (originalSource != null) { - if (originalSource!=viewport) + if (originalSource != viewport) { - Cache.log.warn("Implementation worry: mismatch of viewport origin for redo"); + Cache.log + .warn("Implementation worry: mismatch of viewport origin for redo"); } originalSource.updateHiddenColumns(); - //originalSource.hasHiddenColumns = (viewport.getColumnSelection() != null - // && viewport.getColumnSelection().getHiddenColumns() != null && viewport.getColumnSelection() - // .getHiddenColumns().size() > 0); - originalSource.firePropertyChange("alignment", null, - originalSource.getAlignment().getSequences()); + // originalSource.hasHiddenColumns = (viewport.getColumnSelection() != + // null + // && viewport.getColumnSelection().getHiddenColumns() != null && + // viewport.getColumnSelection() + // .getHiddenColumns().size() > 0); + originalSource.firePropertyChange("alignment", null, originalSource + .getAlignment().getSequences()); } } @@ -1551,12 +1557,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Vector sg = new Vector(); if (viewport.cursorMode) { - sg.addElement(viewport.getAlignment() - .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY)); + sg.addElement(viewport.getAlignment().getSequenceAt( + alignPanel.seqPanel.seqCanvas.cursorY)); } else if (viewport.getSelectionGroup() != null - && viewport.getSelectionGroup().getSize() != viewport.getAlignment() - .getHeight()) + && viewport.getSelectionGroup().getSize() != viewport + .getAlignment().getHeight()) { sg = viewport.getSelectionGroup().getSequences( viewport.getHiddenRepSequences()); @@ -2268,7 +2274,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } RemoveGapColCommand removeGapCols = new RemoveGapColCommand( - "Remove Gapped Columns", seqs, start, end, viewport.getAlignment()); + "Remove Gapped Columns", seqs, start, end, + viewport.getAlignment()); addHistoryItem(removeGapCols); @@ -2594,8 +2601,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // Hide everything by the current selection - this is a hack - we do the // invert and then hide // first check that there will be visible columns after the invert. - if ((viewport.getColumnSelection() != null && viewport.getColumnSelection().getSelected() != null && viewport.getColumnSelection() - .getSelected().size() > 0) + if ((viewport.getColumnSelection() != null + && viewport.getColumnSelection().getSelected() != null && viewport + .getColumnSelection().getSelected().size() > 0) || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg .getEndRes())) { @@ -2623,7 +2631,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, hideSelSequences_actionPerformed(null); hide = true; } - else if (!(toggleCols && viewport.getColumnSelection().getSelected().size() > 0)) + else if (!(toggleCols && viewport.getColumnSelection().getSelected() + .size() > 0)) { showAllSeqs_actionPerformed(null); } @@ -2911,9 +2920,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public void clustalColour_actionPerformed(ActionEvent e) { - changeColour(new ClustalxColourScheme( - viewport.getAlignment().getSequences(), - viewport.getAlignment().getWidth())); + changeColour(new ClustalxColourScheme(viewport.getAlignment() + .getSequences(), viewport.getAlignment().getWidth())); } /** @@ -3008,17 +3016,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { changeColour(new PurinePyrimidineColourScheme()); } + /* - public void covariationColour_actionPerformed(ActionEvent e) - { - changeColour(new CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation()[0])); - } - */ + * public void covariationColour_actionPerformed(ActionEvent e) { + * changeColour(new + * CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation + * ()[0])); } + */ public void annotationColour_actionPerformed(ActionEvent e) { new AnnotationColourChooser(viewport, alignPanel); } - + public void rnahelicesColour_actionPerformed(ActionEvent e) { new RNAHelicesColourChooser(viewport, alignPanel); @@ -3103,9 +3112,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (cs instanceof ClustalxColourScheme) { - sg.cs = new ClustalxColourScheme( - sg.getSequences(viewport.getHiddenRepSequences()), - sg.getWidth()); + sg.cs = new ClustalxColourScheme(sg.getSequences(viewport + .getHiddenRepSequences()), sg.getWidth()); } else if (cs instanceof UserColourScheme) { @@ -3139,9 +3147,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (viewport.getConservationSelected()) { Conservation c = new Conservation("Group", - ResidueProperties.propHash, 3, - sg.getSequences(viewport.getHiddenRepSequences()), - sg.getStartRes(), sg.getEndRes() + 1); + ResidueProperties.propHash, 3, sg.getSequences(viewport + .getHiddenRepSequences()), sg.getStartRes(), + sg.getEndRes() + 1); c.calculate(); c.verdict(false, viewport.getConsPercGaps()); sg.cs.setConservation(c); @@ -3187,7 +3195,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, protected void modifyConservation_actionPerformed(ActionEvent e) { if (viewport.getConservationSelected() - && viewport.getGlobalColourScheme()!= null) + && viewport.getGlobalColourScheme() != null) { SliderPanel.setConservationSlider(alignPanel, viewport.getGlobalColourScheme(), "Background"); @@ -3371,7 +3379,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); AlignmentSorter.sortByID(viewport.getAlignment()); - addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.getAlignment())); + addHistoryItem(new OrderCommand("ID Sort", oldOrder, + viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -3474,6 +3483,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .getAlignment().getSequences()); } } + public void sortByTreeOption_actionPerformed(ActionEvent e) { viewport.sortByTree = sortByTree.isSelected(); @@ -3484,6 +3494,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.followSelection = listenToViewSelections.isSelected(); } + /** * DOCUMENT ME! * @@ -3639,8 +3650,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // pointers AlignmentSorter.sortBy(viewport.getAlignment(), order); - addHistoryItem(new OrderCommand(order.getName(), oldOrder, - viewport.getAlignment())); + addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport + .getAlignment())); alignPanel.paintAlignment(true); } @@ -3775,7 +3786,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { tp.sortByTree_actionPerformed(null); addHistoryItem(tp.sortAlignmentIn(alignPanel)); - + } }); @@ -4166,7 +4177,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } - /** * construct any groupURL type service menu entries. * @@ -4181,7 +4191,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * AlignFrame af = this; testAlView.addActionListener(new ActionListener() { * * @Override public void actionPerformed(ActionEvent e) { - * jalview.datamodel.AlignmentView.testSelectionViews(af.viewport.getAlignment(), + * jalview.datamodel.AlignmentView + * .testSelectionViews(af.viewport.getAlignment(), * af.viewport.getColumnSelection(), af.viewport.selectionGroup); } * * }); webService.add(testAlView); @@ -4190,9 +4201,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // rest-style services with other types of analysis/calculation service // SHmmr test client - still being implemented. // DEBUG - alignmentView - - for (jalview.ws.rest.RestClient client: jalview.ws.rest.RestClient.getRestClients()) { - client.attachWSMenuEntry(JvSwingUtils.findOrCreateMenu(webService, client.getAction()), this); + + for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient + .getRestClients()) + { + client.attachWSMenuEntry( + JvSwingUtils.findOrCreateMenu(webService, client.getAction()), + this); } if (Cache.getDefault("SHOW_ENFIN_SERVICES", true)) @@ -4468,11 +4483,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, boolean featuresFile = false; try { - featuresFile = new FeaturesFile(file, type) - .parse(viewport.getAlignment().getDataset(), - alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours, - false, jalview.bin.Cache.getDefault( - "RELAXEDSEQIDMATCHING", false)); + featuresFile = new FeaturesFile(file, type).parse(viewport + .getAlignment().getDataset(), alignPanel.seqPanel.seqCanvas + .getFeatureRenderer().featureColours, false, + jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false)); } catch (Exception ex) { ex.printStackTrace(); @@ -4598,7 +4612,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int l = 0, c = pdbfn.indexOf("."); while (mtch == null && c != -1) { - do + do { l = c; } while ((c = pdbfn.indexOf(".", l)) > l); @@ -4651,18 +4665,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // try and associate // TODO: may want to set a standard ID naming formalism for // associating PDB files which have no IDs. - for (SequenceI toassoc: (SequenceI[])fm[2]) { - PDBEntry pe = new AssociatePdbFileWithSeq() - .associatePdbWithSeq((String) fm[0], (String) fm[1], - toassoc, false); - if (pe != null) + for (SequenceI toassoc : (SequenceI[]) fm[2]) { - System.err - .println("Associated file : " + ((String) fm[0]) - + " with " - + toassoc.getDisplayId(true)); - assocfiles++; - } + PDBEntry pe = new AssociatePdbFileWithSeq() + .associatePdbWithSeq((String) fm[0], + (String) fm[1], toassoc, false); + if (pe != null) + { + System.err.println("Associated file : " + + ((String) fm[0]) + " with " + + toassoc.getDisplayId(true)); + assocfiles++; + } } alignPanel.paintAlignment(true); } @@ -5083,11 +5097,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setShowSequenceLogo(showSequenceLogo.getState()); alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } + protected void normaliseSequenceLogo_actionPerformed(ActionEvent e) { viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState()); alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } + protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e) { alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); @@ -5107,8 +5123,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom( viewport.getSequenceSelection(), viewport.getAlignmentView(true).getSequenceStrings( - viewport.getGapCharacter()), - viewport.getAlignment().getGroups()); + viewport.getGapCharacter()), viewport.getAlignment() + .getGroups()); viewport.getAlignment().deleteAllGroups(); viewport.sequenceColours = null; viewport.setSelectionGroup(null); @@ -5146,7 +5162,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "Implementation error: cannot show a view from another alignment in an AlignFrame."); } if (tabbedPane != null - & alignPanels.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex()) + & alignPanels.indexOf(alignmentPanel) != tabbedPane + .getSelectedIndex()) { tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel)); } -- 1.7.10.2