1 package compbio.ws.client;
\r
5 import compbio.engine.client.ConfExecutable;
\r
6 import compbio.engine.client.Executable;
\r
7 import compbio.runner.conservation.AACon;
\r
8 import compbio.runner.disorder.Disembl;
\r
9 import compbio.runner.disorder.GlobPlot;
\r
10 import compbio.runner.disorder.IUPred;
\r
11 import compbio.runner.disorder.Jronn;
\r
12 import compbio.runner.msa.ClustalO;
\r
13 import compbio.runner.msa.ClustalW;
\r
14 import compbio.runner.msa.Mafft;
\r
15 import compbio.runner.msa.Muscle;
\r
16 import compbio.runner.msa.Probcons;
\r
17 import compbio.runner.msa.Tcoffee;
\r
19 public class ServicesUtil {
\r
21 public static Services getServiceByRunner(Class<? extends Executable> class1) {
\r
22 assert class1 != null;
\r
23 String sname = class1.getSimpleName().toLowerCase();
\r
24 for (Services service : Services.values()) {
\r
25 if (service.toString().toLowerCase().contains(sname)) {
\r
32 public static Class<? extends Executable<?>> getServiceImpl(Services service) {
\r
37 return ClustalO.class;
\r
39 return ClustalW.class;
\r
43 return Muscle.class;
\r
45 return Tcoffee.class;
\r
47 return Probcons.class;
\r
49 return Disembl.class;
\r
51 return GlobPlot.class;
\r
55 return IUPred.class;
\r
57 throw new RuntimeException(
\r
58 "Unknown web service implementation class for service: "
\r
63 public static Class<? extends Executable<?>> getRunnerByJobDirectory(
\r
65 Services service = getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir));
\r
66 return getServiceImpl(service);
\r
69 private static String getRunnerNameByJobDirectory(File jobdir) {
\r
70 String name = jobdir.getName().split("#")[0];
\r
72 if (name.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX)) {
\r
73 assert ConfExecutable.CLUSTER_TASK_ID_PREFIX.length() == 1;
\r
74 name = name.substring(1);
\r
79 public static Services getServiceByJobDirectory(File jobdir) {
\r
80 return getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir));
\r
83 private static Services getServiceByRunnerName(String name) {
\r
84 for (Services service : Services.values()) {
\r
85 String runnerName = getServiceImpl(service).getSimpleName()
\r
87 name = name.trim().toLowerCase();
\r
88 if (name.startsWith(runnerName)) {
\r