edu.iastate.metnet.export
Class GraphExporterImpl

java.lang.Object
  extended by edu.iastate.metnet.export.GraphExporterImpl
All Implemented Interfaces:
GraphExporter

public class GraphExporterImpl
extends java.lang.Object
implements GraphExporter

export the pathway from the database

Author:
Jie Li

Field Summary
(package private)  java.sql.Connection connection
          database connection
(package private) static GraphExporterImpl instance
          singleton
(package private) static org.apache.log4j.Logger logger
          log4j facility
 
Method Summary
 java.util.HashMap bevGetAllLocationInfo()
          BirdsEyeView code
 java.util.ArrayList bevGetGoBioProcesses(java.lang.Integer goID)
          BirdsEyeView code
 java.util.ArrayList bevGetGoChildren(java.lang.Integer goNodeID)
          BirdsEyeView code
 java.util.ArrayList bevGetGoFunctions(java.lang.Integer goID)
          BirdsEyeView code
 java.lang.Integer bevGetGoGeneProductID(java.lang.String locusID)
          BirdsEyeView code
 java.lang.String bevGetGoNodeName(java.lang.Integer goNodeID)
          BirdsEyeView code
 java.util.ArrayList bevGetGoNodesWithinDistance(java.lang.Integer rootNodeID, int distance)
          BirdsEyeView code
 java.util.ArrayList bevGetGoTermAncestors(java.lang.Integer goTermID)
          BirdsEyeView code
 java.util.ArrayList bevGetLocations(java.lang.Integer entityID)
          BirdsEyeView code
 java.util.ArrayList bevGetLocusIDs(java.lang.String affyID)
          BirdsEyeView code
 java.lang.Integer bevGetMetnetEntityID(java.lang.String locusID)
          BirdsEyeView code
 java.util.ArrayList bevGetPathways(java.lang.Integer entityID)
          BirdsEyeView code
 java.util.Map bevGetPolypeptides(java.lang.Integer entityID)
          BirdsEyeView code
 java.util.Map bevGetProteinComplexes(java.lang.Integer entityID)
          BirdsEyeView code
 edu.uci.ics.jung.graph.DirectedGraph eaGraphQuery(java.util.Collection gobiNodeList)
          get the graph model from the node list
 java.util.Map findBlockunitInstance(java.util.Collection blockIdList)
          get the blockunit map
 java.util.Collection findLiveEntityList(boolean exactMatch, java.lang.String name, java.lang.String location, java.lang.String entityType)
          find the live entities according to the specified query condition
 java.util.Collection getAllLocationList()
          get all location in the database
 java.util.List getAtGeneSearchAttributeList()
          get all attributes in the AtGeneSearch application
 java.util.List getAtGeneSearchObject(java.lang.String affyId)
          get one data object based on the affyId
 java.util.List getFullGeneAnnotationAttributeList()
          get all attributes in function getFullGeneAnnotationList()
 org.apache.commons.collections.map.MultiKeyMap getFullGeneAnnotationList()
          return all possible gene annnotation.
 edu.uci.ics.jung.graph.DirectedGraph getGraphModelByEntity(GobiNode gobiNode)
          get the graph model from the node info.
 edu.uci.ics.jung.graph.DirectedGraph getGraphModelByEntityList(java.util.Collection gobiNodeList)
          get the graph model from the node list.
 edu.uci.ics.jung.graph.DirectedGraph getGraphModelByPathway(java.util.Collection pbidList)
          return the graph model based on the pathway id list.
 edu.uci.ics.jung.graph.DirectedGraph getGraphModelByStep(java.util.Collection blockIdList, int step)
          get the p-neighborhood graph
static GraphExporterImpl getInstance()
          singleton pattern
 org.apache.commons.collections.map.MultiKeyMap getMetaboliteMap()
          get the map from metabolite blockid to name
 MetaboliteObject getMetaboliteObject(java.lang.Integer ebid)
          get additional metabolite information.
 org.apache.commons.collections.map.MultiKeyMap getPathwayCategoryTree()
          get the adjacency list of pathway category tree.
 org.apache.commons.collections.map.MultiKeyMap getPathwayElementMap()
          get the full mapping between the pathways and their elements
 java.util.Map getPathwayInfo(java.util.Collection pbidList)
          get the pathway information of
 org.apache.commons.collections.map.MultiKeyMap getPathwayLocusMap()
          get the full map to pathway, locus and affy probe sets
 java.util.Map getPathwayMapByEntityList(java.util.Collection gobiNodeList)
          get the pathways that contains the entities.
 org.apache.commons.collections.map.MultiKeyMap getPathwayMetaboliteMap()
          get the map from pathway blockid to metabolite blockid
