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