/**
 *  Nucleotide-nucleotide BLAST [blastn] at NCBI.
 *  The developer defined the form but did not configured any analysis of the response.
 *  Internet robot, blastN_ncbi, that uses form, located in page
 *  http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORMAT=Semiauto&ALIGNMENTS=50&ALIGNMENT_VIEW=Pairwise&CLIENT=web&DATABASE=nr&DESCRIPTIONS=100&ENTREZ_QUERY=(none)&EXPECT=10&FILTER=L&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&HITLIST_SIZE=100&NCBI_GI=on&PAGE=Nucleotides&PROGRAM=blastn&SERVICE=plain&SET_DEFAULTS.x=34&SET_DEFAULTS.y=8&SHOW_OVERVIEW=on&END_OF_HTTPGET=Yes&SHOW_LINKOUT=yes.
 *  It is your responsibility to find and cite appropriate references
 *  from this page.
 *  Generated 2002.5.26 by Sight 2.0, Ulm university.
 */
package impl.Blast;

import Sight.Agents.*;
import Sight.Agents.Variants.*;
import Sight.Structures.*;
import Sight.dds.*;
import java.io.*;
import Sight.Agents.util.*;

public class blastN_ncbi extends Sight.Agents.Variants.sBlaster implements Serializable {
 /* Data structure to pass query to this robot. */
  public class Request extends sBlaster.Request implements java.io.Serializable {
   public String Query; // required.
   /** default= */
   public String Query_from=""; // text
   /** default= */
   public String Query_to=""; // text
     /** Choices for DATABASE:
    * nr=nr default Drosophila genome=Drosophila genome , default=nr. */
   public String Database="nr"; // select
   /** default=F */
   public String Filter="F"; // checkbox
   /** default=F */
   public String Lcase_mask="F"; // checkbox
   /** default=10 */
   public String Expect="10"; // text
     /** Choices for WORD_SIZE:
    * 7=7 11=11 default 15=15 , default=11. */
   public String Word_size="11"; // select
   /** default= */
   public String Other_advanced=""; // text
   /** default= */
   public String Expect_low="";
   public String Expect_high ="";

       /** Submit request, compute key by SHA digesting algorithm. */
       public Sight.Agents.Request submit() { return Sight.Agents.Request.submit(Public, this, getKey()); };
       /** Submit request with the known key. */
       public Sight.Agents.Request submit(String key)
        { return Sight.Agents.Request.submit(Public, this, key); };
       };

