package impl.dna_analysers.geneScanners;
import Sight.Agents.*;
import Sight.Agents.Redirectors.*;
import Sight.Structures.*;
import Sight.dds.*;
import java.io.*;
import Sight.Agents.util.*;
public class GenScan extends Sight.Agents.Prototypes.preformattedResponseAgent implements Serializable {
public class Request extends Sight.Request implements java.io.Serializable {
public String _o="Vertebrate";
public String _e="1.00";
public String _n="Sight_200"; public String Sequence;
public Sight.Agents.Request submit() { return Sight.Agents.Request.submit(Public, this, getKey()); };
public Sight.Agents.Request submit(String key)
{ return Sight.Agents.Request.submit(Public, this, key); };
};
protected AMap getFormParameters(Object req) {
Request request = (Request) req;
AMap map = new AMap();
map.add("connect:url", "http://genes.mit.edu/cgi-bin/oldgenscanw.cgi"); map.add("connect:action", "POST"); map.add("connect:master", "http://genes.mit.edu/oldGENSCAN.html"); map.add("-o", request._o); map.add("-e", request._e); map.add("-n", request._n); map.add("-p", "Predicted peptides only"); map.add("-s", request.Sequence); map.add("-a", ""); return map; };
public static Request getDefaultRequest() {
return Public.getRequest(); }
private Request getRequest() { return new Request(); };
public dStructure getRequestDds() {
return new Sight.dds.Records(false,
new dField[] {
new dField("_o","CharSequence","Organism","Vertebrate",new String[] {"Vertebrate","Arabidopsis","Maize"},new String[] {"Vertebrate default","Arabidopsis","Maize"}),
new dField("_e","CharSequence","Suboptimal exon cutoff ","1.00",new String[] {"1.00","0.50","0.25","0.10","0.05","0.02","0.01"},new String[] {"1.00 default","0.50","0.25","0.10","0.05","0.02","0.01"}),
new dField("_n","CharSequence","Sequence name, will be placed in header","Sight_200"),
new dField("Sequence","CharSequence","Sequence","") }
);
}
public static class Record extends Sight.Record implements Serializable {
public CharSequence Header;
public CharSequence Sequence;
};
public static class Result extends Sight.Result implements Serializable {
public Record[] a;
public CharSequence getReportForRecord(Object ro, int level)
{ Record r = (Record) ro;
switch (level) {
case 0: return ""+r.Header+" "+r.Sequence+" ";
case 1: return ""+r.Header+" "+r.Sequence+" ";
default: return ""+" : "+r.Header+" "+" : "+r.Sequence+" ";
}
};
}
public dStructure getResultDds() {
return new Sight.dds.Records(true,
new dField[] {
new dField("Header","CharSequence",null,""),
new dField("Sequence","CharSequence",null,"") }
);
}
public Sight.Record createRecord(String[] row) throws Exception
{ return fillRecord(row); };
public Class getRecordClass() { return Record.class; };
Record fillRecord(String[] fields) throws Exception {
Record r = new Record();
r.Header=fields[0];
r.Sequence=fields[1];
return r;
};
public Sight.Result resultFromString(String html) throws Exception {
Result r = new Result();
r.a = (Record[]) createResultArray(html);
return r;
};
public GenScan() { signatures = new Sight.tools.xPlain.fastaSignatures();
signatures.far_start=null;
signatures.top="</STRONG><b>Predicted peptide sequence(s):\n</b>";
signatures.bottom="<b>Explanation</b>";
signatures.Columns = 2;
setDescription("New Genscan web server at MIT");
setFormURL("http://genes.mit.edu/cgi-bin/oldgenscanw.cgi");
setMasterURL("http://genes.mit.edu/oldGENSCAN.html");
preScan = new preScan();
};
public static GenScan Public = new GenScan();
public static Agent getAvailableAgent() { return Public; };
public static void main(String[] args) {
Sight.Agents.util.Pind.showConsoles();
try {
Request request = getDefaultRequest();
request. Sequence="";
Sight.Agents.Request submission = request.submit();
Result response = (Result) submission.getResult();
System.out.println(response.getReport(2));
} catch (Exception exc)
{ if (exc!=null) System.out.println(exc.getMessage());
exc.printStackTrace();
};
}
;
}