From 140e024c6b00451dd933a9c25feac2d170d5f9f6 Mon Sep 17 00:00:00 2001 From: pvtroshin Date: Mon, 5 Sep 2011 15:09:58 +0000 Subject: [PATCH] Add an implementation for Services.getServiceInfo method and categorization for services. git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4562 e3abac25-378b-4346-85de-24260fe3988d --- webservices/compbio/data/msa/RegistryWS.java | 19 ++++ webservices/compbio/ws/client/Services.java | 118 +++++++++++++++++++++++++ webservices/compbio/ws/server/Category.java | 79 +++++++++++++++++ webservices/compbio/ws/server/RegistryWS.java | 10 +++ 4 files changed, 226 insertions(+) create mode 100644 webservices/compbio/ws/server/Category.java diff --git a/webservices/compbio/data/msa/RegistryWS.java b/webservices/compbio/data/msa/RegistryWS.java index faaea67..71a2519 100644 --- a/webservices/compbio/data/msa/RegistryWS.java +++ b/webservices/compbio/data/msa/RegistryWS.java @@ -23,6 +23,7 @@ import java.util.Set; import javax.jws.WebService; import compbio.ws.client.Services; +import compbio.ws.server.Category; /** * JABAWS services registry @@ -80,4 +81,22 @@ public interface RegistryWS extends JABAService { */ boolean isOperating(Services service); + /** + * Gives the description of the service. + * + * @param service + * @return String, plain text or html formatted piece, but NOT a full html + * document + */ + String getServiceDescription(Services service); + + /** + * Gets the list of services per category. ServiceClassifier has the method + * that returns Map> + * + * @return ServiceClassifier the object to represent relation between + * Services and Categories + */ + Set getServiceCategories(); + } diff --git a/webservices/compbio/ws/client/Services.java b/webservices/compbio/ws/client/Services.java index 893117f..3616e1b 100644 --- a/webservices/compbio/ws/client/Services.java +++ b/webservices/compbio/ws/client/Services.java @@ -99,4 +99,122 @@ public enum Services { this.toString() + "Port"); return service.getPort(portName, this.getServiceType()); } + + public String getServiceInfo() { + switch (this) { + case AAConWS : + return AACON_INFO; + case ClustalOWS : + return CLUSTAL_OMEGA_INFO; + case ClustalWS : + return CLUSTAL_INFO; + case DisemblWS : + return DISEMBL_INFO; + case GlobPlotWS : + return GLOBPLOT_INFO; + case IUPredWS : + return IUPRED_INFO; + case JronnWS : + return JRONN_INFO; + case MafftWS : + return MAFFT_INFO; + case MuscleWS : + return MUSCLE_INFO; + case ProbconsWS : + return PROBCONS_INFO; + case TcoffeeWS : + return TCOFFEE_INFO; + default : + throw new RuntimeException("Unrecognised Web Service Type " + + this + " - Should never happened!"); + } + } + + public static final String AACON_INFO = new ServiceInfo(AAConWS, + "in preparation", "1.0", "http://www.compbio.dundee.ac.uk/aacon") + .toString(); + public static final String 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.\r\n" + + "(2007). Clustal W and Clustal X version 2.0. Bioinformatics, 23, 2947-2948. ", + "2.0.12", "http://www.clustal.org/clustal2/").toString(); + public static final String 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").toString(); + public static final String 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/").toString(); + public static final String 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/").toString(); + public static final String 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/").toString(); + public static final String 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") + .toString(); + public static final String 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/").toString(); + public static final String 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/").toString();; + public static final String 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/").toString();; + public static final String 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/").toString();; + + static class ServiceInfo { + Services service; + String reference; + String version; + String moreinfo; + final static String jabaws_version = "2.0"; + final static String line_delimiter = "\n"; + + 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; + value += "JABAWS v. " + jabaws_version + line_delimiter; + value += "REFERENCES: " + reference + line_delimiter; + value += "MORE INFORMATION: " + moreinfo + line_delimiter; + return value; + } + } + + public static void main(String[] args) { + System.out.println(MUSCLE_INFO); + } } \ No newline at end of file diff --git a/webservices/compbio/ws/server/Category.java b/webservices/compbio/ws/server/Category.java new file mode 100644 index 0000000..f01ad18 --- /dev/null +++ b/webservices/compbio/ws/server/Category.java @@ -0,0 +1,79 @@ +package compbio.ws.server; + +import java.util.HashSet; +import java.util.Set; +import java.util.TreeSet; + +import compbio.ws.client.Services; + +/** + * Class that splits {@link Services} to categories. Services themselves have no + * knowledge which category they belongs to. + * + * This class is responsible for initialization of all the categories (done + * statically) and holds the category names as constrains. + * + * + * @author pvtroshin + * @version 1.0 September 2011 + */ +public class Category { + /* + * TODO refactor initialization and constrains into separate classes if + * further complexity is expected. + */ + + /** + * All of the Category names + */ + public static final String CATEGORY_ALIGNMENT = "Alignment"; + public static final String CATEGORY_DISORDER = "Protein Disorder"; + public static final String CATEGORY_CONSERVATION = "Conservation"; + + String name; + Set services; + + private Category(String name, Set services) { + this.name = name; + this.services = services; + } + + Set getServices() { + return new TreeSet(services); + } + + public static Set getCategories() { + return init(); + } + + private static Set init() { + Set align_services = new HashSet(); + align_services.add(Services.ClustalOWS); + align_services.add(Services.ClustalWS); + align_services.add(Services.MafftWS); + align_services.add(Services.MuscleWS); + align_services.add(Services.ProbconsWS); + align_services.add(Services.TcoffeeWS); + Category alignment = new Category(CATEGORY_ALIGNMENT, align_services); + + Set disorder_services = new HashSet(); + align_services.add(Services.DisemblWS); + align_services.add(Services.GlobPlotWS); + align_services.add(Services.IUPredWS); + align_services.add(Services.JronnWS); + + Category disorder = new Category(CATEGORY_DISORDER, disorder_services); + Set conservation_services = new HashSet(); + align_services.add(Services.AAConWS); + + Category conservation = new Category(CATEGORY_CONSERVATION, + conservation_services); + + Set categories = new HashSet(); + categories.add(alignment); + categories.add(disorder); + categories.add(conservation); + + return categories; + } +} diff --git a/webservices/compbio/ws/server/RegistryWS.java b/webservices/compbio/ws/server/RegistryWS.java index 2e9e500..3898b88 100644 --- a/webservices/compbio/ws/server/RegistryWS.java +++ b/webservices/compbio/ws/server/RegistryWS.java @@ -197,4 +197,14 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { return operating.containsKey(service); } + @Override + public String getServiceDescription(Services service) { + return service.getServiceInfo(); + } + + @Override + public Set getServiceCategories() { + return Category.getCategories(); + } + } -- 1.7.10.2