Add an implementation for Services.getServiceInfo method and categorization for services.
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 5 Sep 2011 15:09:58 +0000 (15:09 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 5 Sep 2011 15:09:58 +0000 (15:09 +0000)
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
webservices/compbio/ws/client/Services.java
webservices/compbio/ws/server/Category.java [new file with mode: 0644]
webservices/compbio/ws/server/RegistryWS.java

index faaea67..71a2519 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Set;
 import javax.jws.WebService;\r
 \r
 import compbio.ws.client.Services;\r
+import compbio.ws.server.Category;\r
 \r
 /**\r
  * JABAWS services registry\r
@@ -80,4 +81,22 @@ public interface RegistryWS extends JABAService {
         */\r
        boolean isOperating(Services service);\r
 \r
+       /**\r
+        * Gives the description of the service.\r
+        * \r
+        * @param service\r
+        * @return String, plain text or html formatted piece, but NOT a full html\r
+        *         document\r
+        */\r
+       String getServiceDescription(Services service);\r
+\r
+       /**\r
+        * Gets the list of services per category. ServiceClassifier has the method\r
+        * that returns Map<Category, Set<Services>>\r
+        * \r
+        * @return ServiceClassifier the object to represent relation between\r
+        *         Services and Categories\r
+        */\r
+       Set<Category> getServiceCategories();\r
+\r
 }\r
index 893117f..3616e1b 100644 (file)
@@ -99,4 +99,122 @@ public enum Services {
                                this.toString() + "Port");\r
                return service.getPort(portName, this.getServiceType());\r
        }\r
