package impl.protein_analysers;
import Sight.Agents.*;
import Sight.Agents.Redirectors.*;
import Sight.Structures.*;
import Sight.dds.*;
import Sight.tools.xSignature.*;
import java.io.*;
import Sight.Agents.util.*;
public class ProSite extends Sight.Agents.Prototypes.signatureBasedAgent implements Serializable {
public class Request extends Sight.Request implements java.io.Serializable {
public String Sequence;
public String simlevel="i";
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://npsa-pbil.ibcp.fr/cgi-bin/pattern_prosite.pl"); map.add("connect:action", "post"); map.add("connect:master", "http://npsa-pbil.ibcp.fr/cgi-bin/npsa_automat.pl?page=npsa_prosite.html"); map.add("title", ""); map.add("notice", request.Sequence); map.add("simlevel", request.simlevel); map.add("withdoc", "F"); return map; };
public static Request getDefaultRequest() {
return Public.getRequest(); }
private Request getRequest() { return new Request(); };
public String getFormURL() {
return "http://npsa-pbil.ibcp.fr/cgi-bin/pattern_prosite.pl"; }
public String getMasterURL() {
return "http://npsa-pbil.ibcp.fr/cgi-bin/npsa_automat.pl?page=npsa_prosite.html"; }
public dStructure getRequestDds() {
return new Sight.dds.Records(false,
new dField[] {
new dField("Sequence","CharSequence",null,""),
new dField("simlevel","CharSequence","Similarity level","i",new String[] {"m=2","m=1","i","s=95","s=90","s=85","s=80","s=75","s=70","s=65","s=60","s=55","s=50"},new String[] {"2 Mismatches","1 Mismatch","No mismatch = 100% similarity default","95% similarity","90% similarity","85% similarity","80% similarity","75% similarity","70% similarity","65% similarity","60% similarity","55% similarity","50% similarity"}) }
);
}
public static class Record extends Sight.Record implements Serializable {
public CharSequence Header;
public String Url;
public CharSequence Id;
public CharSequence Documentation_url;
public CharSequence Documentation_id;
};
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.Id+" ";
case 1: return ""+r.Header+" "+r.Url+" "+r.Id+" "+r.Documentation_id+" ";
default: return ""+" Header: "+r.Header+" "+" : "+r.Url+" "+" : "+r.Id+" "+" : "+r.Documentation_url+" "+" documentation id: "+r.Documentation_id+" ";
}
};
}
public dStructure getResultDds() {
return new Sight.dds.Records(true,
new dField[] {
new dField("Header","CharSequence","Header",""),
new dField("Url","String",null,""),
new dField("Id","CharSequence",null,""),
new dField("Documentation_url","CharSequence",null,""),
new dField("Documentation_id","CharSequence","documentation id","") }
);
}
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.Url=getURL(fields[1]);
r.Id=fields[2];
r.Documentation_url=fields[3];
r.Documentation_id=fields[4];
return r;
};
public Sight.Result resultFromString(String html) throws Exception {
Result r = new Result();
r.a = (Record[]) createResultArray(html);
return r;
};
public ProSite() { signatures = new multiSignatures();
signatures.zeroCases = new String[] { "NO PATTERN FOUND" };
signatures.far_start=null;
signatures.top=null;
signatures.bottom=null;
signatures.signatures =
new Signature[] {
new Signature("\n--------------------------------------------------------------------------------\n","\nProsite access number: <A HREF=\""),
new Signature("\nProsite access number: <A HREF=\"","\">"),
new Signature("\">","</A>\nProsite documentation access number: <A HREF=\""),
new Signature("</A>\nProsite documentation access number: <A HREF=\"","\">"),
new Signature("\">","</A>\n")
};
setDescription("Scans a sequence against PROSITE (allows mismatches); at PBIL");
preScan = new preScan();
};
public static ProSite Public = new ProSite();
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();
};
}
;
}