X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fclient%2FServices.java;h=42d282eb372f4720dabd5354bec4836d28712c42;hb=b2a2fdc2bd95a64b3908d8ea2f31270b6c7199d3;hp=01b48278f015baac4cbeada9158d2e2367ea235c;hpb=a2619dbd95b874abd03ae551c02524fe09e9f631;p=jabaws.git diff --git a/webservices/compbio/ws/client/Services.java b/webservices/compbio/ws/client/Services.java index 01b4827..42d282e 100644 --- a/webservices/compbio/ws/client/Services.java +++ b/webservices/compbio/ws/client/Services.java @@ -1,6 +1,6 @@ -/* Copyright (c) 2009 Peter Troshin +/* Copyright (c) 2011 Peter Troshin * - * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 + * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 * * This library is free software; you can redistribute it and/or modify it under the terms of the * Apache License version 2 as published by the Apache Software Foundation @@ -18,33 +18,28 @@ package compbio.ws.client; -import java.io.File; import java.net.URL; +import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.namespace.QName; import javax.xml.ws.Service; import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.msa.SequenceAnnotation; -import compbio.engine.client.ConfExecutable; -import compbio.engine.client.Executable; -import compbio.runner.conservation.AACon; -import compbio.runner.disorder.Disembl; -import compbio.runner.disorder.GlobPlot; -import compbio.runner.disorder.Jronn; -import compbio.runner.msa.ClustalW; -import compbio.runner.msa.Mafft; -import compbio.runner.msa.Muscle; -import compbio.runner.msa.Probcons; -import compbio.runner.msa.Tcoffee; /** * List of web services currently supported by JABAWS version 2 * */ public enum Services { - MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS; + /* + * Make sure this class has NO references to runners or engines as it is a + * part of minimal client package. Such things should go into ServicesUtil + */ + MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS, JpredWS, RNAalifoldWS; public static Services getService(String servName) { servName = servName.trim().toLowerCase(); @@ -56,111 +51,321 @@ public enum Services { return null; } - public static Services getServiceByRunner( - Class> runnerClassName) { - assert runnerClassName != null; - String sname = runnerClassName.getSimpleName().toLowerCase(); - for (Services service : Services.values()) { - if (service.toString().toLowerCase().contains(sname)) { - return service; + Service getService(URL url, String sqname) { + QName qname = new QName(sqname, this.toString()); + return Service.create(url, qname); + } + + public static String toString(Set services) { + if (services == null || services.isEmpty()) { + return "No known services...\n"; + } + String value = ""; + for (Services serv : services) { + if (null != serv) { + value += serv + "\n"; + } else { + value += "Unknown Service\n"; } } - return null; + return value; } - public Class> getServiceImpl() { + Class getServiceType() { switch (this) { case AAConWS : - return AACon.class; + case JronnWS : + case DisemblWS : + case GlobPlotWS : + case IUPredWS : + case RNAalifoldWS : + return SequenceAnnotation.class; + case JpredWS : case ClustalWS : - return ClustalW.class; + case ClustalOWS : case MafftWS : - return Mafft.class; case MuscleWS : - return Muscle.class; - case TcoffeeWS : - return Tcoffee.class; case ProbconsWS : - return Probcons.class; - case DisemblWS : - return Disembl.class; - case GlobPlotWS : - return GlobPlot.class; - case JronnWS : - return Jronn.class; + case TcoffeeWS : + return MsaWS.class; + default : - throw new RuntimeException( - "Unknown web service implementation class for service: " - + this); + throw new RuntimeException("Unrecognised Web Service Type " + this + " - Should never happen!"); } } - public static Class> getRunnerByJobDirectory( - File jobdir) { - Services service = getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir)); - return service.getServiceImpl(); - } - - private static String getRunnerNameByJobDirectory(File jobdir) { - String name = jobdir.getName().split("#")[0]; - - if (name.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX)) { - assert ConfExecutable.CLUSTER_TASK_ID_PREFIX.length() == 1; - name = name.substring(1); + + String getServiceNamespace() { + switch (this) { + case RNAalifoldWS : + case AAConWS : + case JronnWS : + case DisemblWS : + case GlobPlotWS : + case IUPredWS : + return JABAService.V2_SERVICE_NAMESPACE; + case ClustalOWS : + case JpredWS : + case ClustalWS : + case MafftWS : + case MuscleWS : + case ProbconsWS : + case TcoffeeWS : + return JABAService.SERVICE_NAMESPACE; + default : + throw new RuntimeException("Unrecognised JABAWS Namespace for service " + this +"!"); } - return name; } + + JABAService getInterface(Service service) { + assert service != null; - public static Services getServiceByJobDirectory(File jobdir) { - return getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir)); + QName portName = new QName(service.getServiceName().getNamespaceURI(), this.toString() + "Port"); + return service.getPort(portName, this.getServiceType()); } - private static Services getServiceByRunnerName(String name) { - for (Services service : Services.values()) { - String runnerName = service.getServiceImpl().getSimpleName() - .toLowerCase(); - name = name.trim().toLowerCase(); - if (name.startsWith(runnerName)) { - return service; - } + public String getServiceInfo() { + switch (this) { + case AAConWS : + return AACON_INFO.toString(); + case JpredWS : + return JPRED_INFO.toString(); + case ClustalOWS : + return CLUSTAL_OMEGA_INFO.toString(); + case ClustalWS : + return CLUSTAL_INFO.toString(); + case DisemblWS : + return DISEMBL_INFO.toString(); + case GlobPlotWS : + return GLOBPLOT_INFO.toString(); + case IUPredWS : + return IUPRED_INFO.toString(); + case JronnWS : + return JRONN_INFO.toString(); + case MafftWS : + return MAFFT_INFO.toString(); + case MuscleWS : + return MUSCLE_INFO.toString(); + case ProbconsWS : + return PROBCONS_INFO.toString(); + case TcoffeeWS : + return TCOFFEE_INFO.toString(); + case RNAalifoldWS : + return RNAALIFOLD_INFO.toString(); + default : + throw new RuntimeException("Unrecognised Web Service Type " + this + " - Should never happen!"); } - return null; } - Service getService(URL url, String sqname) { - QName qname = new QName(sqname, this.toString()); - return Service.create(url, qname); + public String getServiceReference() { + switch (this) { + case AAConWS : + return AACON_INFO.getReference(); + case JpredWS : + return JPRED_INFO.getReference(); + case ClustalOWS : + return CLUSTAL_OMEGA_INFO.getReference(); + case ClustalWS : + return CLUSTAL_INFO.getReference(); + case DisemblWS : + return DISEMBL_INFO.getReference(); + case GlobPlotWS : + return GLOBPLOT_INFO.getReference(); + case IUPredWS : + return IUPRED_INFO.getReference(); + case JronnWS : + return JRONN_INFO.getReference(); + case MafftWS : + return MAFFT_INFO.getReference(); + case MuscleWS : + return MUSCLE_INFO.getReference(); + case ProbconsWS : + return PROBCONS_INFO.getReference(); + case TcoffeeWS : + return TCOFFEE_INFO.getReference(); + case RNAalifoldWS : + return RNAALIFOLD_INFO.getReference(); + default : + throw new RuntimeException("Unrecognised Web Service Type " + this + " - Should never happen!"); + } } - Class getServiceType() { + public String getServiceVersion() { switch (this) { - // deliberate leaking case AAConWS : - case JronnWS : + return AACON_INFO.getVersion(); + case JpredWS : + return JPRED_INFO.getVersion(); + case ClustalOWS : + return CLUSTAL_OMEGA_INFO.getVersion(); + case ClustalWS : + return CLUSTAL_INFO.getVersion(); case DisemblWS : + return DISEMBL_INFO.getVersion(); case GlobPlotWS : + return GLOBPLOT_INFO.getVersion(); + case IUPredWS : + return IUPRED_INFO.getVersion(); + case JronnWS : + return JRONN_INFO.getVersion(); + case MafftWS : + return MAFFT_INFO.getVersion(); + case MuscleWS : + return MUSCLE_INFO.getVersion(); + case ProbconsWS : + return PROBCONS_INFO.getVersion(); + case TcoffeeWS : + return TCOFFEE_INFO.getVersion(); + case RNAalifoldWS : + return RNAALIFOLD_INFO.getVersion(); + default : + throw new RuntimeException("Unrecognised Web Service Type " + this + " - Should never happen!"); + } + } - return SequenceAnnotation.class; - - // deliberate leaking + public String getServiceGroup() { + switch (this) { + case AAConWS : + return "annotation"; + case JpredWS : + return "annotation"; + case ClustalOWS : + return "alignment"; case ClustalWS : + return "alignment"; + case DisemblWS : + return "disorder"; + case GlobPlotWS : + return "disorder"; + case IUPredWS : + return "disorder"; + case JronnWS : + return "disorder"; case MafftWS : + return "alignment"; case MuscleWS : + return "alignment"; case ProbconsWS : + return "alignment"; case TcoffeeWS : - - return MsaWS.class; + return "alignment"; + case RNAalifoldWS : + return "annotation"; default : - throw new RuntimeException("Unrecognised Web Service Type " - + this + " - Should never happened!"); + throw new RuntimeException("Unrecognised Web Service Type " + this + " - Should never happen!"); } } + + static ServiceInfo AACON_INFO = new ServiceInfo(AAConWS, + "in preparation", "1.0", "http://www.compbio.dundee.ac.uk/aacon"); - JABAService getInterface(Service service) { - assert service != null; + static ServiceInfo JPRED_INFO = new ServiceInfo(JpredWS, + "Cole C, Barber JD, Barton GJ.reparation" + + "The Jpred 3 secondary structure prediction server\n" + + "Nucl. Acids Res. (2008) 36 (suppl 2): W197-W201., doi: 10.1093/nar/gkn238", + "3.0.3", "http://www.compbio.dundee.ac.uk/www-jpred"); + + static ServiceInfo CLUSTAL_INFO = new ServiceInfo(ClustalWS, + "Larkin MA, Blackshields G, Brown NP, Chenna R, McGettigan PA, McWilliam H, Valentin F, " + + "Wallace IM, Wilm A, Lopez R, Thompson JD, Gibson TJ, Higgins DG.\n" + + "(2007). Clustal W and Clustal X version 2.0. Bioinformatics, 23, 2947-2948.", + "2.0.12", "http://www.clustal.org/clustal2/"); - QName portName = new QName(service.getServiceName().getNamespaceURI(), - this.toString() + "Port"); - return service.getPort(portName, this.getServiceType()); + static ServiceInfo CLUSTAL_OMEGA_INFO = new ServiceInfo(ClustalOWS, + "Fast, scalable generation of high quality protein multiple sequence alignments using Clustal Omega\r\n" + + "Fabian Sievers, Andreas Wilm, David Dineen, Toby J. Gibson, Kevin Karplus, Weizhong Li, Rodrigo Lopez, Hamish McWilliam, Michael Remmert, Johannes Söding, Julie D. Thompson, Desmond G. Higgins", + "1.0.2", "http://www.clustal.org/omega"); + + static ServiceInfo DISEMBL_INFO = new ServiceInfo(DisemblWS, + "R. Linding, L.J. Jensen, F. Diella, P. Bork, T.J. Gibson and R.B. Russell\r\n" + + "Protein disorder prediction: implications for structural proteomics\r\n" + + "Structure Vol 11, Issue 11, 4 November 2003", "1.5", + "http://dis.embl.de/"); + + static ServiceInfo GLOBPLOT_INFO = new ServiceInfo(GlobPlotWS, + "Rune Linding, Robert B. Russell, Victor Neduva and Toby J. Gibson " + + "'GlobPlot: exploring protein sequences for globularity and disorder.' " + + "Nucl. Acids Res. (2003) 31 (13): 3701-3708. doi: 10.1093/nar/gkg519\r\n", + "2.3", "http://globplot.embl.de/"); + + static ServiceInfo IUPRED_INFO = new ServiceInfo(IUPredWS, + "The Pairwise Energy Content Estimated from Amino Acid Composition Discriminates between Folded and Intrinsically Unstructured Proteins\r\n" + + "Zsuzsanna Dosztányi, Veronika Csizmók, Péter Tompa and István Simon\r\n" + + "J. Mol. Biol. (2005) 347, 827-839.", "1.0", + "http://iupred.enzim.hu/"); + + static ServiceInfo TCOFFEE_INFO = new ServiceInfo(TcoffeeWS, + "T-Coffee: A novel method for multiple sequence alignments " + + "Notredame, Higgins, Heringa, JMB, 302 (205-217) 2000", + "8.99", "http://tcoffee.crg.cat/apps/tcoffee/index.html"); + + static ServiceInfo MUSCLE_INFO = new ServiceInfo(MuscleWS, + "Edgar, R.C. (2004) MUSCLE: multiple sequence alignment with high accuracy and high throughput.Nucleic Acids Res. 32(5):1792-1797.\r\n" + + "doi:10.1093/nar/gkh340", "3.8.31", + "http://www.drive5.com/muscle/"); + + static ServiceInfo PROBCONS_INFO = new ServiceInfo(ProbconsWS, + "Do, C.B., Mahabhashyam, M.S.P., Brudno, M., and Batzoglou, S. 2005. PROBCONS: " + + "Probabilistic Consistency-based Multiple Sequence Alignment. Genome Research 15: 330-340. ", + "1.12", "http://probcons.stanford.edu/"); + + static ServiceInfo JRONN_INFO = new ServiceInfo(JronnWS, + "unpublished, original algorithm Yang,Z.R., Thomson,R., McMeil,P. and Esnouf,R.M. (2005) " + + "RONN: the bio-basis function neural network technique applied to the " + + "dectection of natively disordered regions in proteins Bioinformatics 21: 3369-3376\r\n", + "1.0", "http://www.compbio.dundee.ac.uk/jabaws/"); + + static ServiceInfo MAFFT_INFO = new ServiceInfo(MafftWS, + "Katoh, Toh 2010 (Bioinformatics 26:1899-1900)\r\n" + + "Parallelization of the MAFFT multiple sequence alignment program. ", + "6.8.57", "http://mafft.cbrc.jp/alignment/software/"); + + static ServiceInfo RNAALIFOLD_INFO = new ServiceInfo(RNAalifoldWS, + "Ivo L. Hofacker, Martin Fekete, and Peter F. Stadler 'Secondary Structure Prediction" + + " for Aligned RNA Sequences'. J.Mol.Biol. 319: 1059-1066, 2002. Stephan H. Bernhart," + + " Ivo L. Hofacker, Sebastian Will, Andreas R. Gruber, and Peter F. Stadler. " + + "'RNAalifold: Improved consensus structure prediction for RNA alignments'. BMC Bioinformatics, 9:474, 2008.\r\n", + "2.1.2", "http://www.tbi.univie.ac.at/RNA/"); + + @XmlAccessorType(XmlAccessType.FIELD) + static class ServiceInfo { + Services service; + String reference; + String version; + String moreinfo; + final static String jabaws_version = "2.5"; + final static String line_delimiter = "\n"; + + private ServiceInfo() { + // Default constructor for JAXB + } + private ServiceInfo(Services service, String reference, String version, + String moreinfo) { + this.service = service; + this.reference = reference; + this.version = version; + this.moreinfo = moreinfo; + } + + @Override + public String toString() { + String value = "SERVICE: " + service + " version " + version + line_delimiter + "\n"; + value += "JABAWS v. " + jabaws_version + line_delimiter; + value += "REFERENCE: " + reference + line_delimiter + "\n"; + value += "MORE INFORMATION: " + moreinfo + line_delimiter; + return value; + } + + public String getReference() { + return "REFERENCE: " + reference + line_delimiter + "
MORE INFORMATION: " + moreinfo + line_delimiter; + } + + public String getVersion() { + return version; + } + } + + public static void main(String[] args) { + System.out.println(MUSCLE_INFO); } -} \ No newline at end of file +}