+\r
+       public String getServiceInfo() {\r
+               switch (this) {\r
+                       case AAConWS :\r
+                               return AACON_INFO;\r
+                       case ClustalOWS :\r
+                               return CLUSTAL_OMEGA_INFO;\r
+                       case ClustalWS :\r
+                               return CLUSTAL_INFO;\r
+                       case DisemblWS :\r
+                               return DISEMBL_INFO;\r
+                       case GlobPlotWS :\r
+                               return GLOBPLOT_INFO;\r
+                       case IUPredWS :\r
+                               return IUPRED_INFO;\r
+                       case JronnWS :\r
+                               return JRONN_INFO;\r
+                       case MafftWS :\r
+                               return MAFFT_INFO;\r
+                       case MuscleWS :\r
+                               return MUSCLE_INFO;\r
+                       case ProbconsWS :\r
+                               return PROBCONS_INFO;\r
+                       case TcoffeeWS :\r
+                               return TCOFFEE_INFO;\r
+                       default :\r
+                               throw new RuntimeException("Unrecognised Web Service Type "\r
+                                               + this + " - Should never happened!");\r
+               }\r
+       }\r
+\r
+       public static final String AACON_INFO = new ServiceInfo(AAConWS,\r
+                       "in preparation", "1.0", "http://www.compbio.dundee.ac.uk/aacon")\r
+                       .toString();\r
+       public static final String CLUSTAL_INFO = new ServiceInfo(\r
+                       ClustalWS,\r
+                       "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"\r
+                                       + "(2007). Clustal W and Clustal X version 2.0. Bioinformatics, 23, 2947-2948. ",\r
+                       "2.0.12", "http://www.clustal.org/clustal2/").toString();\r
+       public static final String CLUSTAL_OMEGA_INFO = new ServiceInfo(\r
+                       ClustalOWS,\r
+                       "Fast, scalable generation of high quality protein multiple sequence alignments using Clustal Omega\r\n"\r
+                                       + "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",\r
+                       "1.0.2", "http://www.clustal.org/omega").toString();\r
+       public static final String DISEMBL_INFO = new ServiceInfo(\r
+                       DisemblWS,\r
+                       "R. Linding, L.J. Jensen, F. Diella, P. Bork, T.J. Gibson and R.B. Russell\r\n"\r
+                                       + "Protein disorder prediction: implications for structural proteomics\r\n"\r
+                                       + "Structure Vol 11, Issue 11, 4 November 2003", "1.5",\r
+                       "http://dis.embl.de/").toString();\r
+       public static final String GLOBPLOT_INFO = new ServiceInfo(\r
+                       GlobPlotWS,\r
+                       "Rune Linding, Robert B. Russell, Victor Neduva and Toby J. Gibson "\r
+                                       + "'GlobPlot: exploring protein sequences for globularity and disorder.' Nucl. Acids Res. (2003) 31 (13): 3701-3708. doi: 10.1093/nar/gkg519\r\n",\r
+                       "2.3", "http://globplot.embl.de/").toString();\r
+       public static final String IUPRED_INFO = new ServiceInfo(\r
+                       IUPredWS,\r
+                       "The Pairwise Energy Content Estimated from Amino Acid Composition Discriminates between Folded and Intrinsically Unstructured Proteins\r\n"\r
+                                       + "Zsuzsanna Dosztányi, Veronika Csizmók, Péter Tompa and István Simon\r\n"\r
+                                       + "J. Mol. Biol. (2005) 347, 827-839.", "1.0",\r
+                       "http://iupred.enzim.hu/").toString();\r
+       public static final String TCOFFEE_INFO = new ServiceInfo(TcoffeeWS,\r
+                       "T-Coffee: A novel method for multiple sequence alignments  "\r
+                                       + "Notredame, Higgins, Heringa, JMB, 302 (205-217) 2000",\r
+                       "8.99", "http://tcoffee.crg.cat/apps/tcoffee/index.html")\r
+                       .toString();\r
+       public static final String MUSCLE_INFO = new ServiceInfo(\r
+                       MuscleWS,\r
+                       "Edgar, R.C. (2004) MUSCLE: multiple sequence alignment with high accuracy and high throughput.Nucleic Acids Res. 32(5):1792-1797.\r\n"\r
+                                       + "doi:10.1093/nar/gkh340", "3.8.31",\r
+                       "http://www.drive5.com/muscle/").toString();\r
+       public static final String PROBCONS_INFO = new ServiceInfo(\r
+                       ProbconsWS,\r
+                       "Do, C.B., Mahabhashyam, M.S.P., Brudno, M., and Batzoglou, S. 2005. PROBCONS: "\r
+                                       + "Probabilistic Consistency-based Multiple Sequence Alignment. Genome Research 15: 330-340. ",\r
+                       "1.12", "http://probcons.stanford.edu/").toString();;\r
+       public static final String JRONN_INFO = new ServiceInfo(\r
+                       JronnWS,\r
+                       "unpublished, original algorithm Yang,Z.R., Thomson,R., McMeil,P. and Esnouf,R.M. (2005) "\r
+                                       + "RONN: the bio-basis function neural network technique applied to the "\r
+                                       + "dectection of natively disordered regions in proteins Bioinformatics 21: 3369-3376\r\n",\r
+                       "1.0", "http://www.compbio.dundee.ac.uk/jabaws/").toString();;\r
+       public static final String MAFFT_INFO = new ServiceInfo(\r
+                       MafftWS,\r
+                       "Katoh, Toh 2010 (Bioinformatics 26:1899-1900)\r\n"\r
+                                       + "Parallelization of the MAFFT multiple sequence alignment program. ",\r
+                       "6.8.57", "http://mafft.cbrc.jp/alignment/software/").toString();;\r
+\r
+       static class ServiceInfo {\r
+               Services service;\r
+               String reference;\r
+               String version;\r
+               String moreinfo;\r
+               final static String jabaws_version = "2.0";\r
+               final static String line_delimiter = "\n";\r
+\r
+               private ServiceInfo(Services service, String reference, String version,\r
+                               String moreinfo) {\r
+                       this.service = service;\r
+                       this.reference = reference;\r
+                       this.version = version;\r
+                       this.moreinfo = moreinfo;\r
+               }\r
+\r
+               @Override\r
+               public String toString() {\r
+                       String value = "SERVICE: " + service + " version " + version\r
+                                       + line_delimiter;\r
+                       value += "JABAWS v. " + jabaws_version + line_delimiter;\r
+                       value += "REFERENCES: " + reference + line_delimiter;\r
+                       value += "MORE INFORMATION: " + moreinfo + line_delimiter;\r
+                       return value;\r
+               }\r
+       }\r
+\r
+       public static void main(String[] args) {\r
+               System.out.println(MUSCLE_INFO);\r
+       }\r
 }
