edu.hust.go.model
Class GoGraphModel

java.lang.Object
  |
  +--edu.hust.go.model.GoGraphModel

public class GoGraphModel
extends java.lang.Object

A graph model is constructed by the connection in GO terms. It can be used to construct GUI by edu.hust.go.gui.GraphCreator.


Constructor Summary
GoGraphModel(java.util.HashMap map)
           
 
Method Summary
 SimpleDirectedGraph buildSubGraph(java.util.ArrayList goTerms, int parentLevel, int childLevel)
          extract sub graph from GO graph, the sub graph contains a set of target go terms , and related in the pathway from the root to its leaf nodes, for example, one pathway is A->B->C->Target->D->E->F, while A is root and F is leaf, and suppose parentLevel and childLevel are both 1, then the nodes C, Taraget, and D are extracted intio the subGraph, the the related edges are extracted into the subGraph too.
 float evalSimilarity(edu.hust.go.term.GO_term node1, edu.hust.go.term.GO_term node2)
           
 float evalSimilarity(edu.hust.go.term.GO_term node1, edu.hust.go.term.GO_term node2, byte type)
          evaluate the similarity of two nodes in directed acylic graph
 java.util.HashSet getCommonParents(java.util.ArrayList goTerms)
          get the common parents in the pathway of target go terms.
 SimpleDirectedGraph getGraph()
          get the whole GO graph
static java.lang.Object[] getLeave(SimpleDirectedGraph subGraph)
          the leave are defindes as the nodes which has no outgoing edges.
 java.util.HashSet getObsoleteSet()
          get obsolete terms in the go definition
 java.util.HashMap getPathsBetweenNodes(edu.hust.go.term.GO_term node1, edu.hust.go.term.GO_term node2)
          get pathway between two Go terms
 java.lang.Object[][] getPathsOfNode2Root(edu.hust.go.term.GO_term node)
           
static java.lang.Object[] getRoots(SimpleDirectedGraph subGraph)
          the roots are defined as the nodes which has no incoming edges.
 java.util.HashMap getRootVertexesMap()
          get the roots of the whole GO graph
 boolean inOnePathway(edu.hust.go.term.GO_term node1, edu.hust.go.term.GO_term node2)
          Tell whether two nodes are in one pathway
static java.util.HashMap loadGoDefinition(java.lang.String definition, byte defType)
          Construct a map between GO id and GO terms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoGraphModel

public GoGraphModel(java.util.HashMap map)
             throws GoException
Parameters:
map - the key is Go ids, the value is GO terms.
Throws:
InvalidGoDefinitionException - there are problems in GO definition file, such as one id is connected to another id, while the latter is not exist in fact. Please make sure that the definition file comes from GO official site: www.geneontology.org or ftp.geneontology.org.
GoException
Method Detail

buildSubGraph

public SimpleDirectedGraph buildSubGraph(java.util.ArrayList goTerms,
                                         int parentLevel,
                                         int childLevel)
extract sub graph from GO graph, the sub graph contains a set of target go terms , and related in the pathway from the root to its leaf nodes, for example, one pathway is A->B->C->Target->D->E->F, while A is root and F is leaf, and suppose parentLevel and childLevel are both 1, then the nodes C, Taraget, and D are extracted intio the subGraph, the the related edges are extracted into the subGraph too.

Parameters:
goTerms - query terms
parentLevel - the depth from one target term to root
childLevel - the depth from one target term to leaf
Returns:
the extracted sub graph

getCommonParents

public java.util.HashSet getCommonParents(java.util.ArrayList goTerms)
get the common parents in the pathway of target go terms. Notice: the common parents in the pathways of one target node is not common parents of all target nodes.

Parameters:
goTerms - target go terms
Returns:
the common parents

evalSimilarity

public float evalSimilarity(edu.hust.go.term.GO_term node1,
                            edu.hust.go.term.GO_term node2)
See Also:
evalSimilarity(GO_term node1,GO_term node2, byte type)

evalSimilarity

public float evalSimilarity(edu.hust.go.term.GO_term node1,
                            edu.hust.go.term.GO_term node2,
                            byte type)
evaluate the similarity of two nodes in directed acylic graph

Parameters:
node1 - one of the two nodes
node2 - one of the two nodes
type - one of the following five values.
Similarity.CAO: basen on information content
Similarity.LIN: basen on information content, see Lin D. An information-theoretic definition of similarity. In: Proceedings of 15th International Conference on Machine Learning, San Francisco US, 1998, 296-304
Similarity.RESNIK: based on information content, see Resnik P. Using information content to evaluate semantic similarity in a taxonomy. In: Proceedings of the 14th International Joint Conference on Artificial Intelligence, Montreal Canada, 1995, 448-453
Similarity.ZZL: refined ZZL based on distance, the LCA(latest common ancestor) is one with maximal information content in the of the same distance LCA
Similarity.oldZZL: based on distance, see Zhong JW, Zhu HP, Li JM, Yu Y. Conceptual Graph Matching for Semantic Search. In: Proceedings of the 10th International Conference on Conceptual Structures: Integration and Interfaces, 2002, 92-196
Returns:
the semanic similarity value

getPathsOfNode2Root

public java.lang.Object[][] getPathsOfNode2Root(edu.hust.go.term.GO_term node)
Parameters:
node - the target node
Returns:
all pathways between the target node and its corresponing root. Each element is a GO term.

inOnePathway

public boolean inOnePathway(edu.hust.go.term.GO_term node1,
                            edu.hust.go.term.GO_term node2)
Tell whether two nodes are in one pathway

Parameters:
node1 - one of the two nodes
node2 - one of the two nodes
Returns:
true means the two nodes are in one pathway, false means no.

getPathsBetweenNodes

public java.util.HashMap getPathsBetweenNodes(edu.hust.go.term.GO_term node1,
                                              edu.hust.go.term.GO_term node2)
get pathway between two Go terms

Parameters:
node1 -
node2 -
Returns:
there is only one key and one value. The key is a HashSet of common ancestors, while the value is a Object[][] of common pathways.

getRoots

public static java.lang.Object[] getRoots(SimpleDirectedGraph subGraph)
the roots are defined as the nodes which has no incoming edges.

Parameters:
subGraph -
Returns:

getLeave

public static java.lang.Object[] getLeave(SimpleDirectedGraph subGraph)
the leave are defindes as the nodes which has no outgoing edges.

Parameters:
subGraph -
Returns:

getGraph

public SimpleDirectedGraph getGraph()
get the whole GO graph

Returns:

getRootVertexesMap

public java.util.HashMap getRootVertexesMap()
get the roots of the whole GO graph

Returns:
the key is go ids, the value is go terms

getObsoleteSet

public java.util.HashSet getObsoleteSet()
get obsolete terms in the go definition

Returns:

loadGoDefinition

public static java.util.HashMap loadGoDefinition(java.lang.String definition,
                                                 byte defType)
                                          throws GoException
Construct a map between GO id and GO terms

Parameters:
definition - GO defineion file
Returns:
GO ids map, including obsolete GO ids
GoException