static void main(java.lang.String[] args)
          global entry
 java.util.Collection pubchemCasFilter(java.util.Collection nameList)
          obtain CAS from a list of name.
 java.util.Collection pubchemCid2Name(java.util.Collection cidList)
          obtain pubchem synonym from compound id list
 java.util.Collection pubchemName2Cid(java.util.Collection nameList)
          obtain pubchem compound id from name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
log4j facility


connection

java.sql.Connection connection
database connection


instance

static GraphExporterImpl instance
singleton

Method Detail

getMetaboliteObject

public MetaboliteObject getMetaboliteObject(java.lang.Integer ebid)
Description copied from interface: GraphExporter
get additional metabolite information. Users can get the blockid from the vertex of the graph model. It's better to detect if the entity type of the vertex is a metabolite or not before call this function. It's OK if not to do so but some fields in the object will have null values.

Specified by:
getMetaboliteObject in interface GraphExporter
Parameters:
ebid - the blockid of the metabolite.
Returns:
the metabolite information

pubchemCid2Name

public java.util.Collection pubchemCid2Name(java.util.Collection cidList)
Description copied from interface: GraphExporter
obtain pubchem synonym from compound id list

Specified by:
pubchemCid2Name in interface GraphExporter
Parameters:
cidList - the pubchem compound id list
Returns:
the synonym from pubchem

pubchemName2Cid

public java.util.Collection pubchemName2Cid(java.util.Collection nameList)
Description copied from interface: GraphExporter
obtain pubchem compound id from name.

Specified by:
pubchemName2Cid in interface GraphExporter
Parameters:
nameList - the name list
Returns:
pubchem compound id list

pubchemCasFilter

public java.util.Collection pubchemCasFilter(java.util.Collection nameList)
Description copied from interface: GraphExporter
obtain CAS from a list of name. This function look at the format of each name to see if it satisfies the CAS format.

Specified by:
pubchemCasFilter in interface GraphExporter
Parameters:
nameList - the name or synonym list
Returns:
the CAS list in that synonym list

getInstance

public static GraphExporterImpl getInstance()
singleton pattern

Returns:
the instance of service

getGraphModelByEntity

public edu.uci.ics.jung.graph.DirectedGraph getGraphModelByEntity(GobiNode gobiNode)
Description copied from interface: GraphExporter
get the graph model from the node info. It first collects all pathways in MetNetDB that contains the biological entity. Then, a graph model is constructed to cover all these pathways.

Specified by:
getGraphModelByEntity in interface GraphExporter
Parameters:
gobiNode - the node info from gene gobi
Returns:
the graph model

getGraphModelByEntityList

public edu.uci.ics.jung.graph.DirectedGraph getGraphModelByEntityList(java.util.Collection gobiNodeList)
Description copied from interface: GraphExporter
get the graph model from the node list. This function returns a combination of pathways that contains one or more entities provided by users.

Specified by:
getGraphModelByEntityList in interface GraphExporter
Parameters:
gobiNodeList - the node list
Returns:
the graph model which contains all the nodes

getPathwayMapByEntityList

public java.util.Map getPathwayMapByEntityList(java.util.Collection gobiNodeList)
Description copied from interface: GraphExporter
get the pathways that contains the entities.

Specified by:
getPathwayMapByEntityList in interface GraphExporter
Parameters:
gobiNodeList - the entity list.
Returns:
the pathway mapping, the key is the pathway id, and the value is pathway name of the pathway.
See Also:
GraphExporter.getGraphModelByPathway(Collection)

main

public static void main(java.lang.String[] args)
global entry

Parameters:
args - nothing to do

getGraphModelByPathway

public edu.uci.ics.jung.graph.DirectedGraph getGraphModelByPathway(java.util.Collection pbidList)
Description copied from interface: GraphExporter
return the graph model based on the pathway id list.

Specified by:
getGraphModelByPathway in interface GraphExporter
Returns:
the graph model
See Also:
GraphExporter.getPathwayMapByEntityList(Collection)

getGraphModelByStep

public edu.uci.ics.jung.graph.DirectedGraph getGraphModelByStep(java.util.Collection blockIdList,
                                                                int step)
Description copied from interface: GraphExporter
get the p-neighborhood graph

