This is a second example. The following function extracts the metabolite regulation network.
/**
* Given an organism, this function extracts the metabolic regulation network
* Foreach enzymaticreaction, extract the metabolites that inhibits/activates the enzyme
* @param orgid
* @param keySession
* @return
*/
private static Graphml getGraphml(String orgid,String keySession){
Graphml myGraphml = null;
ObjectFactory myObjectFactory = new ObjectFactory();
Graph myGraph = null;
HashMap myNodes = new HashMap();
HashMap myEdges = new HashMap();
try
{
myGraphml = myObjectFactory.createGraphml();
myGraphml.setDesc("Hard coded desc Ecoli.metabolicRegulation.network.graphml.xml");
myGraph = myObjectFactory.createGraph();
myGraph.setId("mr");
myGraph.setParseOrder(TypeGraphOrderType.FREE);
myGraph.setEdgedefault(TypeGraphEdgedefaultType.DIRECTED);
myGraphml.getGraphOrData().add(myGraph);
Key myKeyNodeType = myObjectFactory.createKey();
myKeyNodeType.setId("NodeType");
myKeyNodeType.setFor(TypeKeyForType.NODE);
myKeyNodeType.setAttrName("nodetype");
myKeyNodeType.setAttrType(TypeKeyTypeType.STRING);
myGraphml.getKey().add(myKeyNodeType);
Key myKeyEdgeType = myObjectFactory.createKey();
myKeyEdgeType.setId("regulation");
myKeyEdgeType.setFor(TypeKeyForType.NODE);
myKeyEdgeType.setAttrName("regulationtype");
myKeyEdgeType.setAttrType(TypeKeyTypeType.STRING);
myGraphml.getKey().add(myKeyEdgeType);
EnzymaticReactionsDao cdao = new EnzymaticReactionsDao(keySession);
List myEnzymaticReactions = cdao.getListAllObjects(orgid);
String framerxn;
String myFrameActivator, myFrameInhibitor;
int i=0;
for(EnzymaticReactions myEnzymaticReaction : myEnzymaticReactions){
framerxn = ((Reaction)myEnzymaticReaction.getReaction().get(0)).getValue();
List myActivators = myEnzymaticReaction.getActivatorsAll();
for(ActivatorsAll myActivatorsAll :myActivators){
myFrameActivator = myActivatorsAll.getValue();
Node myNodeRxn = getNode(myGraph,framerxn,myNodes, myKeyNodeType, "rxn");
Node myNodeMet = getNode(myGraph,myFrameActivator,myNodes, myKeyNodeType, "metabolite");
String edgeName = myNodeMet.getId()+"_"+myNodeRxn.getId();
Edge myEdge = getEdge(myGraph,edgeName,myEdges,myKeyEdgeType,"active");
myEdge.setSource(myNodeMet);
myEdge.setTarget(myNodeRxn);
}
List myInhibitorsAlls = myEnzymaticReaction.getInhibitorsAll();
for(InhibitorsAll myInhibitorsAll :myInhibitorsAlls){
myFrameInhibitor = myInhibitorsAll.getValue();
Node myNodeRxn = getNode(myGraph,framerxn,myNodes, myKeyNodeType, "rxn");
Node myNodeMet = getNode(myGraph,myFrameInhibitor,myNodes, myKeyNodeType, "metabolite");
String edgeName = myNodeMet.getId()+"_"+myNodeRxn.getId();
Edge myEdge = getEdge(myGraph,edgeName,myEdges,myKeyEdgeType,"inhibe");
myEdge.setSource(myNodeMet);
myEdge.setTarget(myNodeRxn); }
// if(i==10){ break;}else{i++;}
}
myGraph.setParseNodes(BigInteger.valueOf(myNodes.size()));
myGraph.setParseEdges(BigInteger.valueOf(myEdges.size()));
System.out.println(myEdges.size());
} catch (JAXBException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return myGraphml;
}
The output graphs visualized in Cytoscape are shown below.
This is the metabolite regulatory network extracted from EcoCyc representing by the
'spring' graph layout algorithm of Cytoscape. Metabolite can act as regulators of enzymatic activity. Metabolite and reaction are representing by node. An arrow starting from a metabolite node indicates that this metabolite regulates the targeted enzymatic reaction node by inhibition or activation.
This is a zoom on the regulated metabolic network extracted from EcoCyc.
|