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;
15 import org.apache.http.entity.mime.content.ContentBody;
16 import org.apache.http.entity.mime.content.StringBody;
19 * input a list of sequences separated by some separator
23 public class SeqVector extends InputType {
28 super(new Class[] { AlignmentI.class} );
32 public ContentBody formatForInput(RestJob rj) throws UnsupportedEncodingException, NoValidInputDataException
34 StringBuffer idvector = new StringBuffer();
36 for (SequenceI seq:rj.getSequencesForInput(token, type))
42 idvector.append(seq.getSequence());
44 return new StringBody(idvector.toString());
47 public List<String> getURLEncodedParameter()
49 ArrayList<String> prms = new ArrayList<String>();
50 super.addBaseParams(prms);
51 prms.add("sep='"+ sep+"'");
52 prms.add("type='"+type+"'");
57 public String getURLtokenPrefix()
63 public boolean configureProperty(String tok, String val,
64 StringBuffer warnings)
67 if (tok.startsWith("sep"))
72 if (tok.startsWith("type"))
75 type=molType.valueOf(val);
79 warnings.append("Invalid molecule type '"+val+"'. Must be one of (");
80 for (molType v:molType.values())
82 warnings.append(" "+v);
84 warnings.append(")\n");