Specified by:
getGraphModelByStep in interface GraphExporter
Parameters:
blockIdList - the blockid list, which can be obtained from various ways
step - the neighbor list is in the 1st step, then 2nd, and so on.
Returns:
the whole community JUNG graph

bevGetAllLocationInfo

public java.util.HashMap bevGetAllLocationInfo()
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetAllLocationInfo in interface GraphExporter
Returns:
na

bevGetGoBioProcesses

public java.util.ArrayList bevGetGoBioProcesses(java.lang.Integer goID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoBioProcesses in interface GraphExporter
Parameters:
goID - na
Returns:
na

bevGetGoChildren

public java.util.ArrayList bevGetGoChildren(java.lang.Integer goNodeID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoChildren in interface GraphExporter
Parameters:
goNodeID - na
Returns:
na

bevGetGoFunctions

public java.util.ArrayList bevGetGoFunctions(java.lang.Integer goID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoFunctions in interface GraphExporter
Parameters:
goID - na
Returns:
na

bevGetGoGeneProductID

public java.lang.Integer bevGetGoGeneProductID(java.lang.String locusID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoGeneProductID in interface GraphExporter
Parameters:
locusID - na
Returns:
na

bevGetGoNodeName

public java.lang.String bevGetGoNodeName(java.lang.Integer goNodeID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoNodeName in interface GraphExporter
Parameters:
goNodeID - na
Returns:
na

bevGetGoNodesWithinDistance

public java.util.ArrayList bevGetGoNodesWithinDistance(java.lang.Integer rootNodeID,
                                                       int distance)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoNodesWithinDistance in interface GraphExporter
Parameters:
rootNodeID - na
distance - na
Returns:
na

bevGetGoTermAncestors

public java.util.ArrayList bevGetGoTermAncestors(java.lang.Integer goTermID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetGoTermAncestors in interface GraphExporter
Parameters:
goTermID - na
Returns:
na

bevGetLocations

public java.util.ArrayList bevGetLocations(java.lang.Integer entityID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetLocations in interface GraphExporter
Parameters:
entityID - na
Returns:
na

bevGetLocusIDs

public java.util.ArrayList bevGetLocusIDs(java.lang.String affyID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetLocusIDs in interface GraphExporter
Parameters:
affyID - na
Returns:
na

bevGetMetnetEntityID

public java.lang.Integer bevGetMetnetEntityID(java.lang.String locusID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetMetnetEntityID in interface GraphExporter
Parameters:
locusID - na
Returns:
na

bevGetPathways

public java.util.ArrayList bevGetPathways(java.lang.Integer entityID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetPathways in interface GraphExporter
Parameters:
entityID - na
Returns:
na

bevGetPolypeptides

public java.util.Map bevGetPolypeptides(java.lang.Integer entityID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetPolypeptides in interface GraphExporter
Parameters:
entityID - na
Returns:
na

bevGetProteinComplexes

public java.util.Map bevGetProteinComplexes(java.lang.Integer entityID)
Description copied from interface: GraphExporter
BirdsEyeView code

Specified by:
bevGetProteinComplexes in interface GraphExporter
Parameters:
entityID - na
Returns:
na

getAtGeneSearchAttributeList

public java.util.List getAtGeneSearchAttributeList()
Description copied from interface: GraphExporter
get all attributes in the AtGeneSearch application

Specified by:
getAtGeneSearchAttributeList in interface GraphExporter
Returns:
list of attribute name

getAtGeneSearchObject

public java.util.List getAtGeneSearchObject(java.lang.String affyId)
Description copied from interface: GraphExporter
get one data object based on the affyId

Specified by:
getAtGeneSearchObject in interface GraphExporter
Parameters:
affyId - the affyID regardless Affy25K or Affy8K. If there are multiple affyIDs, separate them by comma or semicolon
Returns:
a list of AtGeneSearchObject

eaGraphQuery

public edu.uci.ics.jung.graph.DirectedGraph eaGraphQuery(java.util.Collection gobiNodeList)
get the graph model from the node list

Parameters:
gobiNodeList - the node list
Returns:
the system subgraph model which contains all the nodes

getPathwayCategoryTree

public org.apache.commons.collections.map.MultiKeyMap getPathwayCategoryTree()
Description copied from interface: GraphExporter
get the adjacency list of pathway category tree. Suppose the tree is like "Pathways" > "Super-pathways" > "Amino acid biosynthesis", the multikey map contains entries like {key = ("Pathways", "Super-pathways"), value = 1} and {key = ("Super-pathways", "Amino acid biosynthesis"), value=1}. The directed acyclic graph represented by the adjacency list contains both category information and pathway information. The direction of the edge is always from the parent node in the DAG to the child node.

Specified by:
getPathwayCategoryTree in interface GraphExporter
Returns:
the adjacency list of pathway category tree.
See Also:
PathwayCategoryNode

getPathwayInfo

public java.util.Map getPathwayInfo(java.util.Collection pbidList)
Description copied from interface: GraphExporter
get the pathway information of

Specified by:
getPathwayInfo in interface GraphExporter
Parameters:
pbidList - the list of pathway blockid
Returns:
the map from blockid to the pathway info

findLiveEntityList

public java.util.Collection findLiveEntityList(boolean exactMatch,
                                               java.lang.String name,
                                               java.lang.String location,
                                               java.lang.String entityType)
Description copied from interface: GraphExporter
find the live entities according to the specified query condition

Specified by:
findLiveEntityList in interface GraphExporter
Parameters:
exactMatch - true if the name or synonym is exactly matched. false, if the name parameter can be a substring of the entity name or synonym
name - the search string, can be the full name or substring of the name.
location - subcellular compartment, can be null if not known
entityType - entity type like gene, metabolite, can be null if not known
Returns:
the blockunit object list

getAllLocationList

public java.util.Collection getAllLocationList()
Description copied from interface: GraphExporter
get all location in the database

Specified by:
getAllLocationList in interface GraphExporter
Returns:
the location in the database

findBlockunitInstance

public java.util.Map findBlockunitInstance(java.util.Collection blockIdList)
Description copied from interface: GraphExporter
get the blockunit map

Specified by:
findBlockunitInstance in interface GraphExporter
Parameters:
blockIdList - the id list
Returns:
the map of blockid=>blockunitobject

getPathwayElementMap

public org.apache.commons.collections.map.MultiKeyMap getPathwayElementMap()
Description copied from interface: GraphExporter
get the full mapping between the pathways and their elements

Specified by:
getPathwayElementMap in interface GraphExporter
Returns:
the collection of [pathway blockid (int), pathway name, pathway organism, entity blockid (int), entity name, entity location, entity organism, entityid (int), entity type, 1].

getPathwayLocusMap

public org.apache.commons.collections.map.MultiKeyMap getPathwayLocusMap()
Description copied from interface: GraphExporter
get the full map to pathway, locus and affy probe sets

Specified by:
getPathwayLocusMap in interface GraphExporter
Returns:
the collection of [pathway blockid (int), pathway name, pathway organism, gene blockid (int), gene name/locus name, gene location, gene organism, gene entity id (int), 'gene', affy25k id, affy8k id, 1].

getPathwayMetaboliteMap

public org.apache.commons.collections.map.MultiKeyMap getPathwayMetaboliteMap()
Description copied from interface: GraphExporter
get the map from pathway blockid to metabolite blockid

Specified by:
getPathwayMetaboliteMap in interface GraphExporter
Returns:
the collection of [pathway blockid (int), pathway name, pathway organism, metabolite blockid (int), metabolite name, metabolite location, metabolite organism, metabolite entity id (int), 'metabolite', 1].

getMetaboliteMap

public org.apache.commons.collections.map.MultiKeyMap getMetaboliteMap()
Description copied from interface: GraphExporter
get the map from metabolite blockid to name

Specified by:
getMetaboliteMap in interface GraphExporter
Returns:
the collection of [blockId (int), name, 1].

getFullGeneAnnotationList

public org.apache.commons.collections.map.MultiKeyMap getFullGeneAnnotationList()
Description copied from interface: GraphExporter
return all possible gene annnotation. The annotation is organized like ('ATMG00690', 'affy25k_id', '244906_at', 1), ('AT3G56800', 'go_term_proc', 'calcium-mediated signaling'), etc. The value of this map is always integer 1. The key is a 3-tuple. The first element is the locus ID, the second element is attribute, the third element is the corresponding value. In previous example, '244906_at' is the 'affy25k_id' of the locus 'ATMG00690', 'calcium-mediated signaling' is the 'go_term_proc' of the locus 'AT3G56800'. Here is all possible attributes:

Specified by:
getFullGeneAnnotationList in interface GraphExporter
Returns:
all possible gene annotation

getFullGeneAnnotationAttributeList

public java.util.List getFullGeneAnnotationAttributeList()
Description copied from interface: GraphExporter
get all attributes in function getFullGeneAnnotationList()

Specified by:
getFullGeneAnnotationAttributeList in interface GraphExporter
Returns:
all attributes in function getFullGeneAnnotationList()