   /** Get the AMap data structure, required by post method. */
  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"); // connect
    map.add("connect:action", "POST"); // connect
    map.add("connect:master", "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Web&LAYOUT=TwoWindows&AUTO_FORMAT=Semiauto&ALIGNMENTS=50&ALIGNMENT_VIEW=Pairwise&CLIENT=web&DATABASE=nr&DESCRIPTIONS=100&ENTREZ_QUERY=(none)&EXPECT=10&FILTER=L&FORMAT_OBJECT=Alignment&FORMAT_TYPE=HTML&HITLIST_SIZE=100&NCBI_GI=on&PAGE=Nucleotides&PROGRAM=blastn&SERVICE=plain&SET_DEFAULTS.x=34&SET_DEFAULTS.y=8&SHOW_OVERVIEW=on&END_OF_HTTPGET=Yes&SHOW_LINKOUT=yes"); // connect
    map.add("QUERY", request.Query); // textarea
    map.add("QUERY_FROM", request.Query_from); // text
    map.add("QUERY_TO", request.Query_to); // text
    map.add("DATABASE", request.Database); // select
    map.add("ENTREZ_QUERY", "(none)"); // select
    map.add("FILTER", request.Filter); // checkbox
    map.add("LCASE_MASK", request.Lcase_mask); // checkbox
    map.add("EXPECT", request.Expect); // text
    map.add("WORD_SIZE", request.Word_size); // select
    map.add("OTHER_ADVANCED", request.Other_advanced); // text
    map.add("FORMAT_OBJECT", "Alignment"); // select
    map.add("FORMAT_TYPE", "XML"); // select
    map.add("DESCRIPTIONS", request.Descriptions); // select
    map.add("ALIGNMENTS", "0"); // select
    map.add("FORMAT_ENTREZ_QUERY", "(none)"); // select
    map.add("EXPECT_LOW", request.Expect_low); // text
    map.add("EXPECT_HIGH", request.Expect_high); // text
    map.add("PROGRAM", "blastn"); // hidden
    map.add("SET_DEFAULTS", "Yes"); // image
    map.add("CLIENT", "web"); // hidden
    map.add("SERVICE", "plain"); // hidden
    map.add("PAGE", "Nucleotides"); // hidden
    map.add("CMD", "Put"); // hidden
    return map; };
  /** Get default request for this robot. */
  public static Request getDefaultRequest() {
     return Public.getRequest(); }
  private Request getRequest() { return new Request(); }; // must be non static

    /** Type definitions for Request. */
   public dStructure getRequestDds() {
    return new Sight.dds.Records(false,
     new dField[] {
        new dField("Query","CharSequence","Nucleotide sequence",""),
        new dField("Query_from","CharSequence","Subsection, from",""),
        new dField("Query_to","CharSequence","Subsection, to",""),
        new dField("Database","CharSequence","database","nr",new String[] {"nr","est","est_human","est_mouse",
          "est_others","gss","htgs","pat","yeast","mito","vector","ecoli","pdb","month","alu","dbsts",
          "chromosome","wgs_anopheles","Drosophila genome"}),
        new dField("Descriptions","CharSequence","Descriptions","100"),
        new dField("Filter","CharSequence","Filtering on/off","F"),
        new dField("Lcase_mask","CharSequence","ignore regions that are in lowercase","F"),
        new dField("Expect","CharSequence","Expected E value","10"),
        new dField("Word_size","CharSequence","Word size, do not specify other than 7,11 or 15 - other values not supported by server","11",new String[] {"7","11","15"}),
        new dField("Other_advanced","CharSequence","Other advanced BLAST options",""),
        new dField("Expect_low","CharSequence","Expected low E value",""),
        new dField("Expect_high","CharSequence","Expected high E value","")                 }
    );
   }

  /** Public instance of agent for user. */
  public static blastN_ncbi Public = new blastN_ncbi();
  public static Agent getAvailableAgent() { return Public; };
  /** main(..) method provided to check robot, launching it
   * as standalone program. */
  public static void main(String[] args) {
  Sight.Agents.util.Pind.showConsoles();
      try {
        Request request = getDefaultRequest();
        // Now modify and assign request fields in accordance with task:
        request. Query="GGTGACAACGTTTGGAAGGGCCAGGGCGACCGGCAGTGTGCACAGGGACTGTGTCGGGCTTGGACCTCACCTGATCCTCTCTCTTAGCGC"+
        "GACCCTTCCTCTGCTCCCTGTCTCCTCTTTCTGCCACTTGTGCGCTGCTTCCGCGCACTCCCGGCTCCCTAGCGGCAGGAGGAGGAAGGCGCACAGCGGGTGGAG"+
        "AGGGTGCGCCAAGGAGAGGTAACCCCTTCGGGAGCCCGGGGAATCCCGGCCGCCACCAGGGGCCGTGCCACCGCCCTCGCGGGACCAAAGCTTCCGGCGTGTCCCC"+
        "AACTTTGTGGCGCCCTCAGGCCGCGG";
        Sight.Agents.Request submission = request.submit();
        // processing now started in separate thread:
        Result response = (Result) submission.getResult();
        // print report, verbosity level 2:
        System.out.println(response.getReport(2));
      } catch (Exception exc)
         { if (exc!=null) System.out.println(exc.getMessage());
           exc.printStackTrace();
         };
   }
;
  }