procope.methods.interologs.blast
Class BlastHits

java.lang.Object
  extended by procope.methods.interologs.blast.BlastHits
All Implemented Interfaces:
Iterable<BlastHit>

public class BlastHits
extends Object
implements Iterable<BlastHit>

Represents an immutable list of BLAST hits which are normally parsed from a BLAST result file. Contains methods for the detection of best hits and bidirectional best hits.

Author:
Jan Krumsiek

Constructor Summary
BlastHits(Collection<BlastHit> hits)
          Creates a new BLAST hits object from a given list of hits.
 
Method Summary
 Collection<Integer> getAllHitIDs()
          Returns al ist of all proteins which were hit at least once in the database.
 Collection<Integer> getAllQueryIDs()
          Returns a list of all proteins used as query in this BLAST result
 Collection<BlastHit> getBestHits(Integer queryID)
          Returns all best hits for a given query.
 ProteinNetwork getBidirectionalBestHits(BlastHits backward, BlastBBHConstraints constraints)
          Calculate bidirectional best hits (BBHs).
 BlastHit getHit(int query, int hit)
          Retrieves a specific BLAST hit from the result.
 Collection<BlastHit> getHitsPerQuery(int queryID)
          Returns all hits for a given query protein
 int getNumberOfHits()
          Returns the number of hits in this BLAST result
 Iterator<BlastHit> iterator()
          Returns an iterator over all BLAST hits contained in this set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlastHits

public BlastHits(Collection<BlastHit> hits)
Creates a new BLAST hits object from a given list of hits.

Parameters:
hits - the BLAST hits list with which the object is initialized
Method Detail

iterator

public Iterator<BlastHit> iterator()
Returns an iterator over all BLAST hits contained in this set

Specified by:
iterator in interface Iterable<BlastHit>

getHitsPerQuery

public Collection<BlastHit> getHitsPerQuery(int queryID)
Returns all hits for a given query protein

Parameters:
queryID - the protein used as query in the BLAST run
Returns:
all hits for the given query

getBestHits

public Collection<BlastHit> getBestHits(Integer queryID)
Returns all best hits for a given query. A best hit is a hit in the BLAST result with the best score for that query. Eventual multiple best always have the same score.

Parameters:
queryID - the query protein for which the best hits will be retrieved
Returns:
list of best hits for that query

getAllQueryIDs

public Collection<Integer> getAllQueryIDs()
Returns a list of all proteins used as query in this BLAST result

Returns:
list of all query proteins

getAllHitIDs

public Collection<Integer> getAllHitIDs()
Returns al ist of all proteins which were hit at least once in the database.

Returns:
list of all hit proteins

getNumberOfHits

public int getNumberOfHits()
Returns the number of hits in this BLAST result

Returns:
number of hits in the list

getBidirectionalBestHits

public ProteinNetwork getBidirectionalBestHits(BlastHits backward,
                                               BlastBBHConstraints constraints)
Calculate bidirectional best hits (BBHs). A BBH is contained of two proteins which mutually identify each other as the best-scoring blast hit in the database. The calculation if BBHs requires another BLAST result in the backward direction (query as database and database as query).

Note: If proteins have multiple best hits there might be more than one BBH associated with a single protein.

Parameters:
backward - BLAST result which should have used the query of this result as the database and the database of this result as the query
constraints - constraints for filtering BBHs or null if all identified BBHs should be returned
Returns:
bipartite network containing one edge for each identified BBH.

getHit

public BlastHit getHit(int query,
                       int hit)
Retrieves a specific BLAST hit from the result.

Parameters:
query - query protein
hit - hit (database) protein
Returns:
the hit if it exists or null if not