|
From: <tra...@us...> - 2017-01-03 06:43:08
|
Revision: 703
http://sourceforge.net/p/sbfc/code/703
Author: tramy-nguyen
Date: 2017-01-03 06:43:06 +0000 (Tue, 03 Jan 2017)
Log Message:
-----------
Implemented custom annotation for BioPAX availability property
Modified Paths:
--------------
trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java
Modified: trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java
===================================================================
--- trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java 2017-01-03 05:54:23 UTC (rev 702)
+++ trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java 2017-01-03 06:43:06 UTC (rev 703)
@@ -662,7 +662,7 @@
//Hold the custom annotation for xref comment property
List<XMLNode> annotatedList = new ArrayList<XMLNode>();
- parseAnnotations(pathway, annotatedList);
+ parseAnnotations(pathway, "pathway", annotatedList);
if(annotatedList.size() > 0)
{
@@ -673,6 +673,22 @@
}
}
}
+ if(pathway.getAvailability() != null && !pathway.getAvailability().isEmpty()){
+ //Hold the custom annotation for xref comment property
+ List<XMLNode> annotatedList = new ArrayList<XMLNode>();
+
+ parseAvailability(pathway, "pathway", annotatedList);
+
+ if(annotatedList.size() > 0)
+ {
+ XMLNode customNode = createCustomBiopaxAnnotation(sbmlModel);
+ for(XMLNode node: annotatedList)
+ {
+ customNode.addChild(node);
+ }
+ }
+ }
+
}
else
{
@@ -705,18 +721,18 @@
* @param annotatedList - An empty list of XMLNode to store the SBML annotations in.
* @return
*/
- private List<XMLNode> parseAnnotations(Entity entity, List<XMLNode> annotatedList)
+ private List<XMLNode> parseAnnotations(Entity entity, String entityType, List<XMLNode> annotatedList)
{
//TODO: Find annotations example for this method.
if(entity.getAnnotations() != null && entity.getAnnotations().size() > 0)
{
- for(String annotKey : entity.getAnnotations().keySet())
+ XMLNode xrefNode = createAnnotatedObject(entityType, entity.getRDFId());
+ XMLNode commentNode = createAnnotatedProperty("annotations");
+ xrefNode.addChild(commentNode);
+ for(Object annotObj : entity.getAnnotations().values())
{
- XMLNode xrefNode = createAnnotatedObject("Pathway", annotKey);
- XMLNode commentNode = createAnnotatedProperty("annotations");
- xrefNode.addChild(commentNode);
-
- String annotValue = entity.getAnnotations().get(annotKey).toString();
+ //TODO: Note, this will ignore all annotation key.
+ String annotValue = annotObj.toString();
commentNode.addChild(createAnnotatedValue(annotValue));
annotatedList.add(xrefNode);
@@ -726,6 +742,25 @@
return annotatedList;
}
+
+ private List<XMLNode> parseAvailability(Entity entity, String entityType, List<XMLNode> annotatedList)
+ {
+ //TODO: Find example for this method.
+ if(entity.getAvailability() != null && entity.getAvailability().size() > 0)
+ {
+ XMLNode xrefNode = createAnnotatedObject(entityType, entity.getRDFId());
+ XMLNode commentNode = createAnnotatedProperty("availability");
+ xrefNode.addChild(commentNode);
+ for(String availability : entity.getAvailability())
+ {
+ commentNode.addChild(createAnnotatedValue(availability));
+ }
+ annotatedList.add(xrefNode);
+ }
+
+ return annotatedList;
+
+ }
/**
* Convert a list of pathway components to its corresponding SBML Elements.
@@ -1345,10 +1380,25 @@
parseEvidence(entity.getEvidence(), sbmlSpecies);
}
if(entity.getAnnotations() != null && !entity.getAnnotations().isEmpty()){
+
+ List<XMLNode> annotatedList = new ArrayList<XMLNode>();
+
+ parseAnnotations(entity, "PhysicalEntity", annotatedList);
+
+ if(annotatedList.size() > 0)
+ {
+ XMLNode customNode = createCustomBiopaxAnnotation(sbmlSpecies);
+ for(XMLNode node: annotatedList)
+ {
+ customNode.addChild(node);
+ }
+ }
+ }
+ if(entity.getAvailability() != null && !entity.getAvailability().isEmpty()){
//Hold the custom annotation for xref comment property
List<XMLNode> annotatedList = new ArrayList<XMLNode>();
- parseAnnotations(entity, annotatedList);
+ parseAvailability(entity, "PhysicalEntity", annotatedList);
if(annotatedList.size() > 0)
{
@@ -2054,6 +2104,37 @@
{
parseXref(control.getXref(), modifierSpecies);
}
+ if(control.getAnnotations() != null && !control.getAnnotations().isEmpty()){
+
+ List<XMLNode> annotatedList = new ArrayList<XMLNode>();
+
+ parseAnnotations(control, "ControlInteractions", annotatedList);
+
+ if(annotatedList.size() > 0)
+ {
+ XMLNode customNode = createCustomBiopaxAnnotation(modifierSpecies);
+ for(XMLNode node: annotatedList)
+ {
+ customNode.addChild(node);
+ }
+ }
+ }
+ if(control.getAvailability() != null && !control.getAvailability().isEmpty()){
+
+ List<XMLNode> annotatedList = new ArrayList<XMLNode>();
+
+ parseAvailability(control, "ControlInteraction", annotatedList);
+
+ if(annotatedList.size() > 0)
+ {
+ XMLNode customNode = createCustomBiopaxAnnotation(modifierSpecies);
+ for(XMLNode node: annotatedList)
+ {
+ customNode.addChild(node);
+ }
+ }
+ }
+
}
}
}
@@ -2400,7 +2481,37 @@
{
parseEvidence(entity.getEvidence(), reaction);
}
+ if(entity.getAnnotations() != null && !entity.getAnnotations().isEmpty()){
+
+ List<XMLNode> annotatedList = new ArrayList<XMLNode>();
+ parseAnnotations(entity, "Interactions", annotatedList);
+
+ if(annotatedList.size() > 0)
+ {
+ XMLNode customNode = createCustomBiopaxAnnotation(reaction);
+ for(XMLNode node: annotatedList)
+ {
+ customNode.addChild(node);
+ }
+ }
+ }
+ if(entity.getAvailability() != null && !entity.getAvailability().isEmpty()){
+ //Hold the custom annotation for xref comment property
+ List<XMLNode> annotatedList = new ArrayList<XMLNode>();
+
+ parseAvailability(entity, "Interaction", annotatedList);
+
+ if(annotatedList.size() > 0)
+ {
+ XMLNode customNode = createCustomBiopaxAnnotation(reaction);
+ for(XMLNode node: annotatedList)
+ {
+ customNode.addChild(node);
+ }
+ }
+ }
+
return reaction;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|