edu.iastate.metnet.birdseyeview.db
Class Database

java.lang.Object
  extended by edu.iastate.metnet.birdseyeview.db.Database

public class Database
extends java.lang.Object

The Database Class encapsulates the functionality that interacts with the Metnet MySQL database.

Author:
Matt Studham Created Mar 19, 2005

Field Summary
(package private)  java.sql.Connection connection
           
 
Constructor Summary
Database()
          Constructor.
 
Method Summary
 java.util.HashMap getAllLocationInfo()
          This method retrieves all of the cellular location information from the database.
 java.util.ArrayList getGoBioProcesses(java.lang.Integer goID)
          This method returns a list of GO biological process term IDs in which the given entity participates.
 java.util.ArrayList getGoChildren(java.lang.Integer goNodeID)
          This method retrieves a list of the child nodes for the given node.
 java.util.ArrayList getGoFunctions(java.lang.Integer goID)
          This method returns a list of GO molecular function term IDs in which the given entity is involved.
 java.lang.Integer getGoGeneProductID(java.lang.String locusID)
          This method converts the given locus ID into a GO gene product ID querying the GO database in the Metnet DB.
 java.lang.String getGoNodeName(java.lang.Integer goNodeID)
          This method retrieves the name of the GO node with the given ID.
 java.util.ArrayList getGoNodesWithinDistance(java.lang.Integer rootNodeID, int distance)
          This method retrieves a unique list of the nodes of the hierarchy for the given root within the given distance from the root.
 java.util.ArrayList getGoTermAncestors(java.lang.Integer goTermID)
          This method returns a list of terms which are the ancestors (parents, itself, etc.) for the given term.
 java.util.ArrayList getLocations(java.lang.Integer entityID)
          This method returns a list of cellular locations for the given entity.
 java.util.ArrayList getLocusIDs(java.lang.String affyID)
          This method converts the given affymetrix ID (..._at) into Locus IDs (AT-G----...) by querying a cross-ref table in the Metnet DB.
 java.lang.Integer getMetnetEntityID(java.lang.String locusID)
          This method converts the given locus ID into a Metnet Entity ID by querying the Metnet DB.
 java.util.ArrayList getPathways(java.lang.Integer entityID)
          This method returns a list of pathways in which the given entity participates.
 java.util.ArrayList getPolypeptides(java.lang.Integer entityID)
          This method returns a list of polypeptides for the given entity (gene).
 java.util.ArrayList getProteinComplexes(java.lang.Integer entityID)
          This method returns a list of protein complexes of which the given entity (polypeptide) is a component.
 void initialize()
          This method makes the connection to the Metnet DB.
static void main(java.lang.String[] args)
          This method tests the Database class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

java.sql.Connection connection
Constructor Detail

Database

public Database()
Constructor.

Method Detail

initialize

public void initialize()
                throws BirdsEyeViewException
This method makes the connection to the Metnet DB.

Throws:
BirdsEyeViewException - SQL error

getMetnetEntityID

public java.lang.Integer getMetnetEntityID(java.lang.String locusID)
                                    throws BirdsEyeViewException
This method converts the given locus ID into a Metnet Entity ID by querying the Metnet DB. The locus ID is the Entity Name in Metnet. If there given ID is null or there is no such entity in Metnet, null is returned.

Parameters:
locusID - Locus ID
Returns:
Integer - may be null
Throws:
BirdsEyeViewException - SQL error

getLocusIDs

public java.util.ArrayList getLocusIDs(java.lang.String affyID)
                                throws BirdsEyeViewException
This method converts the given affymetrix ID (..._at) into Locus IDs (AT-G----...) by querying a cross-ref table in the Metnet DB. If there is no such entity in Metnet, the returned list is empty.

Parameters:
affyID - Affymatrix ID
Returns:
ArrayList - may be empty
Throws:
BirdsEyeViewException - SQL error

getPolypeptides

public java.util.ArrayList getPolypeptides(java.lang.Integer entityID)
                                    throws BirdsEyeViewException
This method returns a list of polypeptides for the given entity (gene). The list may be empty. This query first gets a list of RNA's (as block ID's) and then uses that list to get the list of polypeptides for each RNA. We don't differentiate the different polypeptides from the different RNAs.

