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 Dimers extends Sight.Agents.Prototypes.preformattedResponseAgent 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:url", "http://www.mericity.com/cgi-local/test5.pl"); map.add("connect:action", "post"); map.add("connect:master", "http://www.mericity.com"); map.add("query_sequence", request.Sequence); 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("Sequence","CharSequence",null,"") }
);
}
public static class Record extends Sight.Record implements Serializable {
public CharSequence Class;
public CharSequence Rule;
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;
if (r.Class.length()==0) return "";
switch (level) {
case 0: return ""+r.Class+" "+r.Reliability+" ";
case 1: return ""+r.Class+" "+r.Rule+" "+r.Reliability+" ";
default: return ""+"Class: "+r.Class+" "+" Rule: "+r.Rule+" "+" Reliability: "+r.Reliability+" ";
}
};
}
public dStructure getResultDds() {
return new Sight.dds.Records(true,
new dField[] {
new dField("Class","CharSequence","Dimer on not",""),
new dField("Rule","CharSequence","Rule",""),
new dField("Reliability","CharSequence","Reliability","") }
);
}
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;
r = new Record();
String c = noHtml(fields[0].trim());
if (c.equals("0"))
r.Class="no homodimer";
else
if (c.equals("2"))
r.Class="homodimer";
else r.Class = "";
r.Rule=noHtml(fields[1]);
r.Reliability=noHtml(fields[2]);
return r;
};
public Sight.Result resultFromString(String html) throws Exception {
Result r = new Result();
r.a = (Record[]) createResultArray(html);
return r;
};
public Dimers() { signatures = new Sight.tools.xPlain.multiSignatures();
signatures.far_start="Prediction:";
signatures.top="Class Rule No. Confidence\n<pre><br>";
signatures.bottom="<a href=\"http://www.mericity.com\">Return</a>";
signatures.Columns = 3;
setDescription("QuaternaryStructure Predictor: ExperimentalHomodimer Classifier");
setFormURL("http://www.mericity.com/cgi-local/test5.pl");
setMasterURL("http://www.mericity.com");
preScan = new preScan();
};
public static Dimers Public = new Dimers();
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();
};
}
;
}