## org.biojava.bio.program.ssbind
Class BlastLikeSearchBuilder

    java.lang.Object
      org.biojava.bio.program.ssbind.BlastLikeSearchBuilder

All Implemented Interfaces:
  SearchBuilder, SearchContentHandler

    public class BlastLikeSearchBuilder

extends Object
implements SearchBuilder

`BlastLikeSearchBuilder` will create `SeqSimilaritySearchResult`s from SAX events via a `SeqSimilarityAdapter`. The SAX events should describe elements conforming to the BioJava BlastLikeDataSetCollection DTD. Suitable sources are `BlastLikeSAXParser` or `FastaSearchSAXParser`. The result objects are placed in the `List` supplied to the constructor.

The start/end/strand of `SeqSimilaritySearchHit`s are calculated from their constituent `SeqSimilaritySearchSubHit`s as follows:

- The query start is the lowest query start coordinate of its sub-hits, regardless of strand
- The query end is the highest query end coordinate of its sub-hits, regardless of strand
- The hit start is the lowest hit start coordinate of its sub-hits, regardless of strand
- The hit end is the highest hit end coordinate of its sub-hits, regardless of strand
- The query strand is null for protein sequences. Otherwise it is equal to the query strand of its sub-hits if they are all on the same strand, or `StrandedFeature.UNKNOWN` if the sub-hits have mixed query strands
- The hit strand is null for protein sequences. Otherwise it is equal to the hit strand of its sub-hits if they are all on the same strand, or `StrandedFeature.UNKNOWN` if the sub-hits have mixed hit strands

This class has special meanings for particular keys: if you want to adapt this class for another parser, you will need to be aware of this. These originate from and are fully described in the BlastLikeDataSetCollection DTD.

Key | Meaning
--- | ---
program | either this value or the subjectSequenceType value must be set. This can take values acceptable to AlphabetResolver. These are BLASTN, BLASTP, BLASTX, TBLASTN, TBLASTX, DNA and PROTEIN.
databaseId | Identifier of database searched (in SequenceDBInstallation).
subjectSequenceType | type of sequence that hit is. Can be DNA or PROTEIN.
subjectId | id of sequence that is hit
subjectDescription | description of sequence that is hit
queryStrand | Strandedness of query in alignment. Takes values of "plus" and "minus"
subjectStrand | Strandedness of query in alignment. Takes values of "plus" and "minus"
queryFrame | self-evident
subjectFrame | self-evident
querySequenceStart | self-evident
querySequenceEnd | self-evident
subjectSequenceStart | self-evident
subjectSequenceEnd | self-evident
score | self-evident
expectValue | self-evident
pValue | self-evident

Since:
  1.2
Author:
  Keith James, Greg Cox

Constructor Summary
`BlastLikeSearchBuilder(List target)` Creates a new `BlastLikeSearchBuilder` which will instantiate results into the `List` target.
`BlastLikeSearchBuilder(List target, SequenceDB querySeqHolder, SequenceDBInstallation subjectDBs)` Creates a new `BlastLikeSearchBuilder` which will instantiate results into the `List` target.

Method Summary
`void` `addHitProperty(Object key, Object value)` The `addHitProperty` method adds a key/value pair containing some property of a particular hit.
`void` `addSearchProperty(Object key, Object value)` The `addSearchProperty` method adds a key/value pair containing some property of the overall search result.
`void` `addSubHitProperty(Object key, Object value)` The `addSubHitProperty` method adds a key/value pair containing some property of a particular subhit.
`void` `endHeader()` The `endHeader` method indicates the end of a formatted header.
`void` `endHit()` The `endHit` method indicates the end of a formatted hit.
`void` `endSearch()` The `endSearch` method indicates the end of useful search information.
`void` `endSubHit()` The `endSubHit` method indicates the end of a formatted subhit.
`boolean` `getMoreSearches()` `getMoreSearches` returns the state of the `SearchContentHandler` with respect to further searches from its data source.
`SeqSimilaritySearchResult` `makeSearchResult()` The `makeSearchResult` method returns a `SeqSimilaritySearchResult` instance created from accumulated data.
`void` `setDatabaseID(String databaseID)` `setDatabaseID` identifies the database searched by a name, ID or URN.
`void` `setMoreSearches(boolean value)` `setMoreSearches` sets the state of the `SearchContentHandler`'s expectation of receiving more results.
`void` `setQueryID(String queryID)` `setQueryID` identifies the query sequence by a name, ID or URN.
`void` `setQuerySeqHolder(SequenceDB querySeqHolder)` `setQuerySeqHolder` sets the query sequence holder to a specific database.
`void` `setSubjectDBInstallation(SequenceDBInstallation subjectDBs)` `setSubjectDBInstallation` sets the subject database holder to a specific installation.
`void` `startHeader()` The `startHeader` method indicates the start of a formatted header.
`void` `startHit()` The `startHit` method indicates the start of a formatted hit.
`void` `startSearch()` The `startSearch` method indicates the start of useful search information.
`void` `startSubHit()` The `startSubHit` method indicates the start of a formatted subhit.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BlastLikeSearchBuilder

    public BlastLikeSearchBuilder(List target)

  Creates a new `BlastLikeSearchBuilder` which will instantiate results into the `List` target.

  Parameters:
    `target` - a `List`.

### BlastLikeSearchBuilder

    public BlastLikeSearchBuilder(List target,
                                  SequenceDB querySeqHolder,
                                  SequenceDBInstallation subjectDBs)

  Creates a new `BlastLikeSearchBuilder` which will instantiate results into the `List` target.

  Parameters:
    `target` - a `List`.
    `querySeqHolder` - a `SequenceDB` of query sequences.
    `subjectDBs` - a `SequenceDBInstallation` of databases searched.

