Package org.biojava.bio.seq.db.biosql
Class TaxonSQL
- java.lang.Object
-
- org.biojava.bio.seq.db.biosql.TaxonSQL
-
-
Constructor Summary
Constructors Constructor Description TaxonSQL()Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TaxonaddName(Connection conn, Taxon taxon, String nameClass, String newName)Deprecated.Adds a new name of the givennameClassto the taxon.static voidattemptClose(ResultSet resultset)Deprecated.Attempt to close the ResultSet.static voidattemptClose(Statement statement)Deprecated.Attempt to close the Statement.static voidautomaticUpdate(Connection conn, DBHelper helper, TaxonFactory factory, File delnodes, File merged)Deprecated.This method tries to perform a complete update according to the givenTaxonFactory, which already contains the newes taxa and the files available at the NCBI-FTP-Site.static String[]getAllScientificNames(Connection conn)Deprecated.Returns all thescientific names, which are currently stored in the database.static StackgetChildrenOf(Connection conn, String scientificName)Deprecated.Returns all children of the specified taxon.static StackgetChildrenOf(Connection conn, Taxon t)Deprecated.Returns the children as aStackof this given taxon.static TaxongetDBTaxon(Connection conn, int taxon_id)Deprecated.Attempts to get a Taxon object corresponding to the specified taxon_id (i.e. the database's internal id for the taxon).static StringgetRealScientificName(Taxon t)Deprecated.This returns the true scientific name of a given taxon, if there is one.static TaxongetTaxon(Connection conn, int ncbi_taxon_id)Deprecated.Attempts to get a Taxon object corresponding to the specified NCBI taxon ID.static TaxongetTaxon(Connection conn, String name)Deprecated.Attempts to get a Taxon object corresponding to the specified name.static SetNCBIids(Connection conn)Deprecated.Returns aSetof all NCBI-Taxon-IDs which are currently stored in the database.static intputTaxon(Connection conn, DBHelper helper, Taxon taxon)Deprecated.Adds aTaxon(along with its parents) to the database.static voidremoveGeneticCodeID(Connection conn, DBHelper helper, Taxon tdb)Deprecated.Deletes the genetic code annotation from the taxon in the database.static voidremoveLeftValue(Connection conn, DBHelper helper, Taxon tdb)Deprecated.Deletes the left value from the specified taxon in the database.static voidremoveMitochondrialGeneticCodeID(Connection conn, DBHelper helper, Taxon tdb)Deprecated.Deletes the so called mitochondrial genetic code annotation from the given taxon.static TaxonremoveName(Connection conn, DBHelper helper, Taxon taxon, String nameClass, String oldName)Deprecated.Deletes the specified name from of the taxon from the database.static voidremoveRank(Connection conn, DBHelper helper, Taxon tdb)Deprecated.Removes the rank persistently from the taxon in the database.static voidremoveRightValue(Connection conn, DBHelper helper, Taxon tdb)Deprecated.Deletes the right value from the specified taxon in the database.static TaxonremoveTaxon(Connection conn, int ncbi_id, DBHelper helper)Deprecated.Deletes the taxon given by it's NCBI-Taxon-ID from the database and returns the removed taxon.static TaxonremoveTaxon(Connection conn, DBHelper helper, String name)Deprecated.Deletes a taxon specified by one of it's names with all it's different names, annotations and sequences from the database.static TaxonsetCommonName(Connection conn, Taxon taxon, String newName)Deprecated.With this method the common name of the given taxon can be changed or created, if there was none before.static voidsetGeneticCodeID(Connection conn, Taxon tdb, int id)Deprecated.Updates the taxon in the database and sets its genetic code id to the specified value.static voidsetLeftValue(Connection conn, Taxon tdb, int left)Deprecated.Updates the taxon and sets the left value to the specified value.static voidsetMitochondrialGeneticCodeID(Connection conn, Taxon tdb, int id)Deprecated.Updates the given taxon and sets it's so called mitochondrial genetic code id to the specified value.static voidsetParent(Connection conn, Taxon child, Taxon parent)Deprecated.This updates the taxonomic tree in the database and sets the parent of the given child taxon to the parent taxon.static voidsetRank(Connection conn, Taxon tdb, String rank)Deprecated.Updates a taxon and sets it's rank to the specifiedString.static voidsetRightValue(Connection conn, Taxon tdb, int right)Deprecated.Updates the taxon in the database and sets the right value to the specified value.static TaxonsetScientificName(Connection conn, Taxon taxon, String newName)Deprecated.This changes the scientific name of the given taxon and stores the new name persistent in the database.
-
-
-
Constructor Detail
-
TaxonSQL
public TaxonSQL()
Deprecated.
-
-
Method Detail
-
getTaxon
public static Taxon getTaxon(Connection conn, int ncbi_taxon_id)
Deprecated.Attempts to get a Taxon object corresponding to the specified NCBI taxon ID.- Parameters:
conn- the connection to the databasencbi_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.
-
getDBTaxon
public static Taxon getDBTaxon(Connection conn, int taxon_id) throws SQLException, ChangeVetoException
Deprecated.Attempts to get a Taxon object corresponding to the specified taxon_id (i.e. the database's internal id for the taxon).- Parameters:
conn- the connection to the databasetaxon_id- the database-specific id for the Taxon.- Returns:
- the corresponding Taxon (which may have already been present in memory after an earlier retrieval).
- Throws:
SQLExceptionChangeVetoException
-
putTaxon
public static int putTaxon(Connection conn, DBHelper helper, Taxon taxon) throws SQLException
Deprecated.Adds aTaxon(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 specifiedTaxonobject.- Parameters:
taxon- aTaxon. TheTaxonmust be annotated with the NCBI taxon id (key=EbiFormat.PROPERTY_ORGANISM).helper- for the certain database system which is in use.- Returns:
- an
intthat corresponds to theTaxonin the database. - Throws:
SQLException
-
attemptClose
public static void attemptClose(Statement statement)
Deprecated.Attempt to close the Statement. Continue on if there is a problem during the close.
-
attemptClose
public static void attemptClose(ResultSet resultset)
Deprecated.Attempt to close the ResultSet. Continue on if there is a problem during the close.
-
getTaxon
public static Taxon getTaxon(Connection conn, String name) throws BioRuntimeException
Deprecated.Attempts to get a Taxon object corresponding to the specified name.- Parameters:
conn- the connection to the databasename- the species scientific name- 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.
- Throws:
BioRuntimeException
-
getAllScientificNames
public static String[] getAllScientificNames(Connection conn) throws BioRuntimeException
Deprecated.Returns all thescientific names, which are currently stored in the database.- Parameters:
conn- connection to the database- Returns:
- array of lexicographically sorted
Strings - Throws:
BioRuntimeException
-
getRealScientificName
public static String getRealScientificName(Taxon t)
Deprecated.This returns the true scientific name of a given taxon, if there is one. This is necessary because if a taxon does not have a parent node, aTaxonFactorygives the scientific name 'ROOT' and the real scientific name (if there is one) is only stored in the taxon'sEbiFormat-annotation. This name 'ROOT' applies only for in memory taxon objects. In the database the real name is stored.- Parameters:
t- the taxon- Returns:
- Name of the taxon.
-
NCBIids
public static Set NCBIids(Connection conn) throws BioRuntimeException
Deprecated.Returns aSetof all NCBI-Taxon-IDs which are currently stored in the database. So it is easy to proove if a taxon is stored in the database or perform other operations.- Parameters:
conn- database connection- Returns:
- a
Setcontaining all NCBI-IDs. - Throws:
BioRuntimeException
-
removeTaxon
public static Taxon removeTaxon(Connection conn, DBHelper helper, String name) throws SQLException, BioException
Deprecated.Deletes a taxon specified by one of it's names with all it's different names, annotations and sequences from the database. This cannot be undone. The removed taxon will be returned.- Parameters:
conn- database connectionhelper- the helper for the certain database system to be used.name- one of the taxon's names- Returns:
- the taxon, which was successfully removed and which is not longer stored in the database.
- Throws:
BioExceptionSQLException
-
removeTaxon
public static Taxon removeTaxon(Connection conn, int ncbi_id, DBHelper helper) throws BioRuntimeException, SQLException, BioException
Deprecated.Deletes the taxon given by it's NCBI-Taxon-ID from the database and returns the removed taxon.- Parameters:
conn- database connectionhelper- the helper for the databasencbi_id- the ncbi-id- Returns:
- the taxon wich is not stored in the database anymore.
- Throws:
BioRuntimeExceptionBioExceptionSQLException
-
setScientificName
public static Taxon setScientificName(Connection conn, Taxon taxon, String newName) throws SQLException
Deprecated.This changes the scientific name of the given taxon and stores the new name persistent in the database.- Parameters:
conn- database connectiontaxon- the taxon to be changednewName- the new scientific name- Returns:
- the changed taxon with the new scientific name.
- Throws:
SQLException
-
setCommonName
public static Taxon setCommonName(Connection conn, Taxon taxon, String newName) throws BioException, SQLException
Deprecated.With this method the common name of the given taxon can be changed or created, if there was none before. The new common name will be stored persitently.- Parameters:
conn- database connectiontaxon- the taxon to be updatednewName- the new common name- Returns:
- the updated taxon.
- Throws:
BioExceptionSQLException
-
addName
public static Taxon addName(Connection conn, Taxon taxon, String nameClass, String newName) throws BioException, SQLException, BioRuntimeException
Deprecated.Adds a new name of the givennameClassto the taxon. However, there must be exactly onescientific nameand maximal onecommon name. Otherwise anExceptionwill be thrown.- Parameters:
conn- database connectiontaxon- the taxon to be updatednameClass- the name_class of the new name.newName- the new name.- Returns:
- the persistently updated taxon.
- Throws:
BioExceptionSQLExceptionBioRuntimeException
-
removeName
public static Taxon removeName(Connection conn, DBHelper helper, Taxon taxon, String nameClass, String oldName) throws BioException, SQLException
Deprecated.Deletes the specified name from of the taxon from the database. Thescientific namehas to be uniqe, so this cannot be removed by this method.- Parameters:
conn- the database connectionhelper- the helper for the used database systemtaxon- the taxon to be updatednameClass- the name_class of the name to be removedoldName- the old name, which is not needed anymore.- Returns:
- the updated taxon.
- Throws:
BioExceptionSQLException
-
getChildrenOf
public static Stack getChildrenOf(Connection conn, String scientificName) throws BioException
Deprecated.Returns all children of the specified taxon.- Parameters:
conn- database connectionscientificName- name of the taxon which children should be searched.- Returns:
- a
Stac, which contains the children sorted by theirescientific names from top to the bottom. - Throws:
BioExceptionSQLException
-
getChildrenOf
public static Stack getChildrenOf(Connection conn, Taxon t) throws BioException
Deprecated.Returns the children as aStackof this given taxon.- Parameters:
conn- database connectiont- the parent taxon- Returns:
- a sorted
Stackof the children, which might be empty, but notnull. - Throws:
BioException
-
setRank
public static void setRank(Connection conn, Taxon tdb, String rank) throws BioRuntimeException
Deprecated.Updates a taxon and sets it's rank to the specifiedString.- Parameters:
conn- database connection.tdb- taxon to be updatedrank- the new rank (like 'kingdom', 'genus' or what ever)- Throws:
BioRuntimeException
-
removeRank
public static void removeRank(Connection conn, DBHelper helper, Taxon tdb) throws BioRuntimeException
Deprecated.Removes the rank persistently from the taxon in the database.- Parameters:
conn-helper-tdb-- Throws:
BioRuntimeException
-
setGeneticCodeID
public static void setGeneticCodeID(Connection conn, Taxon tdb, int id) throws BioRuntimeException
Deprecated.Updates the taxon in the database and sets its genetic code id to the specified value.- Parameters:
conn-tdb-id-- Throws:
BioRuntimeException
-
removeGeneticCodeID
public static void removeGeneticCodeID(Connection conn, DBHelper helper, Taxon tdb) throws BioRuntimeException
Deprecated.Deletes the genetic code annotation from the taxon in the database.- Parameters:
conn-helper-tdb-- Throws:
BioRuntimeException
-
setMitochondrialGeneticCodeID
public static void setMitochondrialGeneticCodeID(Connection conn, Taxon tdb, int id) throws BioRuntimeException
Deprecated.Updates the given taxon and sets it's so called mitochondrial genetic code id to the specified value.- Parameters:
conn-tdb-id-- Throws:
BioRuntimeException
-
removeMitochondrialGeneticCodeID
public static void removeMitochondrialGeneticCodeID(Connection conn, DBHelper helper, Taxon tdb) throws BioRuntimeException
Deprecated.Deletes the so called mitochondrial genetic code annotation from the given taxon.- Parameters:
conn-helper-tdb-- Throws:
BioRuntimeException
-
setLeftValue
public static void setLeftValue(Connection conn, Taxon tdb, int left) throws BioRuntimeException
Deprecated.Updates the taxon and sets the left value to the specified value.- Parameters:
conn-tdb-left-- Throws:
BioRuntimeException
-
removeLeftValue
public static void removeLeftValue(Connection conn, DBHelper helper, Taxon tdb) throws BioRuntimeException
Deprecated.Deletes the left value from the specified taxon in the database.- Parameters:
conn-helper-tdb-- Throws:
BioRuntimeException
-
setRightValue
public static void setRightValue(Connection conn, Taxon tdb, int right) throws BioRuntimeException
Deprecated.Updates the taxon in the database and sets the right value to the specified value.- Parameters:
conn-tdb-right-- Throws:
BioRuntimeException
-
removeRightValue
public static void removeRightValue(Connection conn, DBHelper helper, Taxon tdb) throws BioRuntimeException
Deprecated.Deletes the right value from the specified taxon in the database.- Parameters:
conn-helper-tdb-- Throws:
BioRuntimeException
-
setParent
public static void setParent(Connection conn, Taxon child, Taxon parent) throws BioRuntimeException
Deprecated.This updates the taxonomic tree in the database and sets the parent of the given child taxon to the parent taxon.- Parameters:
conn-child-parent-- Throws:
BioRuntimeException
-
automaticUpdate
public static void automaticUpdate(Connection conn, DBHelper helper, TaxonFactory factory, File delnodes, File merged) throws IOException
Deprecated.This method tries to perform a complete update according to the givenTaxonFactory, which already contains the newes taxa and the files available at the NCBI-FTP-Site.- Parameters:
conn- database connectionhelper- helper for the database system to be usedfactory- the TaxonFactory containing all the new taxadelnodes- file containing the ncbi taxon ids which don't exist anymoremerged- file containing the ncbi taxon ids which were merged.- Throws:
IOException
-
-