uk.ac.ebi.intact.application.goDensity.business.dag
Class FastGoDag

java.lang.Object
  |
  +--uk.ac.ebi.intact.application.goDensity.business.data.Key2HashSet
        |
        +--uk.ac.ebi.intact.application.goDensity.business.dag.FastGoDag

public class FastGoDag
extends Key2HashSet

Represents GO-Graph (hierarchy) with fast and direct JDBC access to db. Before you can use this class,
- GoTools.insertGoDag(CvGoNode.class, new IntactHelper(), go.ontology);
- CalcBinInteractionData.java
must be executed to fill external ia_goDens_tables.

Version:
$Id: FastGoDag.java,v 1.2 2003/09/03 12:38:45 markusbrosch Exp $
Author:
Markus Brosch (markus @ brosch.cc)

Field Summary
 
Fields inherited from class uk.ac.ebi.intact.application.goDensity.business.data.Key2HashSet
_key2HashSet, _values
 
Method Summary
 void finalize()
          close all sql-statements properly - should be called once FastGoDag instance is not needed any more -> don't trust the automatic finalisation!
 java.util.Collection getAllChilds(java.lang.String goId)
           
 GoGoDensity[][] getBinaryInteractions(java.util.List distinctGoIds, boolean onlyPrecalcDens)
          For a Set of GoIds the
- possible binary Interactions and
- all real existing Interactions which (could) occur in or within the two goIds are calculated and encapsulated in GoGoDensities.
 java.util.Collection getChilds(java.lang.String goId)
           
 java.lang.String getGoTermFullname(java.lang.String goId)
           
 java.lang.String getGoTermShort(java.lang.String goId)
           
static FastGoDag getInstance()
          get a instance of FastGoDag -> it's a singleton
 java.util.HashSet getInteractors(java.lang.String goId)
           
 boolean isaOrPartOf(java.lang.String goId1, java.lang.String goId2)
          test, if goId1 equals goId2 or if goId1 is a child or subchild of goId2
 java.util.Set isGoIdInDag(java.util.Set distinctGoIds)
          Test, if one or more of the goIds is not in contained in dag.
 java.util.Set isInSameGraphPath(java.util.Set distinctGoIds)
          test all goIds of a Set of GoIds, which are in the same graph path
 boolean isInSameGraphPath(java.lang.String goId1, java.lang.String goId2)
          test, if goId1 is in the same graph path of goId2
 void precalcDensity(int untilDepth)
          precalculate all densities for binaryInteractions between various go-nodes.
 void precalcDensity(java.util.Set goIds)
          precalculation of the go densities by a set of go-ids
 void refreshDbConnection()
          test if the connection to db is still available and if not, it reconnect to the db - used my default where ever sql-statements are used.
 
Methods inherited from class uk.ac.ebi.intact.application.goDensity.business.data.Key2HashSet
add, containsKey, getAll, getKeys, getValueByKey, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static FastGoDag getInstance()
get a instance of FastGoDag -> it's a singleton

Returns:
instance of this class

finalize

public void finalize()
close all sql-statements properly - should be called once FastGoDag instance is not needed any more -> don't trust the automatic finalisation!

Overrides:
finalize in class java.lang.Object

refreshDbConnection

public void refreshDbConnection()
test if the connection to db is still available and if not, it reconnect to the db - used my default where ever sql-statements are used.


getChilds

public java.util.Collection getChilds(java.lang.String goId)
                               throws KeyNotFoundException
Parameters:
goId - (node) for which the children want to be known.
Returns:
a Collection of goIds (Strings) which represent the direct children of the node
KeyNotFoundException

getAllChilds

public java.util.Collection getAllChilds(java.lang.String goId)
Parameters:
goId - (node) for which all children and subchildren want to be known.
Returns:
a Collection of goIds (Strings) which represent the direct and indirect children of the node (subchildren). So all (!) children of the node will be returned.

isaOrPartOf

public boolean isaOrPartOf(java.lang.String goId1,
                           java.lang.String goId2)
test, if goId1 equals goId2 or if goId1 is a child or subchild of goId2

Parameters:
goId2 -
goId1 -
Returns:
true, if goId1 equals goId2 or if goId1 is a (sub)child of goId2 or

isInSameGraphPath

public boolean isInSameGraphPath(java.lang.String goId1,
                                 java.lang.String goId2)
test, if goId1 is in the same graph path of goId2

Parameters:
goId2 -
goId1 -
Returns:
true, if goId1 is in the same graph path as goId2

isInSameGraphPath

public java.util.Set isInSameGraphPath(java.util.Set distinctGoIds)
test all goIds of a Set of GoIds, which are in the same graph path

Parameters:
distinctGoIds - which should be tested
Returns:
a Set of GoId-Pairs, which are (!) in the same graph path

isGoIdInDag

public java.util.Set isGoIdInDag(java.util.Set distinctGoIds)
Test, if one or more of the goIds is not in contained in dag.

Parameters:
distinctGoIds - which should be tested
Returns:
a Set of goIds, which are not included in dag

precalcDensity

public void precalcDensity(java.util.Set goIds)
                    throws GoIdNotInDagException
precalculation of the go densities by a set of go-ids

Parameters:
goIds - for which densities should be precalculated
GoIdNotInDagException

precalcDensity

public void precalcDensity(int untilDepth)
precalculate all densities for binaryInteractions between various go-nodes. The precalculated data will be stored in an extra table.

Parameters:
untilDepth - depth from root element. E.g. "2" means, every go-node from level 0 (root) to level 2 (including) will be taken into account. If you set the value to any negative value, the max depth of the graph will be used!

getBinaryInteractions

public GoGoDensity[][] getBinaryInteractions(java.util.List distinctGoIds,
                                             boolean onlyPrecalcDens)
                                      throws GoIdNotInDagException,
                                             SameGraphPathException
For a Set of GoIds the
- possible binary Interactions and
- all real existing Interactions which (could) occur in or within the two goIds are calculated and encapsulated in GoGoDensities.

Parameters:
distinctGoIds - a Set of goIds in which we are interested in. Each possible go-go-combination (out of the Set) will be covered by this method. IMPORTANT: goIds must be distinct - I use a List for various reasons here - so you have to take care about unique goIds before!!!
Returns:
[][] of GoGoDensity, which include each possibe go-go-combination:

  e.g: List is:  a, b, c, d       
2nd dimension
--------------------------
0 a | aa
1 b | ba bb
2 c | ca cb cc
3 d | da db dc dd
-----|---------------------
| a b c d
| 0 1 2 3 1st dimension

Throws:
GoIdNotInDagException
SameGraphPathException

getInteractors

public java.util.HashSet getInteractors(java.lang.String goId)
                                 throws KeyNotFoundException
Parameters:
goId - (node) for which all Interactor_acs want to be known.
Returns:
a Collection of Interactor ac's (as Strings) which belong to this node (specific goId)
Throws:
KeyNotFoundException - if goId was not found in db

getGoTermShort

public java.lang.String getGoTermShort(java.lang.String goId)
Parameters:
goId - e.g. "GO:0003673"
Returns:
Shortlabel

getGoTermFullname

public java.lang.String getGoTermFullname(java.lang.String goId)
Parameters:
goId -
Returns:
Fullname of CV


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk