package impl.Blast;
import Sight.Agents.*;
import Sight.Agents.Variants.*;
import Sight.Structures.*;
import Sight.dds.*;
import java.io.*;
import java.util.*;
import Sight.Agents.util.*;
public class blastP_ncbi extends Sight.Agents.Variants.sBlaster implements Serializable {
public class Request extends sBlaster.Request implements java.io.Serializable {
public String Sequence; public String Query_from="";
public String Query_to="";
public String Entrez_query = ""; public String Database = "nr";
public String Expect="1";
public String Other_advanced="";
public String Service = "plain";
public String Word_size="3"; public String Filter="T"; public String Lcase_mask="F";
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.ncbi.nlm.nih.gov/blast/Blast.cgi"); map.add("connect:action", "POST"); map.add("connect:master", "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi"); map.add("QUERY", request.Sequence); map.add("QUERY_FROM", request.Query_from); map.add("QUERY_TO", request.Query_to); map.add("DATABASE", request.Database); map.add("ENTREZ_QUERY", ""); map.add("ENTREZ_QUERY", ""); map.add("FILTER", request.Filter); map.add("LCASE_MASK", request.Lcase_mask); map.add("EXPECT", request.Expect); map.add("WORD_SIZE", request.Word_size); map.add("MATRIX_NAME", "BLOSUM62"); map.add("OTHER_ADVANCED", request.Other_advanced); map.add("SHOW_OVERVIEW", "F"); map.add("SHOW_LINKOUT", "T"); map.add("NCBI_GI", "T"); map.add("FORMAT_OBJECT", "Alignment"); map.add("FORMAT_TYPE", "HTML"); map.add("DESCRIPTIONS", request.Descriptions); map.add("ALIGNMENTS", "0"); map.add("ALIGNMENT_VIEW", "Pairwise"); map.add("RUN_PSIBLAST", "F"); map.add("I_THRESH", "0.005"); map.add("FORMAT_ENTREZ_QUERY", ""); map.add("FORMAT_ENTREZ_QUERY", ""); map.add("PROGRAM", "blastp"); map.add("SET_DEFAULTS", "Yes"); map.add("CLIENT", "web"); map.add("SERVICE", request.Service); map.add("PAGE", "Proteins"); map.add("CMD", "Put"); 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","protein sequence",""),
new dField("Database","CharSequence","database","nr", new String[] {"nr","swissprot","pat","yeast","ecoli","pdb","Drosophila genome","month"}),
new dField("Service","CharSequence","Sevice to perform","plain",new String[] {"plain","psi","phi","rpsblast","megablast"}),
new dField("Expect","CharSequence","Expected E value","10"),
new dField("Word_size","CharSequence","2 or 3, other values not supported by NCBI","3",new String[] {"2","3"},new String[] {"2","3 default"}),
new dField("Entrez_query","CharSequence","Limit search by Entrez query","",
new String[] {"","Viruses [ORGN]","Archaea [ORGN]","Bacteria [ORGN]","Eukaryota [ORGN]",
"Viridiplantae [ORGN]","Fungi [ORGN]","Metazoa [ORGN]","Arthropoda [ORGN]",
"Vertebrata [ORGN]","Mammalia [ORGN]","Rodentia [ORGN]","Primates [ORGN]",
"Aeropyrum pernix [ORGN]","Aquifex aeolicus [ORGN]","Arabidopsis thaliana [ORGN]",
"Bacillus subtilis [ORGN]","Bos taurus [ORGN]","Caenorhabditis elegans [ORGN]",
"Danio rerio [ORGN]","Dictyostelium discoideum [ORGN]","Drosophila melanogaster [ORGN]",
"Escherichia coli [ORGN]","Gallus gallus [ORGN]","Homo sapiens [ORGN]",
"Human immunodeficiency virus type 1 [ORGN]","Methanococcus jannaschii [ORGN]",
"Mus musculus [ORGN]","Oryctolagus cuniculus [ORGN]","Oryza sativa [ORGN]","Ovis aries [ORGN]",
"Plasmodium falciparum [ORGN]","Rattus norvegicus [ORGN]","Saccharomyces cerevisiae [ORGN]",
"Schizosaccharomyces pombe [ORGN]","Simian immunodeficiency virus [ORGN]","Synechocystis PCC6803 [ORGN]",
"Takifugu rubripes [ORGN]","Xenopus laevis [ORGN]","Zea mays [ORGN]"}),
new dField("descriptions","CharSequence","Maximal number of descriptions to receive","400"),
new dField("Query_from","CharSequence","Left boundary of the sequence",""),
new dField("Query_to","CharSequence","Right boundary of the sequence",""),
new dField("Other_advanced","CharSequence","Other advanced BLAST options",""),
}
);
}
public static blastP_ncbi Public = new blastP_ncbi();
public static Agent getAvailableAgent() { return Public; };
public static void main(String[] args) {
Sight.Agents.util.Pind.showConsoles();
try {
Request request = Public.getRequest();
request. Sequence="MPSSGRALLDSPLDSGSLTSLDSSVFCSEGEGEPLALGDCFTVNV";
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();
};
};
SortedSet visitOnEnd = new TreeSet();
public synchronized Object go(Object req) throws Exception
{
Object rt = super.go(req);
try {
{
Iterator iter = visitOnEnd.iterator();
String d;
while (iter.hasNext()) {
d = (String) iter.next();
p("Visit on end: "+d);
readToString(d);
}
}
visitOnEnd.clear();
} catch (Exception exc)
{
};
return rt;
};
}