diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index 1b22d70..f4acf42 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,5 +1,6 @@
+
diff --git a/pom.xml b/pom.xml
index d257285..dcd3ec2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
de.uni-rostock.sbi
BiVeS-Core
jar
- 1.9.5
+ 1.9.8
BiVeS-Core
1.6
diff --git a/src/main/java/de/unirostock/sems/bives/ds/graph/GraphTranslatorSbgnJson.java b/src/main/java/de/unirostock/sems/bives/ds/graph/GraphTranslatorSbgnJson.java
index 57fb391..45ed113 100644
--- a/src/main/java/de/unirostock/sems/bives/ds/graph/GraphTranslatorSbgnJson.java
+++ b/src/main/java/de/unirostock/sems/bives/ds/graph/GraphTranslatorSbgnJson.java
@@ -208,7 +208,7 @@ public String translate (ReactionNetwork rn)
//add compartments
for (ReactionNetworkCompartment c : rn.getCompartments ()){
String path = getPath(c.getA(), c.getB(), c.getModification());
- addCompartment(c.getId(), "null", c.getLabel(), c.getModification(), "SBO:0000290", path);
+ addCompartment(c.getId(), c.getOutsideCompartment(), c.getLabel(), c.getModification(), "SBO:0000290", path);
}
//add species
@@ -238,6 +238,35 @@ public String translate (ReactionNetwork rn)
String rPath = getPath(r.getA(), r.getB(), r.getModification());
+ //handle phenotypes
+ // no process node
+ // one or more modulation arcs
+ if (outputs.size() == 1) {
+ Collection outs = outputs;
+ ReactionNetworkSubstanceRef o = outs.iterator().next();
+
+ String sbo = "";
+ if(o.getSubstance().getB() != null) {
+ if(o.getSubstance().getB().getAttributeValue("sboTerm") != null)
+ sbo = o.getSubstance().getB().getAttributeValue("sboTerm");
+ } else if (o.getSubstance().getA() != null) {
+ if(o.getSubstance().getA().getAttributeValue("sboTerm") != null)
+ sbo = o.getSubstance().getA().getAttributeValue("sboTerm");
+ }
+
+
+ if(sbo.equals("SBO:0000358")) {
+ for(ReactionNetworkSubstanceRef i : inputs) {
+ //allways nec. stim.
+ addEdge(i.getSubstance().getId(), o.getSubstance().getId(), "SBO:0000171", i.getModification(), i.getXPath());
+ }
+ continue;
+
+ }
+
+
+ }
+
//add process Node
String processId = r.getId();
String compartmentId = null;
diff --git a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkCompartment.java b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkCompartment.java
index 690d9e2..6a5680d 100644
--- a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkCompartment.java
+++ b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkCompartment.java
@@ -23,10 +23,12 @@ public class ReactionNetworkCompartment
* @param labelB the label of that compartment in the modified document
* @param docA the original document
* @param docB the modified document
+ * @param outisdeA the compartment id of the containing compartment in the original document
+ * @param outisdeB the compartment id of the containing compartment in the modified document
*/
- public ReactionNetworkCompartment (ReactionNetwork rn, String labelA, String labelB, DocumentNode docA, DocumentNode docB)
+ public ReactionNetworkCompartment (ReactionNetwork rn, String labelA, String labelB, DocumentNode docA, DocumentNode docB, ReactionNetworkCompartment outsideA, ReactionNetworkCompartment outsideB)
{
- super ("c" + rn.getNextCompartmentID (), labelA, labelB, docA, docB);
+ super ("c" + rn.getNextCompartmentID (), labelA, labelB, docA, docB, outsideA, outsideB);
}
}
diff --git a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkEntity.java b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkEntity.java
index 85ba10b..52aec80 100644
--- a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkEntity.java
+++ b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkEntity.java
@@ -32,6 +32,12 @@ public abstract class ReactionNetworkEntity
/** The single doc flag if in single-doc-operation-mode. */
protected boolean singleDoc;
+ /** Id of the containing compartment in original document **/
+ protected ReactionNetworkCompartment outsideA;
+
+ /** Id of the containing compartment in original document **/
+ protected ReactionNetworkCompartment outsideB;
+
/**
* Instantiates a new entity.
*
@@ -40,8 +46,10 @@ public abstract class ReactionNetworkEntity
* @param labelB the label of that entity in the modified document
* @param docA the original document
* @param docB the modified document
+ * @param compartmentB
+ * @param compartmentA
*/
- public ReactionNetworkEntity (String entityId, String labelA, String labelB, DocumentNode docA, DocumentNode docB)
+ public ReactionNetworkEntity (String entityId, String labelA, String labelB, DocumentNode docA, DocumentNode docB, ReactionNetworkCompartment compartmentA, ReactionNetworkCompartment compartmentB)
{
this.id = entityId;
this.labelA = labelA;
@@ -49,6 +57,8 @@ public ReactionNetworkEntity (String entityId, String labelA, String labelB, Doc
this.docA = docA;
this.docB = docB;
singleDoc = false;
+ this.outsideA = compartmentA;
+ this.outsideB = compartmentB;
}
/**
@@ -91,6 +101,16 @@ public void setLabelB (String labelB)
this.labelB = labelB;
}
+ public void setOutsideA(ReactionNetworkCompartment compartmentA) {
+ this.outsideA = compartmentA;
+
+ }
+
+ public void setOutsideB(ReactionNetworkCompartment compartmentB) {
+ this.outsideB = compartmentB;
+ }
+
+
/**
* Gets the original document node.
*
@@ -157,6 +177,20 @@ public int getModification ()
return MODIFIED;
return UNMODIFIED;
}
+
+ public String getOutsideCompartment() {
+ if(outsideA == outsideB) {
+ if(outsideA == null) return null;
+ return outsideB.getId();
+ }
+ if(outsideA != null && outsideB != null)
+ return outsideB.getId();
+ if(outsideA == null && outsideB != null)
+ return outsideB.getId();
+ if(outsideA != null)
+ return outsideA.getId();
+ return null;
+ }
/**
* Sets the single document flag.
diff --git a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkReaction.java b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkReaction.java
index c83e3be..3bc61bb 100644
--- a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkReaction.java
+++ b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkReaction.java
@@ -51,7 +51,7 @@ public class ReactionNetworkReaction
*/
public ReactionNetworkReaction (ReactionNetwork rn, String labelA, String labelB, DocumentNode docA, DocumentNode docB, ReactionNetworkCompartment compartmentA, ReactionNetworkCompartment compartmentB, boolean reversible)
{
- super ("r" + rn.getNextReactionID (), labelA, labelB, docA, docB);
+ super ("r" + rn.getNextReactionID (), labelA, labelB, docA, docB, compartmentA, compartmentB);
in = new HashMap ();
out = new HashMap ();
mod = new Vector ();
@@ -213,17 +213,19 @@ public void addModA (ReactionNetworkSubstance subst, SBOTerm sbo, String xPath)
*
* @param subst the substance
* @param sbo the SBOTerm describing the interaction
+ * @throws BivesUnsupportedException when SBO terms don't match
*/
- public void addInputB (ReactionNetworkSubstance subst, SBOTerm sbo, String xPath)
+ public void addInputB (ReactionNetworkSubstance subst, SBOTerm sbo, String xPath) throws BivesUnsupportedException
{
ReactionNetworkSubstanceRef r = in.get (subst);
if (r == null)
try{
- in.put (subst, new ReactionNetworkSubstanceRef (subst, false, true, null, sbo, xPath)); //checken
+ in.put (subst, new ReactionNetworkSubstanceRef (subst, false, true, null, sbo, xPath));
}catch (BivesUnsupportedException e){}
else
{
r.setFlagB (true);
+ r.setSboB(sbo);
}
}
@@ -232,8 +234,9 @@ public void addInputB (ReactionNetworkSubstance subst, SBOTerm sbo, String xPath
*
* @param subst the substance
* @param sbo the SBOTerm describing the interaction
+ * @throws BivesUnsupportedException when sbo terms don't match
*/
- public void addOutputB (ReactionNetworkSubstance subst, SBOTerm sbo, String xPath)
+ public void addOutputB (ReactionNetworkSubstance subst, SBOTerm sbo, String xPath) throws BivesUnsupportedException
{
ReactionNetworkSubstanceRef r = out.get (subst);
if (r == null)
@@ -243,6 +246,7 @@ public void addOutputB (ReactionNetworkSubstance subst, SBOTerm sbo, String xPat
else
{
r.setFlagB (true);
+ r.setSboB(sbo);
}
}
diff --git a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkSubstance.java b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkSubstance.java
index 84a61a4..86bbcaf 100644
--- a/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkSubstance.java
+++ b/src/main/java/de/unirostock/sems/bives/ds/rn/ReactionNetworkSubstance.java
@@ -30,7 +30,7 @@ public class ReactionNetworkSubstance
*/
public ReactionNetworkSubstance (ReactionNetwork rn, String labelA, String labelB, DocumentNode docA, DocumentNode docB, ReactionNetworkCompartment compartmentA, ReactionNetworkCompartment compartmentB)
{
- super ("s" + rn.getNextSubstanceID (), labelA, labelB, docA, docB);
+ super ("s" + rn.getNextSubstanceID (), labelA, labelB, docA, docB, compartmentA, compartmentB);
this.compartmentA = compartmentA;
this.compartmentB = compartmentB;
singleDoc = false;
diff --git a/src/test/java/de/unirostock/sems/bives/TestGraphs.java b/src/test/java/de/unirostock/sems/bives/TestGraphs.java
index 9c4d5bc..54e7c9f 100644
--- a/src/test/java/de/unirostock/sems/bives/TestGraphs.java
+++ b/src/test/java/de/unirostock/sems/bives/TestGraphs.java
@@ -75,9 +75,9 @@ public ReactionNetworkCompartment addCompartment (DocumentNode node, String labe
{
ReactionNetworkCompartment compartment = null;
if (a)
- compartment = new ReactionNetworkCompartment (crn, label, null, node, null);
+ compartment = new ReactionNetworkCompartment (crn, label, null, node, null, null, null);
else
- compartment = new ReactionNetworkCompartment (crn, null, label, null, node);
+ compartment = new ReactionNetworkCompartment (crn, null, label, null, node, null, null);
crn.setCompartment (node, compartment);
return compartment;
@@ -183,8 +183,16 @@ public void testCrn ()
reaction1.setCompartmentB (compartment1);
reaction1.setLabelB ("reaction in A");
reaction1.setDocB (dummy);
- reaction1.addInputB (substrate1, null, null);
- reaction1.addOutputB (substrate1, null, null);
+ try {
+ reaction1.addInputB (substrate1, null, null);
+ reaction1.addOutputB (substrate1, null, null);
+ }
+ catch (BivesUnsupportedException e)
+ {
+ LOGGER.error (e, "this error wasn't expected!?");
+ fail ("this error wasn't expected!?");
+ }
+
assertEquals ("unexpected label in compartment", "compartment in A", compartment1.getLabel ());
assertEquals ("expected no modification", GraphEntity.UNMODIFIED, compartment1.getModification ());
@@ -209,8 +217,17 @@ public void testCrn ()
reaction1.setCompartmentB (compartment1);
reaction1.setLabelB ("reaction in N");
reaction1.setDocB (dummy);
- reaction1.addInputB (substrate1, null, null);
- reaction1.addOutputB (substrate1, null, null);
+
+ try
+ {
+ reaction1.addInputB (substrate1, null, null);
+ reaction1.addOutputB (substrate1, null, null);
+ }
+ catch (BivesUnsupportedException e)
+ {
+ LOGGER.error (e, "this error wasn't expected!?");
+ fail ("this error wasn't expected!?");
+ }
assertFalse ("unexpected label in compartment", "compartment in A".equals (compartment1.getLabel ()));
@@ -233,8 +250,17 @@ public void testCrn ()
reaction1.setCompartmentB (compartment2);
reaction1.setLabelB ("reaction in N");
reaction1.setDocB (dummy);
- reaction1.addInputB (substrate1, null, null);
- reaction1.addOutputB (substrate1, null, null);
+
+ try
+ {
+ reaction1.addInputB (substrate1, null, null);
+ reaction1.addOutputB (substrate1, null, null);
+ }
+ catch (BivesUnsupportedException e)
+ {
+ LOGGER.error (e, "this error wasn't expected!?");
+ fail ("this error wasn't expected!?");
+ }
assertFalse ("unexpected label in substrate", "substrate in A".equals (substrate1.getLabel ()));
@@ -263,8 +289,17 @@ public void testCrn ()
reaction1.setCompartmentB (compartment1);
reaction1.setLabelB ("reaction in A");
reaction1.setDocB (dummy);
- reaction1.addInputB (substrate1, null, null);
- reaction1.addOutputB (substrate1, null, null);
+
+ try
+ {
+ reaction1.addInputB (substrate1, null, null);
+ reaction1.addOutputB (substrate1, null, null);
+ }
+ catch (BivesUnsupportedException e)
+ {
+ LOGGER.error (e, "this error wasn't expected!?");
+ fail ("this error wasn't expected!?");
+ }
assertEquals ("unexpected label in compartment", "compartment in A", compartment1.getLabel ());
assertEquals ("expected no modification", GraphEntity.UNMODIFIED, compartment1.getModification ());
@@ -280,7 +315,16 @@ public void testCrn ()
// different i/o?
- reaction1.addInputB (substrate2, null, null);
+ try
+ {
+ reaction1.addInputB (substrate2, null, null);
+ }
+ catch (BivesUnsupportedException e)
+ {
+ LOGGER.error (e, "this error wasn't expected!?");
+ fail ("this error wasn't expected!?");
+ }
+
reaction1.addOutputA (substrate2, null, null);
assertEquals ("unexpected label in compartment", "compartment in A", compartment1.getLabel ());
assertEquals ("expected no modification", GraphEntity.UNMODIFIED, compartment1.getModification ());