Method Detail

### makeSearchResult

    public SeqSimilaritySearchResult makeSearchResult()
                                               throws BioException

  Description copied from interface: `SearchBuilder`
  The `makeSearchResult` method returns a `SeqSimilaritySearchResult` instance created from accumulated data.

  Specified by:
    `makeSearchResult` in interface `SearchBuilder`
  Returns:
    a `SeqSimilaritySearchResult`.
  Throws:
    `BioException` - if an error occurs.

### setQuerySeqHolder

    public void setQuerySeqHolder(SequenceDB querySeqHolder)

  `setQuerySeqHolder` sets the query sequence holder to a specific database.

  Parameters:
    `querySeqHolder` - a `SequenceDB` containing the query sequence(s).

### setSubjectDBInstallation

    public void setSubjectDBInstallation(SequenceDBInstallation subjectDBs)

  `setSubjectDBInstallation` sets the subject database holder to a specific installation.

  Parameters:
    `subjectDBs` - a `SequenceDBInstallation` containing the subject database(s)

### setQueryID

    public void setQueryID(String queryID)

  Description copied from interface: `SearchContentHandler`
  `setQueryID` identifies the query sequence by a name, ID or URN.

  Specified by:
    `setQueryID` in interface `SearchContentHandler`
  Parameters:
    `queryID` - a `String` which should be an unique identifer for the sequence.

### setDatabaseID

    public void setDatabaseID(String databaseID)

  Description copied from interface: `SearchContentHandler`
  `setDatabaseID` identifies the database searched by a name, ID or URN.

  Specified by:
    `setDatabaseID` in interface `SearchContentHandler`
  Parameters:
    `databaseID` - a `String` which should be an unique identifier for the database searched.

### getMoreSearches

    public boolean getMoreSearches()

  Description copied from interface: `SearchContentHandler`
  `getMoreSearches` returns the state of the `SearchContentHandler` with respect to further searches from its data source. Used for handling streams of search results.

  Specified by:
    `getMoreSearches` in interface `SearchContentHandler`
  Returns:
    a `boolean` value.

### setMoreSearches

    public void setMoreSearches(boolean value)

  Description copied from interface: `SearchContentHandler`
  `setMoreSearches` sets the state of the `SearchContentHandler`'s expectation of receiving more results. Used for handling streams of search results.

  Specified by:
    `setMoreSearches` in interface `SearchContentHandler`
  Parameters:
    `value` - a `boolean` value.

### startSearch

    public void startSearch()

  Description copied from interface: `SearchContentHandler`
  The `startSearch` method indicates the start of useful search information.

  Specified by:
    `startSearch` in interface `SearchContentHandler`

### endSearch

    public void endSearch()

  Description copied from interface: `SearchContentHandler`
  The `endSearch` method indicates the end of useful search information.

  Specified by:
    `endSearch` in interface `SearchContentHandler`

### startHeader

    public void startHeader()

  Description copied from interface: `SearchContentHandler`
  The `startHeader` method indicates the start of a formatted header. This usually contains information relevant to the search as a whole.

  Specified by:
    `startHeader` in interface `SearchContentHandler`

### endHeader

    public void endHeader()

  Description copied from interface: `SearchContentHandler`
  The `endHeader` method indicates the end of a formatted header.

  Specified by:
    `endHeader` in interface `SearchContentHandler`

### startHit

    public void startHit()

  Description copied from interface: `SearchContentHandler`
  The `startHit` method indicates the start of a formatted hit. This could be a single line, or a block of lines.

  Specified by:
    `startHit` in interface `SearchContentHandler`

### endHit

    public void endHit()

  Description copied from interface: `SearchContentHandler`
  The `endHit` method indicates the end of a formatted hit.

  Specified by:
    `endHit` in interface `SearchContentHandler`

### startSubHit

    public void startSubHit()

  Description copied from interface: `SearchContentHandler`
  The `startSubHit` method indicates the start of a formatted subhit. There may be zero or more of these per hit.

  Specified by:
    `startSubHit` in interface `SearchContentHandler`

### endSubHit

    public void endSubHit()

  Description copied from interface: `SearchContentHandler`
  The `endSubHit` method indicates the end of a formatted subhit.

  Specified by:
    `endSubHit` in interface `SearchContentHandler`

### addSearchProperty

    public void addSearchProperty(Object key,
                                  Object value)

  Description copied from interface: `SearchContentHandler`
  The `addSearchProperty` method adds a key/value pair containing some property of the overall search result.

  Specified by:
    `addSearchProperty` in interface `SearchContentHandler`
  Parameters:
    `key` - an `Object`.
    `value` - an `Object`.

### addHitProperty

    public void addHitProperty(Object key,
                               Object value)

  Description copied from interface: `SearchContentHandler`
  The `addHitProperty` method adds a key/value pair containing some property of a particular hit.

  Specified by:
    `addHitProperty` in interface `SearchContentHandler`
  Parameters:
    `key` - an `Object`.
    `value` - an `Object`.

### addSubHitProperty

    public void addSubHitProperty(Object key,
                                  Object value)

  Description copied from interface: `SearchContentHandler`
  The `addSubHitProperty` method adds a key/value pair containing some property of a particular subhit.

  Specified by:
    `addSubHitProperty` in interface `SearchContentHandler`
  Parameters:
    `key` - an `Object`.
    `value` - an `Object`.