From: gmungoc Date: Fri, 27 May 2016 08:51:36 +0000 (+0100) Subject: JAL-1942 small tidy (formatting, explict imports, typed list, spelling) X-Git-Tag: Release_2_10_0~209^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ba03e96346fceac9d73148d743e523634f5f9539;p=jalview.git JAL-1942 small tidy (formatting, explict imports, typed list, spelling) --- diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index f250583..09204d1 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1326,7 +1326,7 @@ public class FeatureSettings extends JPanel implements * * @return vector of selected das source nicknames */ - public Vector getSelectedSources() + public Vector getSelectedSources() { return dassourceBrowser.getSelectedSources(); } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 1e0772a..4b0ffad 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -60,6 +60,7 @@ import jalview.util.GroupUrlLink; import jalview.util.GroupUrlLink.UrlStringTooLongException; import jalview.util.MessageManager; import jalview.util.UrlLink; +import jalview.ws.DBRefFetcher; import java.awt.Color; import java.awt.event.ActionEvent; @@ -2389,11 +2390,11 @@ public class PopupMenu extends JPopupMenu @Override public void run() { - boolean isNuclueotide = ap.alignFrame.getViewport().getAlignment() + boolean isNucleotide = ap.alignFrame.getViewport().getAlignment() .isNucleotide(); - new jalview.ws.DBRefFetcher(sequences, ap.alignFrame, null, - ap.alignFrame.featureSettings, isNuclueotide) + new DBRefFetcher(sequences, ap.alignFrame, null, + ap.alignFrame.featureSettings, isNucleotide) .fetchDBRefs(false); } diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index d924e73..ff856ab 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -35,6 +35,7 @@ import jalview.fts.service.pdb.PDBFTSRestClient; import jalview.jbgui.GStructureChooser; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; +import jalview.ws.DBRefFetcher; import jalview.ws.sifts.SiftsSettings; import java.awt.event.ItemEvent; @@ -860,31 +861,30 @@ public class StructureChooser extends GStructureChooser implements { ssm.setProgressBar(null); ssm.setProgressBar("Fetching Database refs.."); - new jalview.ws.DBRefFetcher(sequences, null, null, null, false) - .fetchDBRefs(true); + new DBRefFetcher(sequences).fetchDBRefs(true); break; } } } - if (pdbEntriesToView.length > 1) - { - ArrayList seqsMap = new ArrayList(); - for (SequenceI seq : sequences) - { - seqsMap.add(new SequenceI[] { seq }); - } - SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]); + if (pdbEntriesToView.length > 1) + { + ArrayList seqsMap = new ArrayList(); + for (SequenceI seq : sequences) + { + seqsMap.add(new SequenceI[] { seq }); + } + SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]); ssm.setProgressBar(null); ssm.setProgressBar("Fetching PDB Structures for selected entries.."); - sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel); - } - else - { + sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel); + } + else + { ssm.setProgressBar(null); ssm.setProgressBar("Fetching PDB Structure for " + pdbEntriesToView[0].getId()); - sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel); - } + sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel); + } } /** diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 40c88c1..3ba0e34 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -141,7 +141,7 @@ public class DBRefFetcher implements Runnable String[] defdb = null, otherdb = sfetcher .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class); List selsources = new ArrayList(); - Vector dasselsrc = (featureSettings != null) ? featureSettings + Vector dasselsrc = (featureSettings != null) ? featureSettings .getSelectedSources() : new jalview.gui.DasSourceBrowser() .getSelectedSources(); Enumeration en = dasselsrc.elements(); @@ -190,6 +190,16 @@ public class DBRefFetcher implements Runnable } /** + * Constructor with only sequences provided + * + * @param sequences + */ + public DBRefFetcher(SequenceI[] sequences) + { + this(sequences, null, null, null, false); + } + + /** * Add a listener to be notified when sequence fetching is complete * * @param l diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java index d7ba24d..5f9b2d9 100644 --- a/src/jalview/ws/DasSequenceFeatureFetcher.java +++ b/src/jalview/ws/DasSequenceFeatureFetcher.java @@ -22,11 +22,13 @@ package jalview.ws; import jalview.bin.Cache; import jalview.datamodel.DBRefEntry; +import jalview.datamodel.DBRefSource; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.FeatureSettings; +import jalview.util.DBRefUtils; import jalview.util.MessageManager; import jalview.util.UrlLink; import jalview.ws.dbsources.das.api.DasSourceRegistryI; @@ -186,8 +188,7 @@ public class DasSequenceFeatureFetcher { for (int j = 0; j < dbref.length; j++) { - if (dbref[j].getSource().equals( - jalview.datamodel.DBRefSource.UNIPROT)) + if (dbref[j].getSource().equals(DBRefSource.UNIPROT)) { refCount++; break; @@ -252,10 +253,10 @@ public class DasSequenceFeatureFetcher public void run() { running = true; - boolean isNuclueotide = af.getViewport().getAlignment() + boolean isNucleotide = af.getViewport().getAlignment() .isNucleotide(); - new jalview.ws.DBRefFetcher(sequences, af, null, af.featureSettings, - isNuclueotide).fetchDBRefs(true); + new DBRefFetcher(sequences, af, null, af.featureSettings, + isNucleotide).fetchDBRefs(true); startFetching(); setGuiFetchComplete(); @@ -286,7 +287,7 @@ public class DasSequenceFeatureFetcher { jalviewSourceI[] sources = sourceRegistry.getSources().toArray( new jalviewSourceI[0]); - String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE", + String active = Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot"); StringTokenizer st = new StringTokenizer(active, "\t"); selectedSources = new Vector(); @@ -643,10 +644,10 @@ public class DasSequenceFeatureFetcher { return null; } - DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs( + DBRefEntry[] uprefs = DBRefUtils.selectRefs( seq.getDBRefs(), new String[] { // jalview.datamodel.DBRefSource.PDB, - jalview.datamodel.DBRefSource.UNIPROT, + DBRefSource.UNIPROT, // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord // sys sources }); @@ -665,7 +666,7 @@ public class DasSequenceFeatureFetcher for (COORDINATES csys : dasSource.getVersion().getCOORDINATES()) { - if (jalview.util.DBRefUtils.isDasCoordinateSystem( + if (DBRefUtils.isDasCoordinateSystem( csys.getAuthority(), uprefs[j])) { debug("Launched fetcher for coordinate system "