Parameters:
entityID -
Returns:
ArrayList Polypeptide objects
Throws:
BirdsEyeViewException - SQL error

getProteinComplexes

public java.util.ArrayList getProteinComplexes(java.lang.Integer entityID)
                                        throws BirdsEyeViewException
This method returns a list of protein complexes of which the given entity (polypeptide) is a component. The list may be empty.

Parameters:
entityID -
Returns:
ArrayList Protein Complex objects
Throws:
BirdsEyeViewException - SQL error

getLocations

public java.util.ArrayList getLocations(java.lang.Integer entityID)
                                 throws BirdsEyeViewException
This method returns a list of cellular locations for the given entity. The list may be empty.

Parameters:
entityID -
Returns:
ArrayList String objects
Throws:
BirdsEyeViewException - SQL error

getPathways

public java.util.ArrayList getPathways(java.lang.Integer entityID)
                                throws BirdsEyeViewException
This method returns a list of pathways in which the given entity participates. The list may be empty.

Parameters:
entityID -
Returns:
ArrayList String objects
Throws:
BirdsEyeViewException - SQL error

getGoGeneProductID

public java.lang.Integer getGoGeneProductID(java.lang.String locusID)
                                     throws BirdsEyeViewException
This method converts the given locus ID into a GO gene product ID querying the GO database in the Metnet DB. If there given ID is null or there is no such entity in Metnet, null is returned.

Parameters:
locusID - Locus ID
Returns:
Integer - may be null
Throws:
BirdsEyeViewException - SQL error

getGoBioProcesses

public java.util.ArrayList getGoBioProcesses(java.lang.Integer goID)
                                      throws BirdsEyeViewException
This method returns a list of GO biological process term IDs in which the given entity participates. The list may be empty.

Parameters:
goID -
Returns:
ArrayList Integer objects
Throws:
BirdsEyeViewException - SQL error

getGoFunctions

public java.util.ArrayList getGoFunctions(java.lang.Integer goID)
                                   throws BirdsEyeViewException
This method returns a list of GO molecular function term IDs in which the given entity is involved. The list may be empty.

Parameters:
goID -
Returns:
ArrayList Integer objects
Throws:
BirdsEyeViewException - SQL error

getGoChildren

public java.util.ArrayList getGoChildren(java.lang.Integer goNodeID)
                                  throws BirdsEyeViewException
This method retrieves a list of the child nodes for the given node.

Parameters:
goNodeID -
Returns:
ArrayList List of Integer objects; ID's of child nodes
Throws:
BirdsEyeViewException

getGoTermAncestors

public java.util.ArrayList getGoTermAncestors(java.lang.Integer goTermID)
                                       throws BirdsEyeViewException
This method returns a list of terms which are the ancestors (parents, itself, etc.) for the given term. The returned list will include the given term!

Parameters:
goTermID - GO term ID
Returns:
ArrayList List of GO term IDs (Integers)
Throws:
BirdsEyeViewException

getGoNodesWithinDistance

public java.util.ArrayList getGoNodesWithinDistance(java.lang.Integer rootNodeID,
                                                    int distance)
                                             throws BirdsEyeViewException
This method retrieves a unique list of the nodes of the hierarchy for the given root within the given distance from the root.

Parameters:
rootNodeID -
distance - Distance from the root (inclusive)
Returns:
ArrayList Unique list of Integer objects; ID's of nodes
Throws:
BirdsEyeViewException

getGoNodeName

public java.lang.String getGoNodeName(java.lang.Integer goNodeID)
                               throws BirdsEyeViewException
This method retrieves the name of the GO node with the given ID.

Parameters:
goNodeID -
Returns:
String Node name (Term name)
Throws:
BirdsEyeViewException - Database error

getAllLocationInfo

public java.util.HashMap getAllLocationInfo()
                                     throws BirdsEyeViewException
This method retrieves all of the cellular location information from the database.

Returns:
HashMap Key=Integer code, Value=String name
Throws:
BirdsEyeViewException - Database error

main

public static void main(java.lang.String[] args)
This method tests the Database class.

Parameters:
args -