From: gmungoc Date: Fri, 10 Jul 2015 05:17:57 +0000 (+0100) Subject: JAL-1807 explicit imports (jalview.ws.*) X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8edebdd9789b2d93fb8f9db24b8be2c1e6317690;p=jalview.git JAL-1807 explicit imports (jalview.ws.*) --- diff --git a/src/jalview/ws/AWSThread.java b/src/jalview/ws/AWSThread.java index e557614..6059d45 100644 --- a/src/jalview/ws/AWSThread.java +++ b/src/jalview/ws/AWSThread.java @@ -27,6 +27,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.OOMWarning; import jalview.gui.WebserviceInfo; import jalview.util.MessageManager; import jalview.viewmodel.seqfeatures.FeatureRendererSettings; @@ -126,7 +127,7 @@ public abstract class AWSThread extends Thread throw (new Exception( "Timed out when communicating with server\nTry again later.\n")); } - jalview.bin.Cache.log.debug("Job " + j + " Result state " + Cache.log.debug("Job " + j + " Result state " + jobs[j].getState() + "(ServerError=" + jobs[j].isServerError() + ")"); } catch (Exception ex) @@ -168,8 +169,7 @@ public abstract class AWSThread extends Thread WebserviceInfo.STATE_STOPPED_ERROR); Cache.log.error("Out of memory when retrieving Job " + j + " id:" + WsUrl + "/" + jobs[j].jobId, er); - new jalview.gui.OOMWarning("retrieving result for " - + WebServiceName, er); + new OOMWarning("retrieving result for " + WebServiceName, er); System.gc(); } } @@ -199,7 +199,8 @@ public abstract class AWSThread extends Thread Cache.log .debug("WebServiceJob poll loop finished with no jobs created."); wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); - wsInfo.appendProgressText(MessageManager.getString("info.no_jobs_ran")); + wsInfo.appendProgressText(MessageManager + .getString("info.no_jobs_ran")); wsInfo.setFinishedNoResults(); } } diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index d71c653..455d98e 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -30,11 +30,14 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.CutAndPasteTransfer; +import jalview.gui.DasSourceBrowser; import jalview.gui.Desktop; import jalview.gui.IProgressIndicator; import jalview.gui.OOMWarning; +import jalview.util.DBRefUtils; import jalview.util.MessageManager; import jalview.ws.dbsources.das.api.jalviewSourceI; +import jalview.ws.dbsources.das.datamodel.DasSequenceSource; import jalview.ws.seqfetcher.DbSourceProxy; import java.util.ArrayList; @@ -45,6 +48,8 @@ import java.util.StringTokenizer; import java.util.Vector; import uk.ac.ebi.picr.model.UPEntry; +import uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface; +import uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator; /** * Implements a runnable for validating a sequence against external databases @@ -68,7 +73,7 @@ public class DBRefFetcher implements Runnable /** * picr client instance */ - uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperInterface picrClient = null; + AccessionMapperInterface picrClient = null; // /This will be a collection of Vectors of sequenceI refs. // The key will be the seq name or accession id of the seq @@ -125,9 +130,13 @@ public class DBRefFetcher implements Runnable { alseqs[i] = seqs[i]; if (seqs[i].getDatasetSequence() != null) + { ds[i] = seqs[i].getDatasetSequence(); + } else + { ds[i] = seqs[i]; + } } this.dataset = ds; // TODO Jalview 2.5 lots of this code should be in the gui package! @@ -139,10 +148,10 @@ public class DBRefFetcher implements Runnable { // af.featureSettings_actionPerformed(null); String[] defdb = null, otherdb = sfetcher - .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class); + .getDbInstances(DasSequenceSource.class); List selsources = new ArrayList(); Vector dasselsrc = (af.featureSettings != null) ? af.featureSettings - .getSelectedSources() : new jalview.gui.DasSourceBrowser() + .getSelectedSources() : new DasSourceBrowser() .getSelectedSources(); Enumeration en = dasselsrc.elements(); while (en.hasMoreElements()) @@ -201,7 +210,7 @@ public class DBRefFetcher implements Runnable } // append additional sources DbSourceProxy[] otherdb = sfetcher - .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class); + .getDbSourceProxyInstances(DasSequenceSource.class); if (otherdb != null && otherdb.length > 0) { DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length @@ -292,7 +301,7 @@ public class DBRefFetcher implements Runnable { if (Cache.getDefault("DBREFFETCH_USEPICR", false)) { - picrClient = new uk.ac.ebi.www.picr.AccessionMappingService.AccessionMapperServiceLocator() + picrClient = new AccessionMapperServiceLocator() .getAccessionMapperPort(); } } catch (Exception e) @@ -321,7 +330,7 @@ public class DBRefFetcher implements Runnable int seqIndex = 0; - jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db]; + DbSourceProxy dbsource = dbSources[db]; { // for moment, we dumbly iterate over all retrieval sources for a // particular database @@ -364,9 +373,9 @@ public class DBRefFetcher implements Runnable AlignmentI retrieved = null; try { - if (jalview.bin.Cache.log.isDebugEnabled()) + if (Cache.log.isDebugEnabled()) { - jalview.bin.Cache.log.debug("Querying " + Cache.log.debug("Querying " + dbsource.getDbName() + " with : '" + queryString.toString() + "'"); } @@ -392,7 +401,7 @@ public class DBRefFetcher implements Runnable for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++) { SequenceI sequence = dataset[seqIndex]; - DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs( + DBRefEntry[] uprefs = DBRefUtils.selectRefs( sequence.getDBRef(), new String[] { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT // }); @@ -516,7 +525,7 @@ public class DBRefFetcher implements Runnable // taking into account all accessionIds and names in the file Vector sequenceMatches = new Vector(); // look for corresponding accession ids - DBRefEntry[] entryRefs = jalview.util.DBRefUtils.selectRefs( + DBRefEntry[] entryRefs = DBRefUtils.selectRefs( entry.getDBRef(), new String[] { dbSource }); if (entryRefs == null) @@ -595,7 +604,7 @@ public class DBRefFetcher implements Runnable int absStart = entrySeq.indexOf(nonGapped); int mapStart = entry.getStart(); - jalview.datamodel.Mapping mp; + Mapping mp; if (absStart == -1) { @@ -734,7 +743,7 @@ public class DBRefFetcher implements Runnable { nseq.addElement(sequencesArray[i]); DBRefEntry dbr[] = sequencesArray[i].getDBRef(); - jalview.datamodel.Mapping map = null; + Mapping map = null; for (int r = 0; (dbr != null) && r < dbr.length; r++) { if ((map = dbr[r].getMap()) != null) diff --git a/src/jalview/ws/DasSequenceFeatureFetcher.java b/src/jalview/ws/DasSequenceFeatureFetcher.java index 3db663d..2b9eb59 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; @@ -276,7 +277,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(); @@ -629,11 +630,11 @@ public class DasSequenceFeatureFetcher { return null; } - DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs( + DBRefEntry[] uprefs = DBRefUtils.selectRefs( seq.getDBRef(), new String[] { // jalview.datamodel.DBRefSource.PDB, - jalview.datamodel.DBRefSource.UNIPROT, + DBRefSource.UNIPROT, // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord // sys sources }); @@ -652,7 +653,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 " diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java index 9c42f0a..bf96937 100644 --- a/src/jalview/ws/SequenceFetcher.java +++ b/src/jalview/ws/SequenceFetcher.java @@ -20,19 +20,32 @@ */ package jalview.ws; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.List; -import java.util.Vector; - +import jalview.analysis.CrossRef; +import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.datamodel.SequenceI; +import jalview.util.QuickSort; +import jalview.ws.dbsources.EmblCdsSouce; +import jalview.ws.dbsources.EmblSource; +import jalview.ws.dbsources.Pdb; +import jalview.ws.dbsources.PfamFull; +import jalview.ws.dbsources.PfamSeed; +import jalview.ws.dbsources.RfamFull; +import jalview.ws.dbsources.RfamSeed; +import jalview.ws.dbsources.Uniprot; +import jalview.ws.dbsources.UnprotName; import jalview.ws.dbsources.das.api.jalviewSourceI; +import jalview.ws.dbsources.das.datamodel.DasSequenceSource; import jalview.ws.seqfetcher.ASequenceFetcher; import jalview.ws.seqfetcher.DbSourceProxy; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; + /** * This is the the concrete implementation of the sequence retrieval interface * and abstract class in jalview.ws.seqfetcher. This implements the run-time @@ -55,16 +68,16 @@ public class SequenceFetcher extends ASequenceFetcher public SequenceFetcher(boolean addDas) { - addDBRefSourceImpl(jalview.ws.dbsources.EmblSource.class); - addDBRefSourceImpl(jalview.ws.dbsources.EmblCdsSouce.class); - addDBRefSourceImpl(jalview.ws.dbsources.Uniprot.class); - addDBRefSourceImpl(jalview.ws.dbsources.UnprotName.class); - addDBRefSourceImpl(jalview.ws.dbsources.Pdb.class); - addDBRefSourceImpl(jalview.ws.dbsources.PfamFull.class); - addDBRefSourceImpl(jalview.ws.dbsources.PfamSeed.class); + addDBRefSourceImpl(EmblSource.class); + addDBRefSourceImpl(EmblCdsSouce.class); + addDBRefSourceImpl(Uniprot.class); + addDBRefSourceImpl(UnprotName.class); + addDBRefSourceImpl(Pdb.class); + addDBRefSourceImpl(PfamFull.class); + addDBRefSourceImpl(PfamSeed.class); // ensures Seed alignment is 'default' for PFAM - addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class); - addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class); + addDBRefSourceImpl(RfamFull.class); + addDBRefSourceImpl(RfamSeed.class); if (addDas) { registerDasSequenceSources(); @@ -94,7 +107,7 @@ public class SequenceFetcher extends ASequenceFetcher else { nm = dbs.getDbName(); - if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) + if (getSourceProxy(srcs[i]) instanceof DasSequenceSource) { if (nm.startsWith("das:")) { @@ -124,7 +137,7 @@ public class SequenceFetcher extends ASequenceFetcher { tosort[j] = tosort[j].toLowerCase(); } - jalview.util.QuickSort.sort(tosort, sorted); + QuickSort.sort(tosort, sorted); // construct array with all sources listed srcs = new String[sorted.length + dassrc.size()]; @@ -141,7 +154,7 @@ public class SequenceFetcher extends ASequenceFetcher { tosort[j] = tosort[j].toLowerCase(); } - jalview.util.QuickSort.sort(tosort, sorted); + QuickSort.sort(tosort, sorted); for (int j = sorted.length - 1; j >= 0; j--, i++) { srcs[i] = sorted[j]; @@ -161,7 +174,7 @@ public class SequenceFetcher extends ASequenceFetcher for (DbSourceProxy dbs : getSourceProxy(srcs[i])) { String nm = dbs.getDbName(); - if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) + if (getSourceProxy(srcs[i]) instanceof DasSequenceSource) { if (nm.startsWith("das:")) { @@ -184,7 +197,7 @@ public class SequenceFetcher extends ASequenceFetcher { tosort[j] = ((String[]) sorted[j])[1]; } - jalview.util.QuickSort.sort(tosort, sorted); + QuickSort.sort(tosort, sorted); int i = 0; // construct array with all sources listed srcs = new String[sorted.length + dassrc.size()]; @@ -201,7 +214,7 @@ public class SequenceFetcher extends ASequenceFetcher { tosort[j] = ((String[]) sorted[j])[1]; } - jalview.util.QuickSort.sort(tosort, sorted); + QuickSort.sort(tosort, sorted); for (int j = sorted.length - 1; j >= 0; j--, i++) { srcs[i] = ((String[]) sorted[j])[0]; @@ -304,8 +317,8 @@ public class SequenceFetcher extends ASequenceFetcher || sp.getDbSourceProperties().containsKey( DBRefSource.CODINGSEQDB); // try and find products - String types[] = jalview.analysis.CrossRef - .findSequenceXrefTypes(dna, al.getSequencesArray()); + String types[] = CrossRef.findSequenceXrefTypes(dna, + al.getSequencesArray()); if (types != null) { System.out.println("Xref Types for: " @@ -313,7 +326,7 @@ public class SequenceFetcher extends ASequenceFetcher for (int t = 0; t < types.length; t++) { System.out.println("Type: " + types[t]); - SequenceI[] prod = jalview.analysis.CrossRef + SequenceI[] prod = CrossRef .findXrefSequences(al.getSequencesArray(), dna, types[t]).getSequencesArray(); System.out.println("Found " @@ -399,7 +412,8 @@ public class SequenceFetcher extends ASequenceFetcher // have a bash at finding the products amongst all the retrieved // sequences. SequenceI[] seqs = al.getSequencesArray(); - Alignment prodal = jalview.analysis.CrossRef.findXrefSequences( + Alignment prodal = CrossRef + .findXrefSequences( seqs, dna, null, ds); System.out.println("Found " + ((prodal == null) ? "no" : "" + prodal.getHeight()) @@ -438,8 +452,8 @@ public class SequenceFetcher extends ASequenceFetcher public void registerDasSequenceSources() { // TODO: define a context as a registry provider (either desktop, - // jalview.bin.cache, or something else). - for (jalviewSourceI source : jalview.bin.Cache.getDasSourceRegistry() + // Cache, or something else). + for (jalviewSourceI source : Cache.getDasSourceRegistry() .getSources()) { if (source.isSequenceSource()) diff --git a/src/jalview/ws/dbsources/EmblCdsSouce.java b/src/jalview/ws/dbsources/EmblCdsSouce.java index 3a9ebe9..e649223 100644 --- a/src/jalview/ws/dbsources/EmblCdsSouce.java +++ b/src/jalview/ws/dbsources/EmblCdsSouce.java @@ -20,12 +20,12 @@ */ package jalview.ws.dbsources; -import com.stevesoft.pat.Regex; - import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.ws.seqfetcher.DbSourceProxy; +import com.stevesoft.pat.Regex; + public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy { @@ -42,7 +42,7 @@ public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy public Regex getAccessionValidator() { - return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+"); + return new Regex("^[A-Z]+[0-9]+"); } public String getDbSource() diff --git a/src/jalview/ws/dbsources/EmblSource.java b/src/jalview/ws/dbsources/EmblSource.java index 5b06c81..426774b 100644 --- a/src/jalview/ws/dbsources/EmblSource.java +++ b/src/jalview/ws/dbsources/EmblSource.java @@ -20,12 +20,12 @@ */ package jalview.ws.dbsources; -import com.stevesoft.pat.Regex; - import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.ws.seqfetcher.DbSourceProxy; +import com.stevesoft.pat.Regex; + /** * @author JimP * @@ -57,7 +57,7 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy */ public Regex getAccessionValidator() { - return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+"); + return new Regex("^[A-Z]+[0-9]+"); } /* diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index c75a36f..4158808 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -26,6 +26,7 @@ import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; import jalview.io.FormatAdapter; import jalview.util.MessageManager; import jalview.ws.ebi.EBIFetchClient; @@ -132,7 +133,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy { pdbfile = new FormatAdapter().readFile(file, - jalview.io.AppletFormatAdapter.FILE, "PDB"); + AppletFormatAdapter.FILE, "PDB"); if (pdbfile != null) { List toremove = new ArrayList(); @@ -155,7 +156,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy || chid.trim().equals(chain.trim()) || (chain .trim().length() == 0 && chid.equals("_"))))) { - pdbcs.setName(jalview.datamodel.DBRefSource.PDB + "|" + id + pdbcs.setName(DBRefSource.PDB + "|" + id + "|" + pdbcs.getName()); // Might need to add more metadata to the PDBEntry object // like below diff --git a/src/jalview/ws/dbsources/Pfam.java b/src/jalview/ws/dbsources/Pfam.java index c8f7ee7..0d61860 100644 --- a/src/jalview/ws/dbsources/Pfam.java +++ b/src/jalview/ws/dbsources/Pfam.java @@ -20,12 +20,14 @@ */ package jalview.ws.dbsources; -import com.stevesoft.pat.Regex; - import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; +import jalview.datamodel.DBRefSource; +import jalview.io.FormatAdapter; import jalview.ws.seqfetcher.DbSourceProxy; +import com.stevesoft.pat.Regex; + /** * TODO: later PFAM is a complex datasource - it could return a tree in addition * to an alignment TODO: create interface to pass alignment properties and tree @@ -41,8 +43,8 @@ abstract public class Pfam extends Xfam implements DbSourceProxy { super(); // all extensions of this PFAM source base class are DOMAINDB sources - addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB); - addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB); + addDbSourceProperty(DBRefSource.DOMAINDB); + addDbSourceProperty(DBRefSource.ALIGNMENTDB); } /* @@ -74,7 +76,7 @@ abstract public class Pfam extends Xfam implements DbSourceProxy * this doesn't work - DbSource is key for the hash of DbSourceProxy instances * - 1:many mapping for DbSource to proxy will be lost. * suggest : PFAM is an * 'alignment' source - means proxy is higher level than a sequence source. - * return jalview.datamodel.DBRefSource.PFAM; } + * return DBRefSource.PFAM; } */ /* @@ -117,16 +119,16 @@ abstract public class Pfam extends Xfam implements DbSourceProxy // individual references to each sequence in each family alignment that's // retrieved. startQuery(); - AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL() - + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL, + AlignmentI rcds = new FormatAdapter().readFile(getXFAMURL() + + queries.trim().toUpperCase(), FormatAdapter.URL, "STH"); for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++) { rcds.getSequenceAt(s).addDBRef( - new DBRefEntry(jalview.datamodel.DBRefSource.PFAM, +new DBRefEntry(DBRefSource.PFAM, // getDbSource(), getDbVersion(), queries.trim().toUpperCase())); - if (!getDbSource().equals(jalview.datamodel.DBRefSource.PFAM)) + if (!getDbSource().equals(DBRefSource.PFAM)) { // add the specific ref too rcds.getSequenceAt(s).addDBRef( new DBRefEntry(getDbSource(), getDbVersion(), queries @@ -153,7 +155,7 @@ abstract public class Pfam extends Xfam implements DbSourceProxy public String getXfamSource() { - return jalview.datamodel.DBRefSource.PFAM; + return DBRefSource.PFAM; } } diff --git a/src/jalview/ws/dbsources/PfamSeed.java b/src/jalview/ws/dbsources/PfamSeed.java index 2ea75af..f9ebf1d 100644 --- a/src/jalview/ws/dbsources/PfamSeed.java +++ b/src/jalview/ws/dbsources/PfamSeed.java @@ -20,6 +20,7 @@ */ package jalview.ws.dbsources; +import jalview.datamodel.DBRefSource; import jalview.ws.seqfetcher.DbSourceProxy; /** @@ -57,7 +58,7 @@ public class PfamSeed extends Pfam implements DbSourceProxy public String getDbSource() { - return jalview.datamodel.DBRefSource.PFAM; // archetype source + return DBRefSource.PFAM; // archetype source } public String getTestQuery() diff --git a/src/jalview/ws/dbsources/Rfam.java b/src/jalview/ws/dbsources/Rfam.java index 62f2b28..34fe72f 100644 --- a/src/jalview/ws/dbsources/Rfam.java +++ b/src/jalview/ws/dbsources/Rfam.java @@ -20,10 +20,11 @@ */ package jalview.ws.dbsources; -import com.stevesoft.pat.Regex; - +import jalview.datamodel.DBRefSource; import jalview.ws.seqfetcher.DbSourceProxy; +import com.stevesoft.pat.Regex; + /** * Contains methods for fetching sequences from Rfam database * @@ -36,8 +37,8 @@ abstract public class Rfam extends Xfam implements DbSourceProxy { super(); // all extensions of this RFAM source base class are DOMAINDB sources - addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB); - addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB); + addDbSourceProperty(DBRefSource.DOMAINDB); + addDbSourceProperty(DBRefSource.ALIGNMENTDB); } /* @@ -72,7 +73,7 @@ abstract public class Rfam extends Xfam implements DbSourceProxy * this doesn't work - DbSource is key for the hash of DbSourceProxy instances * - 1:many mapping for DbSource to proxy will be lost. * suggest : RFAM is an * 'alignment' source - means proxy is higher level than a sequence source. - * return jalview.datamodel.DBRefSource.RFAM; } + * return DBRefSource.RFAM; } */ /* @@ -112,7 +113,7 @@ abstract public class Rfam extends Xfam implements DbSourceProxy */ public String getXfamSource() { - return jalview.datamodel.DBRefSource.RFAM; + return DBRefSource.RFAM; } } diff --git a/src/jalview/ws/dbsources/UnprotName.java b/src/jalview/ws/dbsources/UnprotName.java index 5dbc960..bca9838 100644 --- a/src/jalview/ws/dbsources/UnprotName.java +++ b/src/jalview/ws/dbsources/UnprotName.java @@ -20,6 +20,9 @@ */ package jalview.ws.dbsources; +import jalview.datamodel.DBRefSource; +import jalview.ws.seqfetcher.DbSourceProxy; + /** * Canonical Uniprot fetcher instance specifically retrieving UP_NAME * references. @@ -27,8 +30,7 @@ package jalview.ws.dbsources; * @author JimP * */ -public class UnprotName extends Uniprot implements - jalview.ws.seqfetcher.DbSourceProxy +public class UnprotName extends Uniprot implements DbSourceProxy { /* @@ -38,7 +40,7 @@ public class UnprotName extends Uniprot implements */ public String getDbSource() { - return jalview.datamodel.DBRefSource.UP_NAME; + return DBRefSource.UP_NAME; } } diff --git a/src/jalview/ws/dbsources/Xfam.java b/src/jalview/ws/dbsources/Xfam.java index c392ce6..30dfd06 100644 --- a/src/jalview/ws/dbsources/Xfam.java +++ b/src/jalview/ws/dbsources/Xfam.java @@ -22,6 +22,7 @@ package jalview.ws.dbsources; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; +import jalview.io.FormatAdapter; import jalview.ws.seqfetcher.DbSourceProxyImpl; /** @@ -51,8 +52,8 @@ public abstract class Xfam extends DbSourceProxyImpl // retrieved. startQuery(); // TODO: trap HTTP 404 exceptions and return null - AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL() - + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL, + AlignmentI rcds = new FormatAdapter().readFile(getXFAMURL() + + queries.trim().toUpperCase(), FormatAdapter.URL, "STH"); for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++) { diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java index dd3d901..c020497 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java @@ -20,6 +20,18 @@ */ package jalview.ws.dbsources.das.datamodel; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.util.MessageManager; +import jalview.ws.DasSequenceFeatureFetcher; +import jalview.ws.dbsources.das.api.jalviewSourceI; +import jalview.ws.seqfetcher.DbSourceProxy; +import jalview.ws.seqfetcher.DbSourceProxyImpl; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -39,16 +51,6 @@ import org.biodas.jdas.schema.sources.VERSION; import com.stevesoft.pat.Regex; -import jalview.util.MessageManager; -import jalview.ws.dbsources.das.api.jalviewSourceI; -import jalview.ws.seqfetcher.*; -import jalview.bin.Cache; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceI; - /** * an instance of this class is created for each unique DAS Sequence source (ie * one capable of handling the 'sequence' for a particular MapMaster) @@ -278,11 +280,13 @@ public class DasSequenceSource extends DbSourceProxyImpl implements } if (seqs == null || seqs.size() == 0) + { return null; + } SequenceI[] sqs = new SequenceI[seqs.size()]; for (int i = 0, iSize = seqs.size(); i < iSize; i++) { - sqs[i] = (SequenceI) seqs.elementAt(i); + sqs[i] = seqs.elementAt(i); } Alignment al = new Alignment(sqs); if (jsrc.isFeatureSource()) @@ -291,7 +295,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements srcs.addElement(jsrc); try { - jalview.ws.DasSequenceFeatureFetcher dssf = new jalview.ws.DasSequenceFeatureFetcher( + DasSequenceFeatureFetcher dssf = new DasSequenceFeatureFetcher( sqs, null, srcs, false, false, multiple); while (dssf.isRunning()) { diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java index e2e7534..432f417 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java @@ -70,20 +70,20 @@ public class DasSourceRegistry implements DasSourceRegistryI, public String getDasRegistryURL() { - String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL", + String registry = Cache.getDefault("DAS_REGISTRY_URL", DEFAULT_REGISTRY); if (registry.indexOf("/registry/das1/sources/") > -1) { - jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL, + Cache.setProperty(Cache.DAS_REGISTRY_URL, DEFAULT_REGISTRY); registry = DEFAULT_REGISTRY; } if (registry.lastIndexOf("sources.xml") == registry.length() - 11) { // no trailing sources.xml document for registry in JDAS - jalview.bin.Cache.setProperty( - jalview.bin.Cache.DAS_REGISTRY_URL, + Cache.setProperty( + Cache.DAS_REGISTRY_URL, registry = registry.substring(0, registry.lastIndexOf("sources.xml"))); } @@ -180,7 +180,7 @@ public class DasSourceRegistry implements DasSourceRegistryI, if (localSources == null) { // get local sources from properties and initialise the local source list - String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE"); + String local = Cache.getProperty("DAS_LOCAL_SOURCE"); if (local != null) { @@ -327,7 +327,7 @@ public class DasSourceRegistry implements DasSourceRegistryI, localSources.remove(source.getTitle()); sourceNames.remove(source.getTitle()); dasSources.remove(source); - jalview.bin.Cache.setProperty("DAS_LOCAL_SOURCE", + Cache.setProperty("DAS_LOCAL_SOURCE", getLocalSourceString()); return true; diff --git a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java index b3bb342..9f171fe 100644 --- a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java @@ -20,6 +20,11 @@ */ package jalview.ws.dbsources.das.datamodel; +import jalview.util.MessageManager; +import jalview.util.QuickSort; +import jalview.ws.dbsources.das.api.jalviewSourceI; +import jalview.ws.seqfetcher.DbSourceProxy; + import java.text.ParseException; import java.util.ArrayList; import java.util.Date; @@ -37,10 +42,6 @@ import org.biodas.jdas.schema.sources.PROP; import org.biodas.jdas.schema.sources.SOURCE; import org.biodas.jdas.schema.sources.VERSION; -import jalview.util.MessageManager; -import jalview.ws.dbsources.das.api.jalviewSourceI; -import jalview.ws.seqfetcher.DbSourceProxy; - public class JalviewSource implements jalviewSourceI { SOURCE source; @@ -319,7 +320,7 @@ public class JalviewSource implements jalviewSourceI { nm[i] = tsort[i].getDbName().toLowerCase(); } - jalview.util.QuickSort.sort(nm, tsort); + QuickSort.sort(nm, tsort); seqsources.clear(); for (DbSourceProxy ssrc : tsort) { diff --git a/src/jalview/ws/jws1/Discoverer.java b/src/jalview/ws/jws1/Discoverer.java index d544bea..60bbd95 100644 --- a/src/jalview/ws/jws1/Discoverer.java +++ b/src/jalview/ws/jws1/Discoverer.java @@ -20,6 +20,8 @@ */ package jalview.ws.jws1; +import jalview.bin.Cache; +import jalview.gui.Desktop; import jalview.util.MessageManager; import java.util.Hashtable; @@ -98,7 +100,7 @@ public class Discoverer implements Runnable // timeout } catch (Exception ex) { - jalview.bin.Cache.log + Cache.log .error("Serious! Service location failed\nfor URL :" + WsURL + "\n", ex); @@ -127,7 +129,7 @@ public class Discoverer implements Runnable static private Vector getDiscoveryURLS() { Vector urls = new Vector(); - String RootServiceURLs = jalview.bin.Cache + String RootServiceURLs = Cache .getDefault("DISCOVERY_URLS", "http://www.compbio.dundee.ac.uk/JalviewWS/services/ServiceRegistry"); @@ -146,23 +148,23 @@ public class Discoverer implements Runnable } else { - jalview.bin.Cache.log + Cache.log .info("Ignoring duplicate url in DISCOVERY_URLS list"); } } catch (Exception ex) { - jalview.bin.Cache.log + Cache.log .warn("Problem whilst trying to make a URL from '" + ((url != null) ? url : "") + "'"); - jalview.bin.Cache.log + Cache.log .warn("This was probably due to a malformed comma separated list" + " in the DISCOVERY_URLS entry of $(HOME)/.jalview_properties)"); - jalview.bin.Cache.log.debug("Exception was ", ex); + Cache.log.debug("Exception was ", ex); } } } catch (Exception ex) { - jalview.bin.Cache.log + Cache.log .warn("Error parsing comma separated list of urls in DISCOVERY_URLS.", ex); } @@ -178,11 +180,11 @@ public class Discoverer implements Runnable */ static public void doDiscovery() { - jalview.bin.Cache.log + Cache.log .debug("(Re)-Initialising the discovery URL list."); try { - reallyDiscoverServices = jalview.bin.Cache.getDefault( + reallyDiscoverServices = Cache.getDefault( "DISCOVERY_START", false); if (reallyDiscoverServices) { @@ -190,7 +192,7 @@ public class Discoverer implements Runnable } else { - jalview.bin.Cache.log.debug("Setting default services"); + Cache.log.debug("Setting default services"); services = new Hashtable(); // Muscle, Clustal and JPred. ServiceHandle[] defServices = @@ -244,32 +246,30 @@ public class Discoverer implements Runnable ServiceHandles shs = null; try { - jalview.bin.Cache.log.debug("Discovering services using " + location); + Cache.log.debug("Discovering services using " + location); shs = locateWebService(location).getServices(); } catch (org.apache.axis.AxisFault f) { // JBPNote - should do this a better way! if (f.getFaultReason().indexOf("(407)") > -1) { - if (jalview.gui.Desktop.desktop != null) + if (Desktop.desktop != null) { - JOptionPane - .showMessageDialog( - jalview.gui.Desktop.desktop, - MessageManager.getString("label.set_proxy_settings"), - MessageManager.getString("label.proxy_authorization_failed"), - JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog(Desktop.desktop, MessageManager + .getString("label.set_proxy_settings"), MessageManager + .getString("label.proxy_authorization_failed"), + JOptionPane.WARNING_MESSAGE); } } else { - jalview.bin.Cache.log.warn("No Discovery service at " + location); - jalview.bin.Cache.log.debug("Axis Fault", f); + Cache.log.warn("No Discovery service at " + location); + Cache.log.debug("Axis Fault", f); } } catch (Exception e) { - jalview.bin.Cache.log.warn("No Discovery service at " + location); - jalview.bin.Cache.log.debug("Discovery Service General Exception", e); + Cache.log.warn("No Discovery service at " + location); + Cache.log.debug("Discovery Service General Exception", e); } if ((shs != null) && shs.getServices().length > 0) { @@ -298,7 +298,7 @@ public class Discoverer implements Runnable { if (!cat.contains(sh[i])) { - jalview.bin.Cache.log.debug("A " + sh[i].getAbstractName() + Cache.log.debug("A " + sh[i].getAbstractName() + " service called " + sh[i].getName() + " exists at " + sh[i].getEndpointURL() + "\n"); if (!sscat.containsKey(sh[i].getAbstractName())) @@ -320,7 +320,7 @@ public class Discoverer implements Runnable disc_serv = new java.net.URL(sh[i].getEndpointURL()); if (!ServiceURLList.contains(disc_serv)) { - jalview.bin.Cache.log + Cache.log .debug("Adding new discovery service at " + disc_serv); ServiceURLList.add(disc_serv); @@ -328,7 +328,7 @@ public class Discoverer implements Runnable } } catch (Exception e) { - jalview.bin.Cache.log.debug( + Cache.log.debug( "Ignoring bad discovery service URL " + sh[i].getEndpointURL(), e); } @@ -347,7 +347,7 @@ public class Discoverer implements Runnable int s_url = 0; if (ServiceURLList == null) { - jalview.bin.Cache.log + Cache.log .debug("No service endpoints to use for service discovery."); return; } @@ -360,7 +360,7 @@ public class Discoverer implements Runnable } else { - jalview.bin.Cache.log + Cache.log .warn("No services at " + (ServiceURLList.get(s_url)) + " - check DISCOVERY_URLS property in .jalview_properties"); diff --git a/src/jalview/ws/jws1/JPredClient.java b/src/jalview/ws/jws1/JPredClient.java index 2e000f8..1e483e3 100644 --- a/src/jalview/ws/jws1/JPredClient.java +++ b/src/jalview/ws/jws1/JPredClient.java @@ -21,6 +21,7 @@ package jalview.ws.jws1; import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; import jalview.bin.Cache; import jalview.datamodel.AlignmentView; import jalview.datamodel.SeqCigar; @@ -89,7 +90,7 @@ public class JPredClient extends WS1Client * visible regions */ private void startJPredClient(String title, boolean msa, - jalview.datamodel.AlignmentView alview, AlignFrame parentFrame, + AlignmentView alview, AlignFrame parentFrame, boolean viewonly) { AlignmentView input = alview; @@ -128,8 +129,7 @@ public class JPredClient extends WS1Client aln[i] = msf[i].getSeq('-'); } - Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.uniquify(aln, - true); + Hashtable SequenceInfo = SeqsetUtils.uniquify(aln, true); if (viewonly) { // Remove hidden regions from sequence objects. @@ -161,8 +161,7 @@ public class JPredClient extends WS1Client + (viewonly ? "visible " : "") + "sequence " + seq.getName() + " from " + title; String seqname = seq.getName(); - Hashtable SequenceInfo = jalview.analysis.SeqsetUtils - .SeqCharacterHash(seq); + Hashtable SequenceInfo = SeqsetUtils.SeqCharacterHash(seq); if (viewonly) { // Remove hidden regions from input sequence @@ -248,7 +247,7 @@ public class JPredClient extends WS1Client aln[i] = new jalview.datamodel.Sequence(msf[i]); } - Hashtable SequenceInfo = jalview.analysis.SeqsetUtils.uniquify(aln, + Hashtable SequenceInfo = SeqsetUtils.uniquify(aln, true); Jpred server = locateWebService(); @@ -276,8 +275,7 @@ public class JPredClient extends WS1Client String altitle = "JNet prediction for sequence " + seq.getName() + " from " + title; - Hashtable SequenceInfo = jalview.analysis.SeqsetUtils - .SeqCharacterHash(seq); + Hashtable SequenceInfo = SeqsetUtils.SeqCharacterHash(seq); Jpred server = locateWebService(); if (server == null) diff --git a/src/jalview/ws/jws1/JPredThread.java b/src/jalview/ws/jws1/JPredThread.java index 62566cf..f965572 100644 --- a/src/jalview/ws/jws1/JPredThread.java +++ b/src/jalview/ws/jws1/JPredThread.java @@ -21,7 +21,9 @@ package jalview.ws.jws1; import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; import jalview.bin.Cache; +import jalview.commands.RemoveGapsCommand; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -32,6 +34,10 @@ import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.WebserviceInfo; import jalview.io.FormatAdapter; +import jalview.io.IdentifyFile; +import jalview.io.JPredFile; +import jalview.io.JnetAnnotationMaker; +import jalview.io.PileUpfile; import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.ws.AWsJob; @@ -42,6 +48,7 @@ import java.util.Hashtable; import java.util.List; import vamsas.objects.simple.JpredResult; +import vamsas.objects.simple.Msfalignment; class JPredThread extends JWS1Thread implements WSClientI { @@ -110,23 +117,22 @@ class JPredThread extends JWS1Thread implements WSClientI JpredResult result = (JpredResult) this.result; - jalview.bin.Cache.log.debug("Parsing output from JNet job."); + Cache.log.debug("Parsing output from JNet job."); // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", // "File"); - jalview.io.JPredFile prediction = new jalview.io.JPredFile( - result.getPredfile(), "Paste"); + JPredFile prediction = new JPredFile(result.getPredfile(), "Paste"); SequenceI[] preds = prediction.getSeqsAsArray(); - jalview.bin.Cache.log.debug("Got prediction profile."); + Cache.log.debug("Got prediction profile."); if ((this.msa != null) && (result.getAligfile() != null)) { - jalview.bin.Cache.log.debug("Getting associated alignment."); + Cache.log.debug("Getting associated alignment."); // we ignore the returned alignment if we only predicted on a single // sequence - String format = new jalview.io.IdentifyFile().Identify( - result.getAligfile(), "Paste"); + String format = new IdentifyFile().Identify(result.getAligfile(), + "Paste"); - if (jalview.io.FormatAdapter.isValidFormat(format)) + if (FormatAdapter.isValidFormat(format)) { SequenceI sqs[]; if (predMap != null) @@ -147,8 +153,7 @@ class JPredThread extends JWS1Thread implements WSClientI { sqs[i] = al.getSequenceAt(i); } - if (!jalview.analysis.SeqsetUtils.deuniquify( - SequenceInfo, sqs)) + if (!SeqsetUtils.deuniquify(SequenceInfo, sqs)) { throw (new Exception(MessageManager.getString("exception.couldnt_recover_sequence_properties_for_alignment"))); } @@ -163,8 +168,8 @@ class JPredThread extends JWS1Thread implements WSClientI { al.setDataset(null); } - jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, - FirstSeq, false, predMap); + JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, + false, predMap); } else @@ -189,7 +194,8 @@ class JPredThread extends JWS1Thread implements WSClientI // /// // Uses RemoveGapsCommand // /// - new jalview.commands.RemoveGapsCommand(MessageManager.getString("label.remove_gaps"), + new RemoveGapsCommand( + MessageManager.getString("label.remove_gaps"), new SequenceI[] { sqs[msaIndex] }, currentView); @@ -197,7 +203,7 @@ class JPredThread extends JWS1Thread implements WSClientI profileseq.setSequence(sqs[msaIndex].getSequenceAsString()); } - if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash( + if (!SeqsetUtils.SeqCharacterUnhash( al.getSequenceAt(FirstSeq), SequenceInfo)) { throw (new Exception(MessageManager.getString("exception.couldnt_recover_sequence_props_for_jnet_query"))); @@ -213,7 +219,7 @@ class JPredThread extends JWS1Thread implements WSClientI { al.setDataset(null); } - jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, + JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, true, predMap); SequenceI profileseq = al.getSequenceAt(0); // this includes any gaps. alignToProfileSeq(al, profileseq); @@ -348,8 +354,8 @@ class JPredThread extends JWS1Thread implements WSClientI { if (msf.length > 1) { - msa = new vamsas.objects.simple.Msfalignment(); - jalview.io.PileUpfile pileup = new jalview.io.PileUpfile(); + msa = new Msfalignment(); + PileUpfile pileup = new PileUpfile(); msa.setMsf(pileup.print(msf)); } } @@ -471,7 +477,7 @@ class JPredThread extends JWS1Thread implements WSClientI .println("JPredWS Client: Failed to submit the prediction. Quite possibly because of a server error - see below)\n" + e.getMessage() + "\n"); - jalview.bin.Cache.log.warn("Server Exception", e); + Cache.log.warn("Server Exception", e); } else { @@ -479,7 +485,7 @@ class JPredThread extends JWS1Thread implements WSClientI // JBPNote - this could be a popup informing the user of the problem. wsInfo.appendProgressText(j.getJobnum(), MessageManager.formatMessage("info.failed_to_submit_prediction", new String[]{e.getMessage(),wsInfo.getProgressText()})); - jalview.bin.Cache.log.debug( + Cache.log.debug( "Failed Submission of job " + j.getJobnum(), e); } @@ -557,9 +563,9 @@ class JPredThread extends JWS1Thread implements WSClientI msa = (j.msa != null) ? true : msa; try { - jalview.bin.Cache.log.debug("Parsing output of job " + jn); + Cache.log.debug("Parsing output of job " + jn); jobres = j.getResultSet(); - jalview.bin.Cache.log.debug("Finished parsing output."); + Cache.log.debug("Finished parsing output."); if (jobs.length == 1) { res = jobres; @@ -571,7 +577,7 @@ class JPredThread extends JWS1Thread implements WSClientI } } catch (Exception e) { - jalview.bin.Cache.log.error( + Cache.log.error( "JNet Client: JPred Annotation Parse Error", e); wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR); diff --git a/src/jalview/ws/jws1/MsaWSThread.java b/src/jalview/ws/jws1/MsaWSThread.java index af3db9c..89a370d 100644 --- a/src/jalview/ws/jws1/MsaWSThread.java +++ b/src/jalview/ws/jws1/MsaWSThread.java @@ -20,16 +20,28 @@ */ package jalview.ws.jws1; -import java.util.*; - -import jalview.analysis.*; -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.gui.*; +import jalview.analysis.AlignSeq; +import jalview.analysis.AlignmentSorter; +import jalview.analysis.SeqsetUtils; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentOrder; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.WebserviceInfo; +import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.ws.AWsJob; import jalview.ws.JobStateSummary; import jalview.ws.WSClientI; + +import java.util.Hashtable; +import java.util.Vector; + import vamsas.objects.simple.MsaResult; class MsaWSThread extends JWS1Thread implements WSClientI @@ -102,18 +114,17 @@ class MsaWSThread extends JWS1Thread implements WSClientI for (int i = 0, n = 0; i < seqs.length; i++) { - String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same + String newname = SeqsetUtils.unique_name(i); // same // for // any // subjob - SeqNames.put(newname, - jalview.analysis.SeqsetUtils.SeqCharacterHash(seqs[i])); + SeqNames.put(newname, SeqsetUtils.SeqCharacterHash(seqs[i])); if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) { seqarray[n] = new vamsas.objects.simple.Sequence(); seqarray[n].setId(newname); seqarray[n++].setSeq((submitGaps) ? seqs[i].getSequenceAsString() - : AlignSeq.extractGaps(jalview.util.Comparison.GapChars, + : AlignSeq.extractGaps(Comparison.GapChars, seqs[i].getSequenceAsString())); } else @@ -122,7 +133,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI if (seqs[i].getEnd() >= seqs[i].getStart()) { empty = (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq - .extractGaps(jalview.util.Comparison.GapChars, + .extractGaps(Comparison.GapChars, seqs[i].getSequenceAsString()); } emptySeqs.add(new String[] @@ -219,21 +230,21 @@ class MsaWSThread extends JWS1Thread implements WSClientI String[] es = (String[]) emptySeqs.get(i); if (es[1] == null) { - t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence(es[0], + t_alseqs[i + alseq_l] = new Sequence(es[0], insbuff.toString(), 1, 0); } else { if (es[1].length() < nw) { - t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence( + t_alseqs[i + alseq_l] = new Sequence( es[0], es[1] + insbuff.substring(0, nw - es[1].length()), 1, 1 + es[1].length()); } else { - t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence( + t_alseqs[i + alseq_l] = new Sequence( es[0], es[1]); } } @@ -242,9 +253,9 @@ class MsaWSThread extends JWS1Thread implements WSClientI } AlignmentOrder msaorder = new AlignmentOrder(alseqs); // always recover the order - makes parseResult()'s life easier. - jalview.analysis.AlignmentSorter.recoverOrder(alseqs); + AlignmentSorter.recoverOrder(alseqs); // account for any missing sequences - jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); + SeqsetUtils.deuniquify(SeqNames, alseqs); return new Object[] { alseqs, msaorder }; } @@ -292,7 +303,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI * boolean */ MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl, - WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, + WebserviceInfo wsinfo, AlignFrame alFrame, AlignmentView alview, String wsname, boolean subgaps, boolean presorder) { @@ -317,7 +328,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI * Alignment */ MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl, - WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, + WebserviceInfo wsinfo, AlignFrame alFrame, String wsname, String title, AlignmentView _msa, boolean subgaps, boolean presorder, Alignment seqset) { @@ -493,16 +504,16 @@ class MsaWSThread extends JWS1Thread implements WSClientI } } - private jalview.datamodel.Sequence[] getVamsasAlignment( + private Sequence[] getVamsasAlignment( vamsas.objects.simple.Alignment valign) { // TODO: refactor to helper class for vamsas.objects.simple objects vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); - jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.length]; + Sequence[] msa = new Sequence[seqs.length]; for (int i = 0, j = seqs.length; i < j; i++) { - msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), + msa[i] = new Sequence(seqs[i].getId(), seqs[i].getSeq()); } @@ -649,7 +660,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI while (j < l) { if (((AlignmentOrder) alorders.get(i)) - .equals(((AlignmentOrder) alorders.get(j)))) + .equals((alorders.get(j)))) { alorders.remove(j); l--; diff --git a/src/jalview/ws/jws1/SeqSearchWSClient.java b/src/jalview/ws/jws1/SeqSearchWSClient.java index b688978..7d0a7e2 100644 --- a/src/jalview/ws/jws1/SeqSearchWSClient.java +++ b/src/jalview/ws/jws1/SeqSearchWSClient.java @@ -20,6 +20,14 @@ */ package jalview.ws.jws1; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentView; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.WebserviceInfo; +import jalview.util.MessageManager; + import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -28,12 +36,13 @@ import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; -import javax.swing.*; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; -import ext.vamsas.*; -import jalview.datamodel.*; -import jalview.gui.*; -import jalview.util.MessageManager; +import ext.vamsas.SeqSearchServiceLocator; +import ext.vamsas.SeqSearchServiceSoapBindingStub; +import ext.vamsas.ServiceHandle; /** * DOCUMENT ME! @@ -67,8 +76,8 @@ public class SeqSearchWSClient extends WS1Client */ public SeqSearchWSClient(ext.vamsas.ServiceHandle sh, String altitle, - jalview.datamodel.AlignmentView msa, String db, - Alignment seqdataset, AlignFrame _alignFrame) + AlignmentView msa, String db, Alignment seqdataset, + AlignFrame _alignFrame) { super(); alignFrame = _alignFrame; @@ -160,7 +169,7 @@ public class SeqSearchWSClient extends WS1Client try { - this.server = (SeqSearchI) loc.getSeqSearchService(new java.net.URL( + this.server = loc.getSeqSearchService(new java.net.URL( WsURL)); ((SeqSearchServiceSoapBindingStub) this.server).setTimeout(60000); // One // minute @@ -252,11 +261,10 @@ public class SeqSearchWSClient extends WS1Client String dbs[] = null; try { - dbs = new jalview.ws.jws1.SeqSearchWSClient(sh) - .getSupportedDatabases(); + dbs = new SeqSearchWSClient(sh).getSupportedDatabases(); } catch (Exception e) { - jalview.bin.Cache.log.warn( + Cache.log.warn( "Database list request failed, so disabling SeqSearch Service client " + sh.getName() + " at " + sh.getEndpointURL(), e); return; @@ -272,8 +280,8 @@ public class SeqSearchWSClient extends WS1Client // use same input gatherer as for secondary structure prediction // we could actually parameterise the gatherer method here... AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction(); - new jalview.ws.jws1.SeqSearchWSClient(sh, af.getTitle(), msa, null, - af.getViewport().getAlignment().getDataset(), af); + new SeqSearchWSClient(sh, af.getTitle(), msa, null, af + .getViewport().getAlignment().getDataset(), af); } }); // add entry for each database the service supports @@ -294,7 +302,7 @@ public class SeqSearchWSClient extends WS1Client public void actionPerformed(ActionEvent e) { AlignmentView msa = af.gatherSeqOrMsaForSecStrPrediction(); - new jalview.ws.jws1.SeqSearchWSClient(sh, af.getTitle(), msa, + new SeqSearchWSClient(sh, af.getTitle(), msa, searchdb, af.getViewport().getAlignment().getDataset(), af); } diff --git a/src/jalview/ws/jws1/SeqSearchWSThread.java b/src/jalview/ws/jws1/SeqSearchWSThread.java index 5d44ddd..f65bf03 100644 --- a/src/jalview/ws/jws1/SeqSearchWSThread.java +++ b/src/jalview/ws/jws1/SeqSearchWSThread.java @@ -20,17 +20,29 @@ */ package jalview.ws.jws1; -import java.util.*; - -import jalview.analysis.*; -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.gui.*; +import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; +import jalview.bin.Cache; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.WebserviceInfo; +import jalview.io.AnnotationFile; +import jalview.io.AppletFormatAdapter; +import jalview.io.FeaturesFile; import jalview.io.NewickFile; +import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.ws.AWsJob; import jalview.ws.JobStateSummary; import jalview.ws.WSClientI; + +import java.util.Hashtable; +import java.util.Vector; + import vamsas.objects.simple.MsaResult; import vamsas.objects.simple.SeqSearchResult; @@ -103,18 +115,17 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI for (int i = 0, n = 0; i < seqs.length; i++) { - String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same + String newname = SeqsetUtils.unique_name(i); // same // for // any // subjob - SeqNames.put(newname, - jalview.analysis.SeqsetUtils.SeqCharacterHash(seqs[i])); + SeqNames.put(newname, SeqsetUtils.SeqCharacterHash(seqs[i])); if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) { seqarray[n] = new vamsas.objects.simple.Sequence(); seqarray[n].setId(newname); seqarray[n++].setSeq((submitGaps) ? seqs[i].getSequenceAsString() - : AlignSeq.extractGaps(jalview.util.Comparison.GapChars, + : AlignSeq.extractGaps(Comparison.GapChars, seqs[i].getSequenceAsString())); } else @@ -123,7 +134,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI if (seqs[i].getEnd() >= seqs[i].getStart()) { empty = (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq - .extractGaps(jalview.util.Comparison.GapChars, + .extractGaps(Comparison.GapChars, seqs[i].getSequenceAsString()); } emptySeqs.add(new String[] @@ -186,7 +197,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI */ // construct annotated alignment as it would be done by the jalview // applet - jalview.datamodel.Alignment al = new Alignment(alseqs); + Alignment al = new Alignment(alseqs); // al.setDataset(dataset); // make dataset String inFile = null; @@ -195,8 +206,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI inFile = ((SeqSearchResult) result).getAnnotation(); if (inFile != null && inFile.length() > 0) { - new jalview.io.AnnotationFile().readAnnotationFile(al, inFile, - jalview.io.AppletFormatAdapter.PASTE); + new AnnotationFile().readAnnotationFile(al, inFile, + AppletFormatAdapter.PASTE); } } catch (Exception e) { @@ -211,8 +222,8 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI inFile = ((SeqSearchResult) result).getFeatures(); if (inFile != null && inFile.length() > 0) { - jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile( - inFile, jalview.io.AppletFormatAdapter.PASTE); + FeaturesFile ff = new FeaturesFile(inFile, + AppletFormatAdapter.PASTE); ff.parse(al, featureColours, false); } } catch (Exception e) @@ -222,14 +233,13 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI System.err.println(">>>EOF" + inFile + "\n<< 0) { - nf = new jalview.io.NewickFile(inFile, - jalview.io.AppletFormatAdapter.PASTE); + nf = new NewickFile(inFile, AppletFormatAdapter.PASTE); if (!nf.isValid()) { nf.close(); @@ -308,7 +318,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI * boolean */ SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl, - WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, + WebserviceInfo wsinfo, AlignFrame alFrame, AlignmentView alview, String wsname, String db) { super(alFrame, wsinfo, alview, wsname, wsUrl); @@ -331,7 +341,7 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI * Alignment */ SeqSearchWSThread(ext.vamsas.SeqSearchI server, String wsUrl, - WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, + WebserviceInfo wsinfo, AlignFrame alFrame, String wsname, String title, AlignmentView _msa, String db, Alignment seqset) { @@ -509,15 +519,15 @@ class SeqSearchWSThread extends JWS1Thread implements WSClientI } } - private jalview.datamodel.Sequence[] getVamsasAlignment( + private Sequence[] getVamsasAlignment( vamsas.objects.simple.Alignment valign) { vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs(); - jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.length]; + Sequence[] msa = new Sequence[seqs.length]; for (int i = 0, j = seqs.length; i < j; i++) { - msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), + msa[i] = new Sequence(seqs[i].getId(), seqs[i].getSeq()); } diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index dfb13a6..a3b7764 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -27,6 +27,7 @@ import jalview.datamodel.GraphLine; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.AlignmentPanel; import jalview.schemes.GraduatedColor; import jalview.schemes.UserColourScheme; import jalview.ws.jws2.jabaws2.Jws2Instance; @@ -368,7 +369,7 @@ public class AADisorderClient extends JabawsCalcWorker implements } // TODO: JAL-1150 - create sequence feature settings API for defining // styles and enabling/disabling feature overlay on alignment panel - ((jalview.gui.AlignmentPanel) ap).updateFeatureRendererFrom(fr); + ((AlignmentPanel) ap).updateFeatureRendererFrom(fr); if (af.alignPanel == ap) { // only do this if the alignFrame is currently showing this view. diff --git a/src/jalview/ws/jws2/AWS2Thread.java b/src/jalview/ws/jws2/AWS2Thread.java index dc5e475..825fcbd 100644 --- a/src/jalview/ws/jws2/AWS2Thread.java +++ b/src/jalview/ws/jws2/AWS2Thread.java @@ -23,8 +23,9 @@ package jalview.ws.jws2; import jalview.datamodel.AlignmentView; import jalview.gui.AlignFrame; import jalview.gui.WebserviceInfo; +import jalview.ws.AWSThread; -abstract public class AWS2Thread extends jalview.ws.AWSThread +abstract public class AWS2Thread extends AWSThread { public AWS2Thread(AlignFrame alFrame, WebserviceInfo wsinfo, diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java index a7cc5b6..9a1e2d3 100644 --- a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -4,12 +4,15 @@ import jalview.analysis.AlignSeq; import jalview.analysis.SeqsetUtils; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.AlignViewport; import jalview.gui.IProgressIndicator; +import jalview.util.Comparison; import jalview.workers.AlignCalcWorker; import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.dm.JabaWsParamSet; @@ -49,7 +52,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker { if (getCalcId() != null) { - ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor( + ((AlignViewport) alignViewport).setCalcIdSettingsFor( getCalcId(), new AAConSettings(true, service, this.preset, (arguments != null) ? JabaParamStore @@ -296,7 +299,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker } if (collectAnnotationResultsFor(rslt)) { - jalview.bin.Cache.log + Cache.log .debug("Updating result annotation from Job " + rslt + " at " + service.getUri()); updateResultAnnotation(true); @@ -440,7 +443,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker start = inputSeqs.getStartRes(); end = inputSeqs.getEndRes(); - for (SequenceI sq : ((List) inputSeqs.getSequences())) + for (SequenceI sq : (inputSeqs.getSequences())) { if (bySequence ? sq.findPosition(end + 1) - sq.findPosition(start + 1) > minlen - 1 : sq.getEnd() @@ -475,7 +478,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker else { seqs.add(seq = new compbio.data.sequence.FastaSequence(newname, - AlignSeq.extractGaps(jalview.util.Comparison.GapChars, + AlignSeq.extractGaps(Comparison.GapChars, sq.getSequenceAsString(start, end + 1)))); } if (seq.getSequence().length() > ln) diff --git a/src/jalview/ws/jws2/JPred301Client.java b/src/jalview/ws/jws2/JPred301Client.java index db70fa0..036f781 100644 --- a/src/jalview/ws/jws2/JPred301Client.java +++ b/src/jalview/ws/jws2/JPred301Client.java @@ -291,7 +291,7 @@ public class JPred301Client extends JabawsMsaInterfaceAlignCalcWorker { return new AlignAnalysisUIText( compbio.ws.client.Services.JpredWS.toString(), - jalview.ws.jws2.JPred301Client.class, CALC_ID, false, true, + JPred301Client.class, CALC_ID, false, true, true, "JPred Consensus", "When checked, JPred consensus is updated automatically.", "Change JPred Settings...", diff --git a/src/jalview/ws/jws2/JabaParamStore.java b/src/jalview/ws/jws2/JabaParamStore.java index baa1d9d..81069d6 100644 --- a/src/jalview/ws/jws2/JabaParamStore.java +++ b/src/jalview/ws/jws2/JabaParamStore.java @@ -20,6 +20,17 @@ */ package jalview.ws.jws2; +import jalview.util.MessageManager; +import jalview.util.QuickSort; +import jalview.ws.jws2.dm.JabaOption; +import jalview.ws.jws2.dm.JabaParameter; +import jalview.ws.jws2.dm.JabaWsParamSet; +import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; +import jalview.ws.params.ParamDatastoreI; +import jalview.ws.params.ParamManager; +import jalview.ws.params.WsParamSetI; + import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -34,16 +45,6 @@ import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; -import jalview.util.MessageManager; -import jalview.ws.jws2.dm.JabaOption; -import jalview.ws.jws2.dm.JabaParameter; -import jalview.ws.jws2.dm.JabaWsParamSet; -import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.params.ArgumentI; -import jalview.ws.params.ParamDatastoreI; -import jalview.ws.params.ParamManager; -import jalview.ws.params.WsParamSetI; - public class JabaParamStore implements ParamDatastoreI { @@ -180,7 +181,7 @@ public class JabaParamStore implements ParamDatastoreI } ArgumentI[] rgssort = rgs.toArray(new ArgumentI[rgs.size()]); String[] rgssorton = rgnames.toArray(new String[rgs.size()]); - jalview.util.QuickSort.sort(rgssorton, rgssort); + QuickSort.sort(rgssorton, rgssort); ArgumentI tmp1; int i = 0; while (rgssort.length - i > i) diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java index 696ddeb..ab23e12 100644 --- a/src/jalview/ws/jws2/Jws2Client.java +++ b/src/jalview/ws/jws2/Jws2Client.java @@ -28,6 +28,7 @@ import jalview.gui.JvSwingUtils; import jalview.gui.WebserviceInfo; import jalview.gui.WsJobParameters; import jalview.util.MessageManager; +import jalview.ws.WSClient; import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.dm.JabaWsParamSet; import jalview.ws.jws2.jabaws2.Jws2Instance; @@ -52,7 +53,7 @@ import compbio.metadata.Argument; * @author JimP * */ -public abstract class Jws2Client extends jalview.ws.WSClient +public abstract class Jws2Client extends WSClient { protected AlignFrame alignFrame; diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index 938a760..4dee913 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -25,6 +25,7 @@ import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.JvSwingUtils; import jalview.util.MessageManager; +import jalview.util.QuickSort; import jalview.ws.WSMenuEntryProviderI; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.ParamDatastoreI; @@ -277,7 +278,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI spos[ipos++] = 1000 * svcUrls.indexOf(svc.getHost()) + 1 + svctypes.indexOf(svc.serviceType); } - jalview.util.QuickSort.sortInt(spos, svcs); + QuickSort.sortInt(spos, svcs); services = new Vector(); for (Jws2Instance svc : svcs) { @@ -506,7 +507,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI { sortbytype[i] = orderedsvcs[i].serviceType; } - jalview.util.QuickSort.sort(sortbytype, orderedsvcs); + QuickSort.sort(sortbytype, orderedsvcs); for (final Jws2Instance service : orderedsvcs) { atpoint = JvSwingUtils.findOrCreateMenu(jws2al, service.action); diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index 5fe3e74..284f275 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -57,7 +57,8 @@ public class MsaWSClient extends Jws2Client MsaWS server; public MsaWSClient(Jws2Instance sh, String altitle, - jalview.datamodel.AlignmentView msa, boolean submitGaps, + AlignmentView msa, + boolean submitGaps, boolean preserveOrder, Alignment seqdataset, AlignFrame _alignFrame) { @@ -67,7 +68,7 @@ public class MsaWSClient extends Jws2Client } public MsaWSClient(Jws2Instance sh, WsParamSetI preset, String altitle, - jalview.datamodel.AlignmentView msa, boolean submitGaps, + AlignmentView msa, boolean submitGaps, boolean preserveOrder, Alignment seqdataset, AlignFrame _alignFrame) { @@ -94,7 +95,7 @@ public class MsaWSClient extends Jws2Client public MsaWSClient(Jws2Instance sh, WsParamSetI preset, List arguments, boolean editParams, String altitle, - jalview.datamodel.AlignmentView msa, boolean submitGaps, + AlignmentView msa, boolean submitGaps, boolean preserveOrder, Alignment seqdataset, AlignFrame _alignFrame) { diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index d2c1b38..0ba4b11 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -21,6 +21,8 @@ package jalview.ws.jws2; import jalview.analysis.AlignSeq; +import jalview.analysis.AlignmentSorter; +import jalview.analysis.SeqsetUtils; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; @@ -33,6 +35,7 @@ import jalview.gui.AlignFrame; import jalview.gui.Desktop; import jalview.gui.SplitFrame; import jalview.gui.WebserviceInfo; +import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.ws.AWsJob; import jalview.ws.JobStateSummary; @@ -139,19 +142,18 @@ class MsaWSThread extends AWS2Thread implements WSClientI for (int i = 0, n = 0; i < seqs.length; i++) { - String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same + String newname = SeqsetUtils.unique_name(i); // same // for // any // subjob - SeqNames.put(newname, - jalview.analysis.SeqsetUtils.SeqCharacterHash(seqs[i])); + SeqNames.put(newname, SeqsetUtils.SeqCharacterHash(seqs[i])); if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) { // make new input sequence with or without gaps seq = new compbio.data.sequence.FastaSequence(newname, (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, + Comparison.GapChars, seqs[i].getSequenceAsString())); this.seqs.add(seq); } @@ -161,7 +163,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI if (seqs[i].getEnd() >= seqs[i].getStart()) { empty = (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq - .extractGaps(jalview.util.Comparison.GapChars, + .extractGaps(Comparison.GapChars, seqs[i].getSequenceAsString()); } emptySeqs.add(new String[] @@ -293,9 +295,9 @@ class MsaWSThread extends AWS2Thread implements WSClientI } AlignmentOrder msaorder = new AlignmentOrder(alseqs); // always recover the order - makes parseResult()'s life easier. - jalview.analysis.AlignmentSorter.recoverOrder(alseqs); + AlignmentSorter.recoverOrder(alseqs); // account for any missing sequences - jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); + SeqsetUtils.deuniquify(SeqNames, alseqs); return new Object[] { alseqs, msaorder }; } @@ -452,7 +454,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI * boolean */ private MsaWSThread(MsaWS server, String wsUrl, WebserviceInfo wsinfo, - jalview.gui.AlignFrame alFrame, AlignmentView alview, + AlignFrame alFrame, AlignmentView alview, String wsname, boolean subgaps, boolean presorder) { super(alFrame, wsinfo, alview, wsname, wsUrl); @@ -477,7 +479,8 @@ class MsaWSThread extends AWS2Thread implements WSClientI */ MsaWSThread(MsaWS server2, WsParamSetI preset, List paramset, String wsUrl, WebserviceInfo wsinfo, - jalview.gui.AlignFrame alFrame, String wsname, String title, + AlignFrame alFrame, + String wsname, String title, AlignmentView _msa, boolean subgaps, boolean presorder, Alignment seqset) { diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index 55ade66..bca8343 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -24,7 +24,6 @@ import jalview.api.AlignCalcWorkerI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.gui.AlignFrame; -import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.WsParamSetI; import jalview.ws.uimodel.AlignAnalysisUIText; @@ -36,12 +35,13 @@ import java.util.List; import java.util.TreeSet; import java.util.regex.Pattern; -import compbio.data.sequence.RNAStructReader.AlifoldResult; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.RNAStructReader.AlifoldResult; import compbio.data.sequence.RNAStructScoreManager; import compbio.data.sequence.Range; import compbio.data.sequence.Score; import compbio.metadata.Argument; +import compbio.ws.client.Services; /** * Client for the JABA RNA Alifold Service @@ -85,8 +85,8 @@ public class RNAalifoldClient extends JabawsCalcWorker implements public static AlignAnalysisUIText getAlignAnalysisUITest() { return new AlignAnalysisUIText( - compbio.ws.client.Services.RNAalifoldWS.toString(), - jalview.ws.jws2.RNAalifoldClient.class, + Services.RNAalifoldWS.toString(), + RNAalifoldClient.class, CALC_ID, true, false, @@ -185,11 +185,15 @@ public class RNAalifoldClient extends JabawsCalcWorker implements * same data object as was overwritten with the contact probabilites data. */ if (data == null) + { data = compbio.data.sequence.RNAStructReader .newEmptyScore(AlifoldResult.consensusAlignment); + } if (descriptionData == null) + { descriptionData = data; + } String[] typenameAndDescription = constructTypenameAndDescription(descriptionData .first()); @@ -269,7 +273,9 @@ public class RNAalifoldClient extends JabawsCalcWorker implements { float t = contacts.get(contact); if (t > prob) + { prob = t; + } description += Integer.toString(contact.from) + "->" + Integer.toString(contact.to) + ": " + Float.toString(t) + "% | "; @@ -349,7 +355,9 @@ public class RNAalifoldClient extends JabawsCalcWorker implements score.getScores().get(0), score.getScores().get(1)); } else + { description = "Stochastic Backtrack Structure"; + } } else if (datatype.equals(AlifoldResult.MEAStucture.toString())) { @@ -386,7 +394,9 @@ public class RNAalifoldClient extends JabawsCalcWorker implements // ordering of the Scores TreeSet in ScoreManager which is, descending // probability if (contact.from == i || contact.to == i) + { contacts.put(contact, basePairs.get(contact)); + } } return contacts; diff --git a/src/jalview/ws/jws2/dm/AAConSettings.java b/src/jalview/ws/jws2/dm/AAConSettings.java index ea04709..fea277c 100644 --- a/src/jalview/ws/jws2/dm/AAConSettings.java +++ b/src/jalview/ws/jws2/dm/AAConSettings.java @@ -20,27 +20,28 @@ */ package jalview.ws.jws2.dm; -import java.util.ArrayList; -import java.util.List; - -import compbio.metadata.Argument; -import compbio.metadata.Option; - import jalview.util.MessageManager; import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.JabaPreset; import jalview.ws.jws2.ParameterUtils; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.ArgumentI; +import jalview.ws.params.AutoCalcSetting; import jalview.ws.params.WsParamSetI; +import java.util.ArrayList; +import java.util.List; + +import compbio.metadata.Argument; +import compbio.metadata.Option; + /** * preferences for running AACon service * * @author jprocter TODO: refactor to a generic 'last job and service run' * container ? */ -public class AAConSettings extends jalview.ws.params.AutoCalcSetting +public class AAConSettings extends AutoCalcSetting { Jws2Instance service; diff --git a/src/jalview/ws/jws2/dm/JabaOption.java b/src/jalview/ws/jws2/dm/JabaOption.java index 69d6170..e0438a4 100644 --- a/src/jalview/ws/jws2/dm/JabaOption.java +++ b/src/jalview/ws/jws2/dm/JabaOption.java @@ -30,7 +30,7 @@ import java.util.List; import compbio.metadata.Option; -public class JabaOption implements jalview.ws.params.OptionI +public class JabaOption implements OptionI { public JabaOption(Option rg) { diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java index 56ea244..ec45846 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java @@ -27,6 +27,7 @@ import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.MsaWSClient; import jalview.ws.jws2.SequenceAnnotationWSClient; import jalview.ws.params.ParamDatastoreI; +import jalview.ws.uimodel.AlignAnalysisUIText; import java.io.Closeable; @@ -241,9 +242,9 @@ public class Jws2Instance return "java:" + serviceType; } - jalview.ws.uimodel.AlignAnalysisUIText aaui; + AlignAnalysisUIText aaui; - public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI() + public AlignAnalysisUIText getAlignAnalysisUI() { return aaui; } diff --git a/src/jalview/ws/rest/HttpResultSet.java b/src/jalview/ws/rest/HttpResultSet.java index e4360c4..2ee4243 100644 --- a/src/jalview/ws/rest/HttpResultSet.java +++ b/src/jalview/ws/rest/HttpResultSet.java @@ -23,9 +23,10 @@ package jalview.ws.rest; import jalview.bin.Cache; import jalview.io.FileParse; import jalview.io.packed.DataProvider; +import jalview.io.packed.DataProvider.JvDataType; +import jalview.io.packed.JalviewDataset; import jalview.io.packed.ParsePackedSet; import jalview.io.packed.SimpleDataProvider; -import jalview.io.packed.DataProvider.JvDataType; import jalview.util.MessageManager; import jalview.ws.io.mime.JalviewMimeContentHandler; @@ -113,7 +114,7 @@ public class HttpResultSet extends FileParse { throw new Error(MessageManager.getString("error.implementation_error_need_to_have_httpresponse")); } - jalview.io.packed.JalviewDataset ds = restJob.newJalviewDataset(); + JalviewDataset ds = restJob.newJalviewDataset(); // Decide how we deal with content. if (en instanceof MultipartEntity) { diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java index f9b72e3..9032823 100644 --- a/src/jalview/ws/rest/RestClient.java +++ b/src/jalview/ws/rest/RestClient.java @@ -20,17 +20,6 @@ */ package jalview.ws.rest; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Hashtable; -import java.util.Vector; - -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.event.MenuEvent; -import javax.swing.event.MenuListener; - import jalview.bin.Cache; import jalview.datamodel.AlignmentView; import jalview.gui.AlignFrame; @@ -39,10 +28,25 @@ import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; import jalview.gui.WebserviceInfo; import jalview.io.packed.DataProvider.JvDataType; +import jalview.io.packed.JalviewDataset; import jalview.util.MessageManager; import jalview.ws.WSClient; import jalview.ws.WSClientI; import jalview.ws.WSMenuEntryProviderI; +import jalview.ws.rest.params.Alignment; +import jalview.ws.rest.params.JobConstant; +import jalview.ws.rest.params.SeqGroupIndexVector; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Hashtable; +import java.util.Vector; + +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.event.MenuEvent; +import javax.swing.event.MenuListener; /** * @author JimP @@ -75,7 +79,7 @@ public class RestClient extends WSClient implements WSClientI, */ protected AlignFrame recoverAlignFrameForView() { - return jalview.gui.Desktop.getAlignFrameFor(av); + return Desktop.getAlignFrameFor(av); } public RestClient(RestServiceDescription service2, AlignFrame alignFrame) @@ -224,7 +228,7 @@ public class RestClient extends WSClient implements WSClientI, /** * input data context */ - jalview.io.packed.JalviewDataset jds; + JalviewDataset jds; /** * informative name for results @@ -316,7 +320,7 @@ public class RestClient extends WSClient implements WSClientI, { String action = "Analysis", description = "Sequence Harmony and Multi-Relief (Brandt et al. 2010)", name = MessageManager.getString("label.multiharmony"); Hashtable iparams = new Hashtable(); - jalview.ws.rest.params.JobConstant toolp; + JobConstant toolp; // toolp = new jalview.ws.rest.JobConstant("tool","jalview"); // iparams.put(toolp.token, toolp); // toolp = new jalview.ws.rest.params.JobConstant("mbjob[method]","shmr"); @@ -329,13 +333,13 @@ public class RestClient extends WSClient implements WSClientI, // toolp = new jalview.ws.rest.params.JobConstant("blast","0"); // iparams.put(toolp.token, toolp); - jalview.ws.rest.params.Alignment aliinput = new jalview.ws.rest.params.Alignment(); + Alignment aliinput = new Alignment(); // SHMR server has a 65K limit for content pasted into the 'ali' parameter, // so we always upload our files. aliinput.token = "ali_file"; aliinput.writeAsFile = true; iparams.put(aliinput.token, aliinput); - jalview.ws.rest.params.SeqGroupIndexVector sgroups = new jalview.ws.rest.params.SeqGroupIndexVector(); + SeqGroupIndexVector sgroups = new SeqGroupIndexVector(); sgroups.setMinsize(2); sgroups.min = 2;// need at least two group defined to make a partition iparams.put("groups", sgroups); @@ -384,7 +388,7 @@ public class RestClient extends WSClient implements WSClientI, try { for (RestServiceDescription descr : RestServiceDescription - .parseDescriptions(jalview.bin.Cache.getDefault( + .parseDescriptions(Cache.getDefault( RSBS_SERVICES, makeShmmrRestClient().service.toString()))) { diff --git a/src/jalview/ws/rest/RestJob.java b/src/jalview/ws/rest/RestJob.java index 64d75e8..b1c8c33 100644 --- a/src/jalview/ws/rest/RestJob.java +++ b/src/jalview/ws/rest/RestJob.java @@ -20,13 +20,7 @@ */ package jalview.ws.rest; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Hashtable; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - +import jalview.analysis.SeqsetUtils; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentOrder; @@ -37,6 +31,13 @@ import jalview.ws.AWsJob; import jalview.ws.rest.params.Alignment; import jalview.ws.rest.params.SeqGroupIndexVector; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + public class RestJob extends AWsJob { @@ -90,8 +91,7 @@ public class RestJob extends AWsJob // get sequences for the alignmentI // get groups trimmed to alignment columns // get any annotation trimmed to start/end columns, too. - squniq = jalview.analysis.SeqsetUtils.uniquify( - _input.getSequencesArray(), true); + squniq = SeqsetUtils.uniquify(_input.getSequencesArray(), true); // prepare input // form alignment+groups+annotation,preprocess and then record references // for formatters diff --git a/src/jalview/ws/rest/RestJobThread.java b/src/jalview/ws/rest/RestJobThread.java index ee971f5..42f6922 100644 --- a/src/jalview/ws/rest/RestJobThread.java +++ b/src/jalview/ws/rest/RestJobThread.java @@ -30,6 +30,7 @@ import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; import jalview.gui.PaintRefresher; import jalview.gui.WebserviceInfo; @@ -174,9 +175,13 @@ public class RestJobThread extends AWSThread private String getStage(Stage stg) { if (stg == Stage.SUBMIT) + { return "submitting "; + } if (stg == Stage.POLL) + { return "checking status of "; + } return (" being confused about "); } @@ -585,7 +590,7 @@ public class RestJobThread extends AWSThread /** * alignment panels derived from each alignment set returned by service. */ - ArrayList destPanels = new ArrayList(); + ArrayList destPanels = new ArrayList(); /** * list of instructions for how to process each distinct alignment set * returned by the job set @@ -610,7 +615,7 @@ public class RestJobThread extends AWSThread // total number of distinct alignment sets generated by job set. int numAlSets = 0, als = 0; List destAls = new ArrayList(); - List destColsel = new ArrayList(); + List destColsel = new ArrayList(); List> trees = new ArrayList>(); do @@ -716,7 +721,7 @@ public class RestJobThread extends AWSThread RestJob rj = (RestJob) jobs[nrj]; int contigs[] = input.getVisibleContigs(); AlignmentI destAl = null; - jalview.datamodel.ColumnSelection destCs = null; + ColumnSelection destCs = null; // Resolve destAl for this data. if (als == 0 && rj.isInputContextModified()) { @@ -1035,8 +1040,7 @@ public class RestJobThread extends AWSThread /** * current pane being worked with */ - jalview.gui.AlignmentPanel destPanel = restClient - .recoverAlignPanelForView(); + AlignmentPanel destPanel = restClient.recoverAlignPanelForView(); als = 0; for (AddDataTo action : resultDest) { diff --git a/src/jalview/ws/rest/RestServiceDescription.java b/src/jalview/ws/rest/RestServiceDescription.java index e7c861f..896a230 100644 --- a/src/jalview/ws/rest/RestServiceDescription.java +++ b/src/jalview/ws/rest/RestServiceDescription.java @@ -20,6 +20,16 @@ */ package jalview.ws.rest; +import jalview.datamodel.SequenceI; +import jalview.io.packed.DataProvider.JvDataType; +import jalview.util.StringUtils; +import jalview.ws.rest.params.Alignment; +import jalview.ws.rest.params.AnnotationFile; +import jalview.ws.rest.params.SeqGroupIndexVector; +import jalview.ws.rest.params.SeqIdVector; +import jalview.ws.rest.params.SeqVector; +import jalview.ws.rest.params.Tree; + import java.net.URL; import java.util.ArrayList; import java.util.HashMap; @@ -31,13 +41,6 @@ import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; -import jalview.datamodel.SequenceI; -import jalview.io.packed.DataProvider.JvDataType; -import jalview.util.StringUtils; -import jalview.ws.rest.params.Alignment; -import jalview.ws.rest.params.AnnotationFile; -import jalview.ws.rest.params.SeqGroupIndexVector; - public class RestServiceDescription { private static final Pattern PARAM_ENCODED_URL_PATTERN = Pattern.compile("([?&])([A-Za-z0-9_]+)=\\$([^$]+)\\$"); @@ -705,12 +708,9 @@ public class RestServiceDescription { // TODO - find a better way of maintaining this classlist return new Class[] - { jalview.ws.rest.params.Alignment.class, - jalview.ws.rest.params.AnnotationFile.class, + { Alignment.class, AnnotationFile.class, SeqGroupIndexVector.class, - jalview.ws.rest.params.SeqIdVector.class, - jalview.ws.rest.params.SeqVector.class, - jalview.ws.rest.params.Tree.class }; + SeqIdVector.class, SeqVector.class, Tree.class }; } public static boolean parseTypeString(String fullstring, String tok, diff --git a/src/jalview/ws/rest/params/Alignment.java b/src/jalview/ws/rest/params/Alignment.java index 28f2628..626005a 100644 --- a/src/jalview/ws/rest/params/Alignment.java +++ b/src/jalview/ws/rest/params/Alignment.java @@ -21,6 +21,7 @@ package jalview.ws.rest.params; import jalview.datamodel.AlignmentI; +import jalview.io.FormatAdapter; import jalview.ws.params.OptionI; import jalview.ws.params.simple.BooleanOption; import jalview.ws.params.simple.Option; @@ -80,7 +81,7 @@ public class Alignment extends InputType PrintWriter pw = new PrintWriter( new OutputStreamWriter(new BufferedOutputStream( new FileOutputStream(fa)), "UTF-8")); - pw.append(new jalview.io.FormatAdapter().formatSequences(format, + pw.append(new FormatAdapter().formatSequences(format, alignment, jvsuffix)); pw.close(); return new FileBody(fa, "text/plain"); @@ -92,7 +93,7 @@ public class Alignment extends InputType } else { - jalview.io.FormatAdapter fa = new jalview.io.FormatAdapter(); + FormatAdapter fa = new FormatAdapter(); fa.setNewlineString("\r\n"); return new StringBody( (fa.formatSequences(format, alignment, jvsuffix))); @@ -148,7 +149,7 @@ public class Alignment extends InputType if (tok.startsWith("format")) { - for (String fmt : jalview.io.FormatAdapter.WRITEABLE_FORMATS) + for (String fmt : FormatAdapter.WRITEABLE_FORMATS) { if (val.equalsIgnoreCase(fmt)) { @@ -158,7 +159,7 @@ public class Alignment extends InputType } warnings.append("Invalid alignment format '" + val + "'. Must be one of ("); - for (String fmt : jalview.io.FormatAdapter.WRITEABLE_FORMATS) + for (String fmt : FormatAdapter.WRITEABLE_FORMATS) { warnings.append(" " + fmt); } @@ -197,7 +198,7 @@ public class Alignment extends InputType lst.add(new Option("format", "Alignment upload format", true, "FASTA", format, Arrays - .asList(jalview.io.FormatAdapter.WRITEABLE_FORMATS), + .asList(FormatAdapter.WRITEABLE_FORMATS), null)); lst.add(createMolTypeOption("type", "Sequence type", false, type, null)); diff --git a/src/jalview/ws/rest/params/SeqGroupIndexVector.java b/src/jalview/ws/rest/params/SeqGroupIndexVector.java index 5c25b47..c5b64d7 100644 --- a/src/jalview/ws/rest/params/SeqGroupIndexVector.java +++ b/src/jalview/ws/rest/params/SeqGroupIndexVector.java @@ -20,10 +20,12 @@ */ package jalview.ws.rest.params; +import jalview.analysis.AlignmentSorter; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.util.MessageManager; +import jalview.util.QuickSort; import jalview.ws.params.OptionI; import jalview.ws.params.simple.IntegerParameter; import jalview.ws.params.simple.Option; @@ -78,7 +80,7 @@ public class SeqGroupIndexVector extends InputType implements */ public AlignmentI prepareAlignment(AlignmentI al) { - jalview.analysis.AlignmentSorter.sortByGroup(al); + AlignmentSorter.sortByGroup(al); return al; } @@ -124,9 +126,13 @@ public class SeqGroupIndexVector extends InputType implements else { if (p < se[0]) + { se[0] = p; + } if (p > se[1]) + { se[1] = p; + } } } if (se != null) @@ -170,8 +176,10 @@ public class SeqGroupIndexVector extends InputType implements int[][] vals = gl.toArray(new int[gl.size()][]); int[] srt = new int[gl.size()]; for (int i = 0; i < vals.length; i++) + { srt[i] = vals[i][0]; - jalview.util.QuickSort.sortInt(srt, vals); + } + QuickSort.sortInt(srt, vals); list = false; int last = vals[0][0] - 1; for (int[] range : vals) @@ -245,7 +253,9 @@ public class SeqGroupIndexVector extends InputType implements { minsize = Integer.valueOf(val); if (minsize >= 0) + { return true; + } } catch (Exception x) { diff --git a/src/jalview/ws/rest/params/Tree.java b/src/jalview/ws/rest/params/Tree.java index d963cb2..e33b664 100644 --- a/src/jalview/ws/rest/params/Tree.java +++ b/src/jalview/ws/rest/params/Tree.java @@ -20,6 +20,7 @@ */ package jalview.ws.rest.params; +import jalview.analysis.NJTree; import jalview.util.MessageManager; import jalview.ws.params.OptionI; import jalview.ws.rest.InputType; @@ -42,7 +43,7 @@ public class Tree extends InputType public Tree() { super(new Class[] - { jalview.analysis.NJTree.class }); + { NJTree.class }); } // TODO specify modifiers for tree output format diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index a8a3904..c28d8e2 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -20,6 +20,14 @@ */ package jalview.ws.seqfetcher; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.SequenceI; +import jalview.util.DBRefUtils; +import jalview.util.MessageManager; +import jalview.util.QuickSort; + import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; @@ -30,12 +38,6 @@ import java.util.Map; import java.util.Stack; import java.util.Vector; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.SequenceI; -import jalview.util.DBRefUtils; -import jalview.util.MessageManager; - public class ASequenceFetcher { @@ -83,12 +85,12 @@ public class ASequenceFetcher return true; } } - jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source + Cache.log.warn("isFetchable doesn't know about '" + source + "'"); return false; } - public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs) + public SequenceI[] getSequences(DBRefEntry[] refs) { SequenceI[] ret = null; Vector rseqs = new Vector(); @@ -288,7 +290,7 @@ public class ASequenceFetcher { nm[i++] = "" + s.getTier() + s.getDbName().toLowerCase(); } - jalview.util.QuickSort.sort(nm, l); + QuickSort.sort(nm, l); dbs = new ArrayList(); for (i = l.length - 1; i >= 0; i--) { @@ -391,7 +393,7 @@ public class ASequenceFetcher */ public String[] getDbInstances(Class class1) { - if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1)) + if (!DbSourceProxy.class.isAssignableFrom(class1)) { throw new Error(MessageManager.formatMessage("error.implementation_error_dbinstance_must_implement_interface", new String[]{class1.toString()})); }