From 90655a5726c6f7b82048438cf66c737a6999866d Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 5 Sep 2012 09:12:36 +0100 Subject: [PATCH] JAL-976 fix AACon name typo in source and GUI --- src/jalview/gui/AlignViewport.java | 40 ++--- src/jalview/gui/Jalview2XML.java | 8 +- .../jws2/{AAConsClient.java => AAConClient.java} | 14 +- src/jalview/ws/jws2/JabawsAlignCalcWorker.java | 8 +- .../ws/jws2/SequenceAnnotationWSClient.java | 166 +++++++++----------- .../dm/{AAConsSettings.java => AAConSettings.java} | 6 +- 6 files changed, 117 insertions(+), 125 deletions(-) rename src/jalview/ws/jws2/{AAConsClient.java => AAConClient.java} (88%) rename src/jalview/ws/jws2/dm/{AAConsSettings.java => AAConSettings.java} (94%) diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index c5d9438..8978fd7 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -35,32 +35,34 @@ */ package jalview.gui; -import java.util.*; - -import java.awt.*; - -import jalview.analysis.*; -import jalview.api.AlignCalcManagerI; +import jalview.analysis.NJTree; import jalview.api.AlignViewportI; -import jalview.api.AlignmentViewPanel; -import jalview.api.OOMHandlerI; - -import jalview.bin.*; - -import jalview.datamodel.*; - -import jalview.schemes.*; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.UserColourScheme; import jalview.structure.SelectionSource; import jalview.structure.StructureSelectionManager; import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; -import jalview.workers.AlignCalcManager; -import jalview.workers.ConsensusThread; -import jalview.workers.ConservationThread; -import jalview.workers.StrucConsensusThread; -import jalview.ws.jws2.dm.AAConsSettings; import jalview.ws.params.AutoCalcSetting; +import java.awt.Color; +import java.awt.Container; +import java.awt.Font; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Stack; +import java.util.Vector; + /** * DOCUMENT ME! * diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index bde3035..4533b25 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -38,9 +38,9 @@ import jalview.schemabinding.version2.*; import jalview.schemes.*; import jalview.util.Platform; import jalview.util.jarInputStreamProvider; -import jalview.ws.jws2.AAConsClient; +import jalview.ws.jws2.AAConClient; import jalview.ws.jws2.Jws2Discoverer; -import jalview.ws.jws2.dm.AAConsSettings; +import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.ArgumentI; import jalview.ws.params.AutoCalcSetting; @@ -1354,7 +1354,7 @@ public class Jalview2XML .getPreset(calcIdParam.getName()); if (parmSet != null) { - // TODO : check we have a good match with settings in AACons - + // TODO : check we have a good match with settings in AACon - // otherwise we'll need to create a new preset } } @@ -1363,7 +1363,7 @@ public class Jalview2XML argList = parmSet.getArguments(); parmSet = null; } - AAConsSettings settings = new AAConsSettings( + AAConSettings settings = new AAConSettings( calcIdParam.isAutoUpdate(), service, parmSet, argList); av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings, calcIdParam.isNeedsUpdate()); diff --git a/src/jalview/ws/jws2/AAConsClient.java b/src/jalview/ws/jws2/AAConClient.java similarity index 88% rename from src/jalview/ws/jws2/AAConsClient.java rename to src/jalview/ws/jws2/AAConClient.java index c565915..a88a221 100644 --- a/src/jalview/ws/jws2/AAConsClient.java +++ b/src/jalview/ws/jws2/AAConClient.java @@ -4,7 +4,7 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.gui.AlignFrame; import jalview.gui.AlignmentPanel; -import jalview.ws.jws2.dm.AAConsSettings; +import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.WsParamSetI; @@ -17,10 +17,10 @@ import java.util.TreeSet; import compbio.data.sequence.Score; import compbio.metadata.Argument; -public class AAConsClient extends JabawsAlignCalcWorker +public class AAConClient extends JabawsAlignCalcWorker { - public AAConsClient(Jws2Instance service, AlignFrame alignFrame, + public AAConClient(Jws2Instance service, AlignFrame alignFrame, WsParamSetI preset, List paramset) { super(service, alignFrame, preset, paramset); @@ -36,7 +36,7 @@ public class AAConsClient extends JabawsAlignCalcWorker { ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor( getCalcId(), - new AAConsSettings(true, service, this.preset, + new AAConSettings(true, service, this.preset, (arguments != null) ? JabaParamStore .getJwsArgsfromJaba(arguments) : null), true); } @@ -51,7 +51,7 @@ public class AAConsClient extends JabawsAlignCalcWorker public String getServiceActionText() { - return "calculating Amino acid consensus using AACons service"; + return "calculating Amino acid consensus using AACon service"; } /** @@ -100,13 +100,13 @@ public class AAConsClient extends JabawsAlignCalcWorker public String getCalcId() { - return SequenceAnnotationWSClient.AAConsCalcId; + return SequenceAnnotationWSClient.AAConCalcId; } public static void removeAAConsAnnotation(AlignmentPanel alignPanel) { for (AlignmentAnnotation aa : alignPanel.getAlignment().findAnnotation( - SequenceAnnotationWSClient.AAConsCalcId)) + SequenceAnnotationWSClient.AAConCalcId)) { alignPanel.getAlignment().deleteAnnotation(aa); } diff --git a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java index f0bac08..99fc8a3 100644 --- a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java @@ -77,7 +77,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker } /** - * reconfigure and restart the AAConsClient. This method will spawn a new + * reconfigure and restart the AAConClient. This method will spawn a new * thread that will wait until any current jobs are finished, modify the * parameters and restart the conservation calculation with the new values. * @@ -172,7 +172,7 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker { finished = true; } - if (calcMan.isPending(this) && this instanceof AAConsClient) + if (calcMan.isPending(this) && this instanceof AAConClient) { finished = true; // cancel this job and yield to the new job @@ -429,8 +429,8 @@ public abstract class JabawsAlignCalcWorker extends AlignCalcWorker } } // try real hard to return something submittable - // TODO: some of AAcons measures need a minimum of two or three amino - // acids at each position, and aacons doesn't gracefully degrade. + // TODO: some of AAcon measures need a minimum of two or three amino + // acids at each position, and AAcon doesn't gracefully degrade. for (int p = 0; p < seqs.size(); p++) { FastaSequence sq = seqs.get(p); diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java index 46c04e5..dbb789b 100644 --- a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java +++ b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java @@ -8,7 +8,7 @@ import jalview.bin.Cache; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; -import jalview.ws.jws2.dm.AAConsSettings; +import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.WsParamSetI; @@ -30,7 +30,7 @@ import javax.swing.event.MenuListener; public class SequenceAnnotationWSClient extends Jws2Client { - public static final String AAConsCalcId = "jabaws2.AACons"; + public static final String AAConCalcId = "jabaws2.AACon"; /** * initialise a client so its attachWSMenuEntry method can be called. @@ -60,31 +60,31 @@ public class SequenceAnnotationWSClient extends Jws2Client } if (sh.action.toLowerCase().contains("conservation")) { - // Build an AACons style client - take alignment, return annotation for + // Build an AACon style client - take alignment, return annotation for // columns List clnts = alignFrame.getViewport() .getCalcManager() - .getRegisteredWorkersOfClass(AAConsClient.class); + .getRegisteredWorkersOfClass(AAConClient.class); if (clnts == null || clnts.size() == 0) { if (!processParams(sh, editParams)) { return; } - AAConsClient worker; + AAConClient worker; alignFrame .getViewport() .getCalcManager() .registerWorker( - worker = new AAConsClient(sh, alignFrame, + worker = new AAConClient(sh, alignFrame, this.preset, paramset)); alignFrame.getViewport().getCalcManager().startWorker(worker); } else { - AAConsClient worker = (AAConsClient) clnts.get(0); + AAConClient worker = (AAConClient) clnts.get(0); if (editParams) { paramset = worker.getArguments(); @@ -120,7 +120,7 @@ public class SequenceAnnotationWSClient extends Jws2Client } - public SequenceAnnotationWSClient(AAConsSettings fave, + public SequenceAnnotationWSClient(AAConSettings fave, AlignFrame alignFrame, boolean b) { super(alignFrame, fave.getPreset(), fave.getJobArgset()); @@ -140,7 +140,7 @@ public class SequenceAnnotationWSClient extends Jws2Client if (service.serviceType.equals(compbio.ws.client.Services.AAConWS .toString())) { - registerAAConsWSInstance(wsmenu, service, alignFrame); + registerAAConWSInstance(wsmenu, service, alignFrame); return; } boolean hasparams = service.hasParameters(); @@ -148,8 +148,8 @@ public class SequenceAnnotationWSClient extends Jws2Client String calcName = service.serviceType.substring(0, service.serviceType.length() - 2); - JMenuItem aacons = new JMenuItem(calcName + " Defaults"); - aacons.addActionListener(new ActionListener() + JMenuItem annotservice = new JMenuItem(calcName + " Defaults"); + annotservice.addActionListener(new ActionListener() { @Override @@ -158,22 +158,22 @@ public class SequenceAnnotationWSClient extends Jws2Client new SequenceAnnotationWSClient(service, alignFrame, null, false); } }); - wsmenu.add(aacons); + wsmenu.add(annotservice); if (hasparams) { // only add these menu options if the service has user-modifiable // arguments - aacons = new JMenuItem("Edit settings and run ..."); - aacons.setToolTipText("View and change parameters before running calculation"); + annotservice = new JMenuItem("Edit settings and run ..."); + annotservice.setToolTipText("View and change parameters before running calculation"); - aacons.addActionListener(new ActionListener() + annotservice.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new SequenceAnnotationWSClient(service, alignFrame, null, true); } }); - wsmenu.add(aacons); + wsmenu.add(annotservice); List presets = service.getParamStore().getPresets(); if (presets != null && presets.size() > 0) { @@ -202,10 +202,10 @@ public class SequenceAnnotationWSClient extends Jws2Client } } else { - aacons = new JMenuItem("View documentation"); + annotservice = new JMenuItem("View documentation"); if (service.docUrl!=null) { - aacons.addActionListener(new ActionListener() + annotservice.addActionListener(new ActionListener() { @Override @@ -214,41 +214,40 @@ public class SequenceAnnotationWSClient extends Jws2Client Desktop.instance.showUrl(service.docUrl); } }); - aacons.setToolTipText(""+JvSwingUtils.wrapTooltip("View "+service.docUrl+"")+""); - wsmenu.add(aacons); + annotservice.setToolTipText(""+JvSwingUtils.wrapTooltip("View "+service.docUrl+"")+""); + wsmenu.add(annotservice); } } } - private final String AAconsToggle = "AACons Calculations", - AAconsToggleTooltip = "When checked, AACons calculations are updated automatically.", - AAeditSettings = "Change AACons Settings...", - AAeditSettingsTooltip = "Modify settings for AACons calculations."; + private final String AAconToggle = "AACon Calculations", + AAconToggleTooltip = "When checked, AACon calculations are updated automatically.", + AAeditSettings = "Change AACon Settings...", + AAeditSettingsTooltip = "Modify settings for AACon calculations."; - // private final enableAAConsCalculation(final AlignFrame alignFrame, ) - private void registerAAConsWSInstance(final JMenu wsmenu, + private void registerAAConWSInstance(final JMenu wsmenu, final Jws2Instance service, final AlignFrame alignFrame) { - // register this in the AACons settings set - JCheckBoxMenuItem _aaConsEnabled = null; + // register this in the AACon settings set + JCheckBoxMenuItem _aaConEnabled = null; for (int i = 0; i < wsmenu.getItemCount(); i++) { JMenuItem item = wsmenu.getItem(i); if (item instanceof JCheckBoxMenuItem - && item.getText().equals(AAconsToggle)) + && item.getText().equals(AAconToggle)) { - _aaConsEnabled = (JCheckBoxMenuItem) item; + _aaConEnabled = (JCheckBoxMenuItem) item; } } - // is there an aaCons worker already present - if so, set it to use the + // is there an aaCon worker already present - if so, set it to use the // given service handle { - List aaconsClient = alignFrame.getViewport() + List aaconClient = alignFrame.getViewport() .getCalcManager() - .getRegisteredWorkersOfClass(AAConsClient.class); - if (aaconsClient != null && aaconsClient.size() > 0) + .getRegisteredWorkersOfClass(AAConClient.class); + if (aaconClient != null && aaconClient.size() > 0) { - AAConsClient worker = (AAConsClient) aaconsClient.get(0); + AAConClient worker = (AAConClient) aaconClient.get(0); if (!worker.service.hosturl.equals(service.hosturl)) { // javax.swing.SwingUtilities.invokeLater(new Runnable() @@ -256,8 +255,8 @@ public class SequenceAnnotationWSClient extends Jws2Client // @Override // public void run() { - removeCurrentAAConsWorkerFor(alignFrame); - buildCurrentAAConsWorkerFor(alignFrame, service); + removeCurrentAAConWorkerFor(alignFrame); + buildCurrentAAConWorkerFor(alignFrame, service); } }//); } @@ -266,10 +265,10 @@ public class SequenceAnnotationWSClient extends Jws2Client // is there a service already registered ? there shouldn't be if we are // being called correctly - if (_aaConsEnabled == null) + if (_aaConEnabled == null) { - final JCheckBoxMenuItem aaConsEnabled = new JCheckBoxMenuItem( - AAconsToggle); + final JCheckBoxMenuItem aaConEnabled = new JCheckBoxMenuItem( + AAconToggle); wsmenu.addMenuListener(new MenuListener() { @@ -278,16 +277,16 @@ public class SequenceAnnotationWSClient extends Jws2Client { wsmenu.setEnabled(!alignFrame.getViewport().getAlignment() .isNucleotide()); - List aaconsClient = alignFrame.getViewport() + List aaconClient = alignFrame.getViewport() .getCalcManager() - .getRegisteredWorkersOfClass(AAConsClient.class); - if (aaconsClient != null && aaconsClient.size() > 0) + .getRegisteredWorkersOfClass(AAConClient.class); + if (aaconClient != null && aaconClient.size() > 0) { - aaConsEnabled.setSelected(true); + aaConEnabled.setSelected(true); } else { - aaConsEnabled.setSelected(false); + aaConEnabled.setSelected(false); } } @@ -305,31 +304,30 @@ public class SequenceAnnotationWSClient extends Jws2Client } }); - aaConsEnabled.setToolTipText("

" - + JvSwingUtils.wrapTooltip(AAconsToggleTooltip + "

") + aaConEnabled.setToolTipText("

" + + JvSwingUtils.wrapTooltip(AAconToggleTooltip + "

") + ""); - aaConsEnabled.addActionListener(new ActionListener() + aaConEnabled.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { - // aaConsEnabled.setSelected(!aaConsEnabled.isSelected()); - List aaconsClient = alignFrame.getViewport() + List aaconClient = alignFrame.getViewport() .getCalcManager() - .getRegisteredWorkersOfClass(AAConsClient.class); - if (aaconsClient != null && aaconsClient.size() > 0) + .getRegisteredWorkersOfClass(AAConClient.class); + if (aaconClient != null && aaconClient.size() > 0) { - removeCurrentAAConsWorkerFor(alignFrame); + removeCurrentAAConWorkerFor(alignFrame); } else { - buildCurrentAAConsWorkerFor(alignFrame); + buildCurrentAAConWorkerFor(alignFrame); } } }); - wsmenu.add(aaConsEnabled); + wsmenu.add(aaConEnabled); JMenuItem modifyParams = new JMenuItem(AAeditSettings); modifyParams.setToolTipText("

" + JvSwingUtils.wrapTooltip(AAeditSettingsTooltip + "

") @@ -340,7 +338,7 @@ public class SequenceAnnotationWSClient extends Jws2Client @Override public void actionPerformed(ActionEvent arg0) { - showAAConsAnnotationSettingsFor(alignFrame); + showAAConAnnotationSettingsFor(alignFrame); } }); wsmenu.add(modifyParams); @@ -348,47 +346,47 @@ public class SequenceAnnotationWSClient extends Jws2Client } } - private static void showAAConsAnnotationSettingsFor(AlignFrame alignFrame) + private static void showAAConAnnotationSettingsFor(AlignFrame alignFrame) { /* - * preferred settings Whether AACons is automatically recalculated Which - * AACons server to use What parameters to use + * preferred settings Whether AACon is automatically recalculated Which + * AACon server to use What parameters to use */ // could actually do a class search for this too - AAConsSettings fave = (AAConsSettings) alignFrame.getViewport() - .getCalcIdSettingsFor(AAConsCalcId); + AAConSettings fave = (AAConSettings) alignFrame.getViewport() + .getCalcIdSettingsFor(AAConCalcId); if (fave == null) { - fave = createDefaultAAConsSettings(); + fave = createDefaultAAConSettings(); } new SequenceAnnotationWSClient(fave, alignFrame, true); } - private static void buildCurrentAAConsWorkerFor(AlignFrame alignFrame) + private static void buildCurrentAAConWorkerFor(AlignFrame alignFrame) { - buildCurrentAAConsWorkerFor(alignFrame, null); + buildCurrentAAConWorkerFor(alignFrame, null); } - private static void buildCurrentAAConsWorkerFor(AlignFrame alignFrame, + private static void buildCurrentAAConWorkerFor(AlignFrame alignFrame, Jws2Instance service) { /* - * preferred settings Whether AACons is automatically recalculated Which - * AACons server to use What parameters to use + * preferred settings Whether AACon is automatically recalculated Which + * AACon server to use What parameters to use */ - AAConsSettings fave = (AAConsSettings) alignFrame.getViewport() - .getCalcIdSettingsFor(AAConsCalcId); + AAConSettings fave = (AAConSettings) alignFrame.getViewport() + .getCalcIdSettingsFor(AAConCalcId); if (fave == null) { - fave = createDefaultAAConsSettings(service); + fave = createDefaultAAConSettings(service); } else { if (service != null && !fave.getService().hosturl.equals(service.hosturl)) { - Cache.log.debug("Changing AACons service to " + service.hosturl + Cache.log.debug("Changing AACon service to " + service.hosturl + " from " + fave.getService().hosturl); fave.setService(service); } @@ -396,12 +394,12 @@ public class SequenceAnnotationWSClient extends Jws2Client new SequenceAnnotationWSClient(fave, alignFrame, false); } - private static AAConsSettings createDefaultAAConsSettings() + private static AAConSettings createDefaultAAConSettings() { - return createDefaultAAConsSettings(null); + return createDefaultAAConSettings(null); } - private static AAConsSettings createDefaultAAConsSettings( + private static AAConSettings createDefaultAAConSettings( Jws2Instance service) { if (service != null) @@ -410,7 +408,7 @@ public class SequenceAnnotationWSClient extends Jws2Client compbio.ws.client.Services.AAConWS.toString())) { Cache.log - .warn("Ignoring invalid preferred service for AACons calculations (service type was " + .warn("Ignoring invalid preferred service for AACon calculations (service type was " + service.serviceType + ")"); service = null; } @@ -427,30 +425,22 @@ public class SequenceAnnotationWSClient extends Jws2Client } if (service == null) { - // get the default service for AACons + // get the default service for AACon service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null, compbio.ws.client.Services.AAConWS.toString()); - /* - * for (Jws2Instance sv : Jws2Discoverer.getDiscoverer().getServices()) { - * if (sv.serviceType.toString().equals( - * compbio.ws.client.Services.AAConWS.toString())) { service = sv; break; - * } } - */ } if (service == null) { // TODO raise dialog box explaining error, and/or open the JABA // preferences menu. - throw new Error("No AACons service found."); + throw new Error("No AACon service found."); } - return new AAConsSettings(true, service, null, null); + return new AAConSettings(true, service, null, null); } - private static void removeCurrentAAConsWorkerFor(AlignFrame alignFrame) + private static void removeCurrentAAConWorkerFor(AlignFrame alignFrame) { alignFrame.getViewport().getCalcManager() - .removeRegisteredWorkersOfClass(AAConsClient.class); - // AAConsClient.removeAAConsAnnotation(alignFrame.alignPanel); - + .removeRegisteredWorkersOfClass(AAConClient.class); } } diff --git a/src/jalview/ws/jws2/dm/AAConsSettings.java b/src/jalview/ws/jws2/dm/AAConSettings.java similarity index 94% rename from src/jalview/ws/jws2/dm/AAConsSettings.java rename to src/jalview/ws/jws2/dm/AAConSettings.java index dbc86c4..f226ce1 100644 --- a/src/jalview/ws/jws2/dm/AAConsSettings.java +++ b/src/jalview/ws/jws2/dm/AAConSettings.java @@ -16,16 +16,16 @@ import jalview.ws.params.ParamManager; import jalview.ws.params.WsParamSetI; /** - * preferences for running AACons service + * preferences for running AACon service * * @author jprocter TODO: refactor to a generic 'last job and service run' * container ? */ -public class AAConsSettings extends jalview.ws.params.AutoCalcSetting +public class AAConSettings extends jalview.ws.params.AutoCalcSetting { Jws2Instance service; - public AAConsSettings(boolean autoUpdate, Jws2Instance service, + public AAConSettings(boolean autoUpdate, Jws2Instance service, WsParamSetI preset, List jobArgset) { super(preset, jobArgset, autoUpdate); -- 1.7.10.2