\ 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 (file)
index 0000000..f01ad18
--- /dev/null
@@ -0,0 +1,79 @@
+package compbio.ws.server;\r
+\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+import java.util.TreeSet;\r
+\r
+import compbio.ws.client.Services;\r
+\r
+/**\r
+ * Class that splits {@link Services} to categories. Services themselves have no\r
+ * knowledge which category they belongs to.\r
+ * \r
+ * This class is responsible for initialization of all the categories (done\r
+ * statically) and holds the category names as constrains.\r
+ * \r
+ * \r
+ * @author pvtroshin\r
+ * @version 1.0 September 2011\r
+ */\r
+public class Category {\r
+       /*\r
+        * TODO refactor initialization and constrains into separate classes if\r
+        * further complexity is expected.\r
+        */\r
+\r
+       /**\r
+        * All of the Category names\r
+        */\r
+       public static final String CATEGORY_ALIGNMENT = "Alignment";\r
+       public static final String CATEGORY_DISORDER = "Protein Disorder";\r
+       public static final String CATEGORY_CONSERVATION = "Conservation";\r
+\r
+       String name;\r
+       Set<Services> services;\r
+\r
+       private Category(String name, Set<Services> services) {\r
+               this.name = name;\r
+               this.services = services;\r
+       }\r
+\r
+       Set<Services> getServices() {\r
+               return new TreeSet<Services>(services);\r
+       }\r
+\r
+       public static Set<Category> getCategories() {\r
+               return init();\r
+       }\r
+\r
+       private static Set<Category> init() {\r
+               Set<Services> align_services = new HashSet<Services>();\r
+               align_services.add(Services.ClustalOWS);\r
+               align_services.add(Services.ClustalWS);\r
+               align_services.add(Services.MafftWS);\r
+               align_services.add(Services.MuscleWS);\r
+               align_services.add(Services.ProbconsWS);\r
+               align_services.add(Services.TcoffeeWS);\r
+               Category alignment = new Category(CATEGORY_ALIGNMENT, align_services);\r
+\r
+               Set<Services> disorder_services = new HashSet<Services>();\r
+               align_services.add(Services.DisemblWS);\r
+               align_services.add(Services.GlobPlotWS);\r
+               align_services.add(Services.IUPredWS);\r
+               align_services.add(Services.JronnWS);\r
+\r
+               Category disorder = new Category(CATEGORY_DISORDER, disorder_services);\r
+               Set<Services> conservation_services = new HashSet<Services>();\r
+               align_services.add(Services.AAConWS);\r
+\r
+               Category conservation = new Category(CATEGORY_CONSERVATION,\r
+                               conservation_services);\r
+\r
+               Set<Category> categories = new HashSet<Category>();\r
+               categories.add(alignment);\r
+               categories.add(disorder);\r
+               categories.add(conservation);\r
+\r
+               return categories;\r
+       }\r
+}\r
index 2e9e500..3898b88 100644 (file)
@@ -197,4 +197,14 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService {
                return operating.containsKey(service);\r
        }\r
 \r
+       @Override\r
+       public String getServiceDescription(Services service) {\r
+               return service.getServiceInfo();\r
+       }\r
+\r
+       @Override\r
+       public Set<Category> getServiceCategories() {\r
+               return Category.getCategories();\r
+       }\r
+\r
 }\r