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 SMART extends Sight.Agents.Prototypes.tableBasedAgent implements Serializable {
public class Request extends Sight.Request implements java.io.Serializable {
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:action", "POST"); map.add("connect:master", "http://smart.embl-heidelberg.de/"); map.add("connect:url", "http://smart.embl-heidelberg.de/smart/show_motifs.pl"); map.add("ID", ""); map.add("SEQUENCE", request.Sequence); map.add("INCLUDE_BLAST", "F"); map.add("DO_PFAM", "F"); map.add("INCLUDE_SIGNALP", "F"); map.add("DO_PROSPERO", "F"); return map; };
public static Request getDefaultRequest() {
return Public.getRequest(); }
private Request getRequest() { return new Request(); };
public String getFormURL() {
return "http://smart.embl-heidelberg.de/smart/show_motifs.pl"; }
public String getMasterURL() {
return "http://smart.embl-heidelberg.de/"; }
public dStructure getRequestDds() {
return new Sight.dds.Records(false,
new dField[] {
new dField("Sequence","CharSequence",null,"") }
);
}
public static class Record extends Sight.Record implements Serializable {
public CharSequence Name;
public CharSequence Ute;
public CharSequence From;
public CharSequence To;
public CharSequence E_value;
};
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 ""+" <a href=\""+r.Ute+"\">"+r.Name+"</a> " +r.From+" "+r.To+" "+r.E_value+" ";
case 1: return ""+" <a href=\""+r.Ute+"\">"+r.Name+"</a> " +r.From+" "+r.To+" "+r.E_value+" ";
default: return ""+" :" +" <a href=\""+r.Ute+"\">"+r.Name+"</a> "+" :" +r.From+" "+" :" +r.To+" "+" :" +r.E_value+" ";
}
};
}
public dStructure getResultDds() {
return new Sight.dds.Records(true,
new dField[] {
new dField("Name",null,null,""),
new dField("Ute","URL","Name url ",""),
new dField("From",null,null,""),
new dField("To",null,null,""),
new dField("E_value",null,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.Name=noHtml(fields[0]);
r.Ute=getURL(fields[0]);
r.From=fields[1];
r.To=fields[2];
r.E_value=fields[3];
return r;
};
public Sight.Result resultFromString(String html) throws Exception {
Result r = new Result();
r.a = (Record[]) createResultArray(html);
return r;
};
public SMART() { ignoreFirstLine=true;
ignoreLastLine =false;
table_position ="2";
setDescription("Simple Modular Architecture Research Tool; at EMBL");
preScan = new preScan();
};
public static SMART Public = new SMART();
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();
};
}
;
}