TissueInfo API 20091124110011

edu.mssm.crover.tools.blast
Class BlastCommand

java.lang.Object
  extended by edu.mssm.crover.tools.blast.BlastCommand

public class BlastCommand
extends Object

This implementation wraps around Blast. It is responsible for knowing the peculiarities of the Blast installation (executable location, database directory path, etc.).


Field Summary
static int OUTPUT_PAIRWISE
           
static int OUTPUT_XML
          Selects the XML Blast output.
static int TYPE_DNA
          Sequence is nucleotide.
static int TYPE_PROTEIN
          Sequence is a protein.
 
Constructor Summary
BlastCommand()
           
BlastCommand(BlastContext ctx)
           
 
Method Summary
 BlastResult blast(int seqType, BiologicalSequence seq, String database)
          Runs BLAST.
 BlastResult blast(String blastType, BiologicalSequence querySequence, String database)
           
 boolean checkSequenceDB(String dbname, String path)
          Checks if the command is installed on this machine.
 void copy(File from, File dest)
           
 void copy(InputStream is, File dest)
           
 BlastResult createBlastResult(StringReader sr)
          Creates a BlastResult from a StringReader.
 void dispose(File Output)
           
 String getBlastType(int seqType, String database)
          Predicts the BLAST program to be used depending on the sequence type (DNA or protein) and the type of sequence in the database.
 BlastContext getContext()
           
 boolean installed(String cmdPath, String execName)
          Checks if the command is installed on this machine.
static void main(String[] args)
           
 void read(InputStream is)
           
 File run(int seqType, File seqFile, String database)
          Run BLAST with a (multiple) sequence file.
 File run(String blastType, BiologicalSequence querySequence, String database)
          Run BLAST with a query sequence.
 File run(String blastType, BiologicalSequence querySequence, String database, int mValue)
          Predicts the product of the genes encoded by the sequence passed as argument.
 File run(String blastType, File seqFile, String database, int mValue)
          Runs BLAST on the sequences encoded by the sequence(s) in the File seqFile passed as argument.
 File runbl2(String blastType, BiologicalSequence querySequence, BiologicalSequence subjSequence)
           
 void setContext(BlastContext ctx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OUTPUT_PAIRWISE

public static final int OUTPUT_PAIRWISE
See Also:
Constant Field Values

OUTPUT_XML

public static final int OUTPUT_XML
Selects the XML Blast output.

See Also:
Constant Field Values

TYPE_PROTEIN

public static final int TYPE_PROTEIN
Sequence is a protein.

See Also:
Constant Field Values

TYPE_DNA

public static final int TYPE_DNA
Sequence is nucleotide.

See Also:
Constant Field Values
Constructor Detail

BlastCommand

public BlastCommand()

BlastCommand

public BlastCommand(BlastContext ctx)
Method Detail

installed

public boolean installed(String cmdPath,
                         String execName)
Checks if the command is installed on this machine. Check to see if both /usr/local/softs/blast/blastall (or blast.executable.path/blast.executable.name) and /data/db/blast/ (or blast.database.path/)

Returns:
True when blast is installed on the machine, False otherwise.

checkSequenceDB

public boolean checkSequenceDB(String dbname,
                               String path)
                        throws DatabaseNotFound
Checks if the command is installed on this machine. Check to see if both /usr/local/softs/blast/blastall (or blast.executable.path/blast.executable.name) and /data/db/blast/ (or blast.database.path/)

Returns:
True when blast is installed on the machine, False otherwise.
Throws:
DatabaseNotFound

blast

public BlastResult blast(int seqType,
                         BiologicalSequence seq,
                         String database)
                  throws DatabaseNotFound
Runs BLAST. Determines the BLAST program to be used from the sequence types of the query sequence and the database

Throws:
DatabaseNotFound
See Also:
blast(int, edu.mssm.crover.representation.BiologicalSequence, java.lang.String)

blast

public BlastResult blast(String blastType,
                         BiologicalSequence querySequence,
                         String database)
Throws:
FileNotFoundException - Thrown when there is a Runtime error during the execution of run, such as the tmp directory becoming full or if the execution of BLAST fails.
UnsupportedFormat - Thrown when the output file is not in XML format

getBlastType

public String getBlastType(int seqType,
                           String database)
                    throws DatabaseNotFound
Predicts the BLAST program to be used depending on the sequence type (DNA or protein) and the type of sequence in the database. The sequence type in the database is determined by the initial letter of database file suffix: "n" implies a DNA database, "p" implies a protein database. blastn: dna seq vs dna db blastp: protein seq vs protein db blastx: dna seq vs protein db tblastn: protein seq vs dna db

Throws:
DatabaseNotFound

run

public File run(String blastType,
                BiologicalSequence querySequence,
                String database)
         throws CommandNotInstalled
Run BLAST with a query sequence.

Throws:
CommandNotInstalled
See Also:
run(java.lang.String, edu.mssm.crover.representation.BiologicalSequence, java.lang.String)

run

public File run(int seqType,
                File seqFile,
                String database)
         throws CommandNotInstalled,
                DatabaseNotFound
Run BLAST with a (multiple) sequence file.

Throws:
CommandNotInstalled
DatabaseNotFound
See Also:
run(java.lang.String, edu.mssm.crover.representation.BiologicalSequence, java.lang.String)

run

public File run(String blastType,
                File seqFile,
                String database,
                int mValue)
         throws CommandNotInstalled
Runs BLAST on the sequences encoded by the sequence(s) in the File seqFile passed as argument. Returns a file.

Throws:
CommandNotInstalled

createBlastResult

public BlastResult createBlastResult(StringReader sr)
                              throws CommandNotInstalled,
                                     MarshalException,
                                     ValidationException
Creates a BlastResult from a StringReader. Checks to see if the XML version is supported.

Throws:
CommandNotInstalled
MarshalException
ValidationException

run

public File run(String blastType,
                BiologicalSequence querySequence,
                String database,
                int mValue)
         throws CommandNotInstalled
Predicts the product of the genes encoded by the sequence passed as argument. Returns an array of protein sequences. The path to the blast executable is found in the "blast.executable.path" property. If the blast executable is in /usr/local/softs/blast/blastall, the path should be /usr/local/softs/blast. Default: "blastall".

Parameters:
blastType - The type of blast analysis to be performed (blastp, tblastn, tblastx, blastx, blastn).
querySequence - File that contains the sequence to be used as query.
Returns:
The BLAST output file is returned.
Throws:
CommandNotInstalled

read

public void read(InputStream is)

copy

public void copy(InputStream is,
                 File dest)

copy

public void copy(File from,
                 File dest)

dispose

public void dispose(File Output)

getContext

public BlastContext getContext()

setContext

public void setContext(BlastContext ctx)

runbl2

public File runbl2(String blastType,
                   BiologicalSequence querySequence,
                   BiologicalSequence subjSequence)
            throws CommandNotInstalled
Throws:
CommandNotInstalled

main

public static void main(String[] args)

TissueInfo API 20091124110011

Copyright © 2001-2009 Institute for Computational Biomedicine, All Rights Reserved.