package impl.protein_analysers;
import Sight.Agents.*;
import Sight.Agents.Redirectors.*;
import Sight.Structures.*;
import Sight.dds.*;
import java.io.*;
import Sight.Agents.util.*;
public class TargetP extends Sight.Agents.Prototypes.preformattedResponseAgent implements Serializable {
public class Request extends Sight.Request implements java.io.Serializable {
public String Sequence;
public String Pcut="0.00";
public String Tcut="0.00";
public String Scut="0.00";
public String Ocut="0.00";
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://www.cbs.dtu.dk/cgi-bin/nph-webface"); map.add("connect:action", "POST"); map.add("connect:master", "http://www.cbs.dtu.dk/services/TargetP/"); map.add("configfile", "/usr/opt/www/pub/CBS/services/TargetP/TargetP.cf"); map.add("SEQNAME", ""); map.add("SEQ", request.Sequence); map.add("orgtype", "2"); map.add("orgtype", "1"); map.add("checkbox:cleavsite", "F"); map.add("spec", "0"); map.add("spec", "1"); map.add("spec", "2"); map.add("spec", "3"); map.add("pcut", request.Pcut); map.add("tcut", request.Tcut); map.add("scut", request.Scut); map.add("ocut", request.Ocut); return map; };
public static Request getDefaultRequest() {
return Public.getRequest(); }
private Request getRequest() { return new Request(); };
public String getFormURL() {
return "http://www.cbs.dtu.dk/cgi-bin/nph-webface"; }
public String getMasterURL() {
return "http://www.cbs.dtu.dk/services/TargetP/"; }
public dStructure getRequestDds() {
return new Sight.dds.Records(false,
new dField[] {
new dField("Sequence","CharSequence",null,""),
new dField("Pcut","CharSequence",null,"0.00"),
new dField("Tcut","CharSequence",null,"0.00"),
new dField("Scut","CharSequence",null,"0.00"),
new dField("Ocut","CharSequence",null,"0.00") }
);
}
public static class Record extends Sight.Record implements Serializable {
public CharSequence Location;
public CharSequence Reliability;
};
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.Location+" ";
case 1: return ""+r.Location+" ";
default: return ""+" C - chloroplast, M - mitochondrian, S - secretory, _ other.: "+r.Location+" "+" Reliability class: "+r.Reliability+" ";
}
};
}
public dStructure getResultDds() {
return new Sight.dds.Records(true,
new dField[] {
new dField("Location","CharSequence","C - chloroplast, M - mitochondrian, S - secretory, _ other.",""),
new dField("Reliability","CharSequence","Reliability class","") }
);
}
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.Location=fields[6];
r.Reliability=fields[7];
if (r.Location==null) r.Location="";
if (r.Location.equals("_")) r.Location = "";
return r;
};
public Sight.Result resultFromString(String html) throws Exception {
Result r = new Result();
r.a = (Record[]) createResultArray(html);
return r;
};
public TargetP() { signatures = new Sight.tools.xPlain.multiSignatures();
signatures.far_start="# Name Length\t cTP mTP SP other Loc. RC";
signatures.top="#----------------------------------------------------------------------------------";
signatures.bottom="#----------------------------------------------------------------------------------";
signatures.Columns = 8;
setDescription("Prediction of subcellular location, at CBS");
preScan = new preScan();
};
public static TargetP Public = new TargetP();
public static Agent getAvailableAgent() { return Public; };
public static void main(String[] args) {
Sight.Agents.util.Pind.showConsoles();
try {
Request request = getDefaultRequest();
request. Sequence="MPSSGRALLDSPLDSGSLTSLDSSVFCSEGEGEPLALGDCFTVNVGGSRFVLSQQALSCFPHTRLGKLAVVVASYRRPGALAAVPSPLELCDDANPVDNEYFFDRSSQAFRYVLHYYRTGRLHVMEQLCALSFLQEIQYWGIDELSIDSCCRDRYFRRKELSETLDFKKDTEDQESQHESEQDFSQGPCPTVRQKLWNILEKPGSSTAARIFGVISIIFVVVSIINMALMSAELSWLDLQLLEILEYVCISWFTGEFVLRFLCVRDRCRFLRKVPNIIDLLAILPFYITLLVESLSGSQTTQELENVGRIVQVLRLLRALRMLKLGRHSTGLRSLGMTITQCYEEVGLLLLFLSVGISIFSTVEYFAEQSIPDTTFTSVPCAWWWATTSMTTVGYGDIRPDTTTGKIVAFMCILSGILVLALPIAIINDRFSACYFTLKLKEAAVRQREALKKLTKNIATDSYISVNLRDVYARSIMEMLRLKGRERASTRSSGGDDFWF";
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();
};
}
;
}