org.biojava.bio.seq.db.biosql
Class TaxonSQL

java.lang.Object
  extended byorg.biojava.bio.seq.db.biosql.TaxonSQL

public class TaxonSQL
extends Object

Methods for dealing with retrieving Taxa stored in a BioSQL database.

Author:
Len Trigg

Constructor Summary
TaxonSQL()
           
 
Method Summary
static Taxon getTaxon(Connection conn, int ncbi_taxon_id)
          Attempts to get a Taxon object corresponding to the specified NCBI taxon ID.
static int putTaxon(Connection conn, DBHelper helper, Taxon taxon)
          Adds a Taxon (along with its parents) to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaxonSQL

public TaxonSQL()
Method Detail

getTaxon

public static Taxon getTaxon(Connection conn,
                             int ncbi_taxon_id)
Attempts to get a Taxon object corresponding to the specified NCBI taxon ID.

Parameters:
conn - the connection to the database
ncbi_taxon_id - the NCBI taxon ID.
Returns:
the corresponding Taxon (which may have already been present in memory after an earlier retrieval), or null if the Taxon could not be found in the database.

putTaxon

public static int putTaxon(Connection conn,
                           DBHelper helper,
                           Taxon taxon)
                    throws SQLException
Adds a Taxon (along with its parents) to the database. If it is already present in the database, no action is taken. Returns the id by which the database refers to the specified Taxon object.

Parameters:
taxon - a Taxon. The Taxon must be annotated with the NCBI taxon id (key=EbiFormat.PROPERTY_ORGANISM).
Returns:
an int that corresponds to the Taxon in the database.
Throws:
SQLException