uk.ac.ebi.intact.application.intSeq.business
Class RunSimilaritySearch

java.lang.Object
  |
  +--uk.ac.ebi.intact.application.intSeq.business.RunSimilaritySearch
All Implemented Interfaces:
RunSimilaritySearchIF

public class RunSimilaritySearch
extends java.lang.Object
implements RunSimilaritySearchIF

This class manages the multiple alignment algorithm command line, defined in the web.xml file (it can be wu-blast, ncbi-blast or fasta). It makes two different ManagerFiles: * the input file which contains the query protein sequence. * the output file which contains the result. The parsing method required for this kind of output file is called. These two files are randomly created, and afterwards, they are deleted because this web application is intended to be multi-user.

Version:
: $Id: RunSimilaritySearch.java,v 1.4 2003/07/16 13:56:24 skerrien Exp $
Author:
shuet (shuet@ebi.ac.uk)

Field Summary
protected  java.lang.String command
          command line required to manage the blast program.
protected  double evalueMin
          E-Value initialized at "0" to make a test afterwards.
protected  ManagerFilesBlast fileInput
          the both ManagerFiles -> 1 input file and 1 output file for each execution of BLAST or FASTA
protected  ManagerFilesBlast fileOutput
           
protected  java.lang.String sequence
          protein sequence written in the input file
 
Constructor Summary
RunSimilaritySearch(java.lang.String seq, java.lang.String command, double eValue)
          constructor which retrieves the Evalue minimum, required to validate the results, in addition to the command line and the protein sequence.
 
Method Summary
protected  boolean ExecBlast()
          FillSeqFileConcatCommand 1) creates and full the input file, and also complete the command line.
protected  void FillSeqFileConcatCommand(java.lang.String inputDir, boolean input)
          This method creates a random file name in the good directory: input files and output files are managed in two different directories.
 boolean GetCommandExecResponse()
          keep inform the Action Class whether the command line was executed well or not.
static long getId()
          Returns the unique id based on the current time; the ids are unique for a session.
 java.lang.String getSequence()
           
protected  void OutputProcessManagement(java.lang.Object stream, boolean in)
          This method manages the output stream of a process: limited buffer size: the process needs that a bufferReader reads the screen output stream and the error output stream.
protected  java.util.ArrayList ParamTest(int indexTab, java.util.ArrayList alignResults)
          This method tests if the evalue is smaller than the constant defined in the web.xml file, which means that the alignment is acceptable.
 java.util.ArrayList RetrieveParseResult()
          In case of a good blast execution, the output blast file would be parsed.
protected  boolean SearchOptionTab(java.lang.String split, java.util.ArrayList options)
          This method splits the command line according to the spaces, and retrieve an item in it.
 void setSequence(java.lang.String seq)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

command

protected java.lang.String command
command line required to manage the blast program.


sequence

protected java.lang.String sequence
protein sequence written in the input file


evalueMin

protected double evalueMin
E-Value initialized at "0" to make a test afterwards.


fileInput

protected ManagerFilesBlast fileInput
the both ManagerFiles -> 1 input file and 1 output file for each execution of BLAST or FASTA


fileOutput

protected ManagerFilesBlast fileOutput
Constructor Detail

RunSimilaritySearch

public RunSimilaritySearch(java.lang.String seq,
                           java.lang.String command,
                           double eValue)
constructor which retrieves the Evalue minimum, required to validate the results, in addition to the command line and the protein sequence.

Parameters:
seq - String the protein sequence in the Fasta format
command - String the multiple alignment program will be launched by this command line
eValue - double remind the maximum E-Value allowed in the result file
Method Detail

getId

public static long getId()
Returns the unique id based on the current time; the ids are unique for a session.


getSequence

public java.lang.String getSequence()

setSequence

public void setSequence(java.lang.String seq)

GetCommandExecResponse

public boolean GetCommandExecResponse()
keep inform the Action Class whether the command line was executed well or not.

Specified by:
GetCommandExecResponse in interface RunSimilaritySearchIF
Returns:
the boolean answer.

RetrieveParseResult

public java.util.ArrayList RetrieveParseResult()
                                        throws IntactException
In case of a good blast execution, the output blast file would be parsed. return the file which contains all output file results detected by the parsing.

Specified by:
RetrieveParseResult in interface RunSimilaritySearchIF
Returns:
the results in a list of list.
IntactException

ExecBlast

protected boolean ExecBlast()
                     throws IntactException
FillSeqFileConcatCommand 1) creates and full the input file, and also complete the command line. 2) creates the output file, and also complete the command line. Runtime 3) processes the command line created. When Runtime.exec() isn't, the subprocess might be block or deadlock: if the program launched produces output, ensure that the InputStream is immediately processed.

Returns:
the results in a list of list.
IntactException

FillSeqFileConcatCommand

protected void FillSeqFileConcatCommand(java.lang.String inputDir,
                                        boolean input)
                                 throws IntactException
This method creates a random file name in the good directory: input files and output files are managed in two different directories. Afterwards, this method fills in the corresponding command file with the good options ("-i" for the input file and "-o" for the ouput for instance).

Parameters:
inputDir - String which describes the relative path of the file to create.
input - boolean which informs whether the file to manage with the command line is the input file or the output file.
IntactException

SearchOptionTab

protected boolean SearchOptionTab(java.lang.String split,
                                  java.util.ArrayList options)
This method splits the command line according to the spaces, and retrieve an item in it. In this class, this method checks if the "-m 9" option exists in the command line, and also checks if the command called is Blast or Fasta.

Parameters:
split - String "regex" according to which the line will be splitted.
options - List which contains String to retrieve in the line already splitted.
Returns:
boolean answer whether our option is found in the line splitted.

OutputProcessManagement

protected void OutputProcessManagement(java.lang.Object stream,
                                       boolean in)
This method manages the output stream of a process: limited buffer size: the process needs that a bufferReader reads the screen output stream and the error output stream.

Parameters:
stream - manage this screen output stream with the appropriate object.
in - boolean to specify if the previous Object parameter is an InputStream or an OutputStream.

ParamTest

protected java.util.ArrayList ParamTest(int indexTab,
                                        java.util.ArrayList alignResults)
This method tests if the evalue is smaller than the constant defined in the web.xml file, which means that the alignment is acceptable. If it is, the E-Value column is then removed from the list.

Parameters:
indexTab - int which corresponds to the "evalue column" in the tabular output file.
alignResults - List which contains all the results from the parsing of the output file.
Returns:
arrayList of List: new results without the "evalue column" and without lines where the evalue was too small (lines removed). Each line of the ArrayList contains our 6 items (ac, %, start...)


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk