Merge branch 'spike/JAL-1950_hmmer3client' into features/mchmmer_merge_JAL-1950
[jalview.git] / src / jalview / ws / rest / clientdefs / ShmrRestClient.java
1 package jalview.ws.rest.clientdefs;
2
3 import jalview.io.packed.DataProvider.JvDataType;
4 import jalview.util.MessageManager;
5 import jalview.ws.rest.InputType;
6 import jalview.ws.rest.RestClient;
7 import jalview.ws.rest.RestServiceDescription;
8 import jalview.ws.rest.params.Alignment;
9 import jalview.ws.rest.params.JobConstant;
10 import jalview.ws.rest.params.SeqGroupIndexVector;
11
12 import java.util.Hashtable;
13
14 public class ShmrRestClient
15 {
16
17   public static RestClient makeShmmrRestClient()
18   {
19     String action = "Analysis", description = "Sequence Harmony and Multi-Relief (Brandt et al. 2010)", name = MessageManager
20             .getString("label.multiharmony");
21     Hashtable<String, InputType> iparams = new Hashtable<String, InputType>();
22     jalview.ws.rest.params.JobConstant toolp;
23     // toolp = new jalview.ws.rest.JobConstant("tool","jalview");
24     // iparams.put(toolp.token, toolp);
25     // toolp = new jalview.ws.rest.params.JobConstant("mbjob[method]","shmr");
26     // iparams.put(toolp.token, toolp);
27     // toolp = new
28     // jalview.ws.rest.params.JobConstant("mbjob[description]","step 1");
29     // iparams.put(toolp.token, toolp);
30     // toolp = new jalview.ws.rest.params.JobConstant("start_search","1");
31     // iparams.put(toolp.token, toolp);
32     // toolp = new jalview.ws.rest.params.JobConstant("blast","0");
33     // iparams.put(toolp.token, toolp);
34   
35     jalview.ws.rest.params.Alignment aliinput = new jalview.ws.rest.params.Alignment();
36     // SHMR server has a 65K limit for content pasted into the 'ali' parameter,
37     // so we always upload our files.
38     aliinput.token = "ali_file";
39     aliinput.writeAsFile = true;
40     iparams.put(aliinput.token, aliinput);
41     jalview.ws.rest.params.SeqGroupIndexVector sgroups = new jalview.ws.rest.params.SeqGroupIndexVector();
42     sgroups.setMinsize(2);
43     sgroups.min = 2;// need at least two group defined to make a partition
44     iparams.put("groups", sgroups);
45     sgroups.token = "groups";
46     sgroups.sep = " ";
47     RestServiceDescription shmrService = new RestServiceDescription(
48             action,
49             description,
50             name,
51             "http://zeus.few.vu.nl/programs/shmrwww/index.php?tool=jalview",// ?tool=jalview&mbjob[method]=shmr&mbjob[description]=step1",
52             "?tool=jalview", iparams, true, false, '-');
53     // a priori knowledge of the data returned from the service
54     shmrService.addResultDatatype(JvDataType.ANNOTATION);
55     return new RestClient(shmrService);
56   }
57
58 }