1 package jalview.ws.rest.params;
3 import jalview.datamodel.AlignmentI;
4 import jalview.datamodel.SequenceI;
5 import jalview.ws.rest.InputType;
6 import jalview.ws.rest.NoValidInputDataException;
7 import jalview.ws.rest.RestJob;
8 import jalview.ws.rest.RestServiceDescription;
9 import jalview.ws.rest.InputType.molType;
11 import java.io.UnsupportedEncodingException;
12 import java.util.ArrayList;
13 import java.util.List;
14 import java.util.regex.Matcher;
15 import java.util.regex.Pattern;
17 import org.apache.http.entity.mime.content.ContentBody;
18 import org.apache.http.entity.mime.content.StringBody;
21 * input a list of sequence IDs separated by some separator
25 public class SeqIdVector extends InputType {
28 super(new Class[] { AlignmentI.class} );
32 * separator for list of sequence IDs - default is ','
37 public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException, NoValidInputDataException
39 StringBuffer idvector = new StringBuffer();
41 for (SequenceI seq:rj.getSequencesForInput(token, type))
47 idvector.append(seq.getName());
49 return new StringBody(idvector.toString());
52 public List<String> getURLEncodedParameter()
54 ArrayList<String> prms = new ArrayList<String>();
55 super.addBaseParams(prms);
56 prms.add("sep='"+ sep+"'");
57 prms.add("type='"+type+"'");
61 public String getURLtokenPrefix()
66 public boolean configureProperty(String tok, String val, StringBuffer warnings)
68 if (tok.startsWith("sep"))
73 if (tok.startsWith("type"))
76 type=molType.valueOf(val);
80 warnings.append("Invalid molecule type '"+val+"'. Must be one of (");
81 for (molType v:molType.values())
83 warnings.append(" "+v);
85 warnings.append(")\n");