|
From: <tra...@us...> - 2016-08-08 08:11:38
|
Revision: 690
http://sourceforge.net/p/sbfc/code/690
Author: tramy-nguyen
Date: 2016-08-08 08:11:35 +0000 (Mon, 08 Aug 2016)
Log Message:
-----------
- updated jsbml jar to use SBO terms: thermodynamic temperature, pH, and ionic strength to use in BioPAX2SBML
- modified implementation of complexComponent
- implemented pathway with control properties to get pathway.getController()
- modified implementation to get cellularLocation when given a uri
- Fixed parsing of sbml modifier in SBML2BioPAX in order for Control Interaction to get created correctly.
- Fixed implementation for parsing Stoichiometry values in SBML2BioPAX.
- Fixed implementation for parsing localParameter in SBML2BioPAX.
- removed implemenation for setting entityReference in SBML2BioPAX for SimplePhysicalEntity since this property will later on be implemented using sbml group
- moved all test cases in InteractionTest.java and PhysicalEntityTests.java that parses owl files into its own seperate class called TestOWLFiles.java
- Implemented a sbml file reader class that will test all sbml files that are used to be converted in SBML2BioPAX.
Modified Paths:
--------------
trunk/lib/jsbml-1.2-SNAPSHOT-with-dependencies.jar
trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java
trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXConverter.java
trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXUtilities.java
trunk/test/org/sbfc/test/biopax2sbml/InteractionTests.java
trunk/test/org/sbfc/test/biopax2sbml/PhysicalEntityTests.java
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/biopax3-genetic-interaction.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/biopax3-phosphorylation-reaction.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/biopax3-template-reaction.xml
trunk/test/org/sbfc/test/sbml2biopax/outputFiles/biopax3-genetic-interaction.owl
trunk/test/org/sbfc/test/sbml2biopax/outputFiles/biopax3-template-reaction.owl
Added Paths:
-----------
trunk/test/org/sbfc/test/biopax2sbml/TestOWLFiles.java
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/AKT_Signaling_Pathway.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/biopax3-protein-interaction.xml
trunk/test/org/sbfc/test/resources/GeneticToggleSBML.owl
trunk/test/org/sbfc/test/resources/GeneticToggleSBML.xml
trunk/test/org/sbfc/test/sbml2biopax/TestSBMLFiles.java
trunk/test/org/sbfc/test/sbml2biopax/outputFiles/GeneticToggleSBML.owl
trunk/test/org/sbfc/test/sbml2biopax/outputFiles/biopax3-protein-interaction.owl
Removed Paths:
-------------
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/Pathway_419e1aa2f2de4f2a58ab73b85f793b0d.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/Pathway_42cda92147931e8046e0fcc6a85509ab.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/Pathway_79a3ef254eed2ebacee98d13e786cabf.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/Pathway_ccad983a29165136d58be22f22d7a89b.xml
trunk/test/org/sbfc/test/biopax2sbml/outputFiles/Pathway_ee87a6828a38006fc572f6c644975d9d.xml
trunk/test/org/sbfc/test/sbml2biopax/ReadingSBMLFileTests.java
Modified: trunk/lib/jsbml-1.2-SNAPSHOT-with-dependencies.jar
===================================================================
(Binary files differ)
Modified: trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java
===================================================================
--- trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java 2016-08-06 05:29:39 UTC (rev 689)
+++ trunk/src/org/sbfc/converter/biopax2sbml/BioPAX2SBML.java 2016-08-08 08:11:35 UTC (rev 690)
@@ -38,6 +38,7 @@
import org.biopax.paxtools.model.level3.BiochemicalPathwayStep;
import org.biopax.paxtools.model.level3.BiochemicalReaction;
import org.biopax.paxtools.model.level3.Catalysis;
+import org.biopax.paxtools.model.level3.CatalysisDirectionType;
import org.biopax.paxtools.model.level3.CellularLocationVocabulary;
import org.biopax.paxtools.model.level3.Complex;
import org.biopax.paxtools.model.level3.ComplexAssembly;
@@ -76,6 +77,7 @@
import org.biopax.paxtools.model.level3.UnificationXref;
import org.biopax.paxtools.model.level3.Xref;
import org.identifiers.registry.RegistryLocalProvider;
+import org.identifiers.registry.RegistryUtilities;
import org.sbfc.converter.biopaxL3converter.BioPAX2BioPAXL3;
import org.sbfc.converter.exceptions.ConversionException;
import org.sbfc.converter.exceptions.ReadModelException;
@@ -141,7 +143,7 @@
/** Map biopax entity RDFId to the sbml sbase object */
private Map<String, SBase> mappedEntities;
-
+
/** Map the biopax RDFId to the list of Reactions that were split (i.e. A catalysis direction that did not match its controlled interaction direction)*/
private Map<String, List<SBase>> mappedSplitReactions;
@@ -202,7 +204,7 @@
//Store the mapping between biopax enties rdfId to the sbml object created for the corresponding biopax entity
mappedEntities = new HashMap<String, SBase>();
mappedSplitReactions = new HashMap<String, List<SBase>>();
-
+
SBMLDocument sbmlDoc = new SBMLDocument(sbmlLevel, sbmlVer);
SBMLModel biopaxSBMLModel = new SBMLModel(sbmlDoc);
@@ -225,12 +227,12 @@
* first before parsing other biopax entities.
*/
org.sbml.jsbml.Model sbmlModel = parsePathways(bioModel, sbmlDoc);
-
+
addSBMLHistory(sbmlModel, sbmlOrganization);
addSBMLNotes(sbmlModel, "This model has been automatically generated by BioPAX2SBML");
//TODO: throw conversionException if invalid sbml file?
- validateSBMLFile(sbmlDoc);
+ // validateSBMLFile(sbmlDoc);
return biopaxSBMLModel;
}
@@ -262,6 +264,8 @@
private void mappAllEntities(org.biopax.paxtools.model.Model bioModel) throws ConversionException
{
+ Set<Complex> complexList = bioModel.getObjects(Complex.class);
+
for (Gene gene : bioModel.getObjects(Gene.class))
{
mappedEntities.put(gene.getRDFId(), parseEntity(gene));
@@ -285,7 +289,19 @@
}
}
}
+ /*
+ * Note: Complex has a property called complex.getComponent() that requires
+ * a complexAssembly reaction to be created. For that reason, after all species
+ * are created from biopax entities, parse the complex.getComponent() to create
+ * the complexAssembly reaction to ensure that the SpeciesReference are created with
+ * the species that were created.
+ */
+ for(Complex complex : complexList)
+ {
+ parseComplexComponent(complex);
+ }
+
/*
* Note: Collect all biopax interaction types to parse after iterating through all entities.
* This will ensure that species are created first from PhysicalEntities and any Entites that
@@ -354,15 +370,29 @@
}
}
}
- //TODO:
- /*
- * First look for examples for this example
- * Loop over all controller and check if each controller has a the same id as the pathway id
- * If so, then loop over all the controlled within the biomodel and add reaction to this pathway
- *
- */
+
+ boolean isControllerPathway = false;
+ for(Controller controllerEntity : pathwayControl.getController())
+ {
+ if(controllerEntity.getRDFId().equals(pathway.getRDFId()))
+ {
+ isControllerPathway = true;
+ break;
+ }
+ }
+ if(isControllerPathway)
+ {
+ for(org.biopax.paxtools.model.level3.Process controlled : pathwayControl.getControlled())
+ {
+ if(controlled instanceof PhysicalEntity)
+ {
+ Reaction controlledReaction = (Reaction) mappedEntities.get(controlled.getRDFId());
+ addReaction(controlledReaction.getId(), subModel);
+ }
+ }
+ }
}
-
+
Submodel s = compModel.createSubmodel("submodel__" + subModel.getId());
s.setModelRef(subModel.getId());
}
@@ -483,7 +513,7 @@
}
}
}
-
+
private void addReaction(String reactionId, org.sbml.jsbml.Model sbmlModel) throws ConversionException
{
Reaction reaction = (Reaction) getSBaseFromSBMLId(reactionId);
@@ -492,7 +522,7 @@
sbmlModel.addReaction(reaction.clone());
}
}
-
+
/**
* Convert a biopax pathway to its equivalent SBML Model
*
@@ -517,8 +547,8 @@
{
parsePathwayStep(pathway.getPathwayOrder(), sbmlModel);
}
-
+
//Add SBML annotation for biopax pathway
if(pathway.getXref() != null && !pathway.getXref().isEmpty())
{
@@ -555,7 +585,7 @@
parsePathwayComponent(entity, sbmlModel);
}
}
-
+
private void parsePathwayComponent(Entity entity, org.sbml.jsbml.Model sbmlModel) throws ConversionException
{
if(entity instanceof Interaction)
@@ -656,10 +686,12 @@
private org.sbml.jsbml.Model createSBMLModel(Pathway pathway, SBMLDocument sbmlDoc)
{
// Convert biopax pathway to sbml model
- org.sbml.jsbml.Model sbmlModel;
- if (pathway==null) {
+ org.sbml.jsbml.Model sbmlModel;
+ if (pathway==null)
+ {
sbmlModel = sbmlDoc.createModel();
- } else {
+ } else
+ {
CompSBMLDocumentPlugin compDoc = (CompSBMLDocumentPlugin) sbmlDoc.getPlugin(CompConstants.shortLabel);
sbmlModel = compDoc.createModelDefinition();
}
@@ -824,7 +856,7 @@
{
String xrefName = xref.getDb();
String xrefId = xref.getId();
-
+
//Look for MIRIAM URL with this xref
String miriamFullURI = link.getURI(xrefName, xrefId);
@@ -866,31 +898,7 @@
private Species parseEntity(Entity entity) throws ConversionException
{
Species sbmlSpecies = createSpecies(entity);
- if(entity instanceof Complex)
- {
- Complex complex = (Complex) entity;
- if(complex.getComponent().size() > 0)
- {
- //TODO
- complex.getComponentStoichiometry(); //stoichiometry for reactants
- //complex; //product of complexAssembly reaction
- //complexAssembly sbo term becomes this new reaction complex Assembly SBO term
- //complex.getComponent() becomes reatants of this complex Assembly
- BioPAXFactory bioPAXFactory = BioPAXLevel.L3.getDefaultFactory();
- ComplexAssembly complexAssembly = bioPAXFactory.create(ComplexAssembly.class, "ComplexAssembly_forComplexParticipant" + complex.getRDFId());
- Reaction caReaction = createReaction(complexAssembly);
-
- SpeciesReference product = createSpeciesReferences(complex);
- caReaction.addProduct(product.clone());
-
- ListOf<SpeciesReference> reactantList = getSpeciesReferences(complex.getComponent(), complex.getComponentStoichiometry());
- caReaction.setListOfReactants(reactantList);
-
- sbmlId2biopaxId.put(caReaction.getId(), complexAssembly.getRDFId());
- mappedEntities.put(complexAssembly.getRDFId(), caReaction);
- }
- }
-
+
//Add SBO terms to species
if (entity instanceof PhysicalEntity)
{
@@ -904,6 +912,26 @@
return sbmlSpecies;
}
+ private void parseComplexComponent(Complex complex) throws ConversionException
+ {
+ if(complex.getComponent().size() > 0)
+ {
+ BioPAXFactory bioPAXFactory = BioPAXLevel.L3.getDefaultFactory();
+ ComplexAssembly complexAssembly = bioPAXFactory.create(ComplexAssembly.class, "ComplexAssembly_forComplexParticipant_" + complex.getRDFId());
+ Reaction caReaction = createReaction(complexAssembly);
+ caReaction.setReversible(false);
+ SpeciesReference product = createSpeciesReferences(complex);
+ caReaction.addProduct(product.clone());
+
+ ListOf<SpeciesReference> reactantList = getSpeciesReferences(complex.getComponent(), complex.getComponentStoichiometry());
+ caReaction.setListOfReactants(reactantList);
+
+ sbmlId2biopaxId.put(caReaction.getId(), complexAssembly.getRDFId());
+ mappedEntities.put(complexAssembly.getRDFId(), caReaction);
+ }
+
+ }
+
private void parseEvidence(Set<Evidence> evidenceList, SBase sbmlElement)
{
List<CVTerm> evidenceCode_cvterms = new ArrayList<CVTerm>();
@@ -1201,10 +1229,10 @@
{
String cellLocId = physicalEntity.getCellularLocation().getRDFId();
String compartmentId = null;
-
+
if(cellLocId.contains("http://identifiers.org/"))
{
- compartmentId = replaceInvalidSBMLcharId(parseCellularLocationURL(cellularLocVocab));
+ compartmentId = parseCellularLocationURL(cellularLocVocab);
}
else
{
@@ -1252,14 +1280,29 @@
private String parseCellularLocationURL(CellularLocationVocabulary cellLocVocab)
{
- String compartmentId = getValidSBMLName(cellLocVocab);
-
- String cellLocOfficialURI = link.getMiriamURI(cellLocVocab.getRDFId());
+ String compartmentId = null;
+
+ //Update this compartment uri with the latest uri it the uri is deprecated.
+ String cellLocOfficialURI = link.getMiriamURI(cellLocVocab.getRDFId());
+
if(cellLocOfficialURI != null)
{
- compartmentId = ontology.getTerm(cellLocOfficialURI).getName();
+ String ontologyId = RegistryUtilities.getElementPart(cellLocOfficialURI);
+ if(ontologyId != null)
+ {
+ /*
+ * Note: getting the name for the ontology term contains spaces so replace invalid characters within the ontology term name
+ */
+ compartmentId = replaceInvalidSBMLcharId(ontology.getTerm(ontologyId).getName());
+ }
}
+ if(compartmentId == null)
+ {
+ //http://identifiers.org/go/
+ String temp = cellLocVocab.getRDFId().replace("http://identifiers.org/go/", "");
+ compartmentId = replaceInvalidSBMLcharId(temp);
+ }
return compartmentId;
}
@@ -1357,7 +1400,7 @@
if (entity instanceof TemplateReaction)
{
parseTemplateReaction((TemplateReaction) entity, reaction);
-
+
}
else if (entity instanceof MolecularInteraction)
{
@@ -1379,7 +1422,7 @@
{
boolean hasModifier = false;
boolean hasProduct = false; templateReaction.getTemplateDirection();
-
+
if(templateReaction.getTemplateDirection() == TemplateDirectionType.FORWARD)
{
reaction.setReversible(false);
@@ -1392,7 +1435,7 @@
{
reaction.setReversible(false);
}
-
+
if(templateReaction.getTemplate() != null)
{
ModifierSpeciesReference modifierSpeciesRef = createModifierSpeciesReference(templateReaction.getTemplate());
@@ -1522,8 +1565,7 @@
}
else
{
- //TODO: what happens when no direction is found? Assume reversible?
- reaction.setReversible(true);
+ reaction.setReversible(false);
//Parse for reactant/substrate
ListOf<SpeciesReference> reactants = getSpeciesReferences(conversion.getLeft(), conversion.getParticipantStoichiometry());
@@ -1534,9 +1576,15 @@
reaction.setListOfProducts(products);
}
+
+ if(conversion instanceof BiochemicalReaction)
+ {
+ BiochemicalReaction biochemicalReaction = (BiochemicalReaction) conversion;
+ biochemicalReaction.getECNumber(); //TODO: Look at circadian_clock.owl example for term eCNumber
+ }
setConversion_SBO(conversion, reaction);
-
+
sbmlId2biopaxId.put(reaction.getId(), conversion.getRDFId());
mappedEntities.put(conversion.getRDFId(), reaction);
}
@@ -1598,8 +1646,10 @@
for(org.biopax.paxtools.model.level3.Process catalysisControlled : catalysis.getControlled())
{
Conversion controlled = (Conversion) catalysisControlled;
-
+
/*
+ * TODO: need to find real file cases on how this works
+ *
* Note:
* Special case when the catalysisDirection and the controlledReaction is not the same, perform the following:
* Quoted from Chris Myers,
@@ -1607,61 +1657,22 @@
* Split the Reversible reaction for this interaction into two irreversible reactions
* and the Catalyst would appear as a Modifier in only the reaction that matches the CatalysisDirection."
*/
-// if(controlled.getConversionDirection() == ConversionDirectionType.LEFT_TO_RIGHT &&
-// catalysis.getCatalysisDirection() != CatalysisDirectionType.LEFT_TO_RIGHT)
-// {
-// //TODO:
-// String reaction_prefixId = controlledReaction.getId();
-// List<SBase> splitReactions = new ArrayList<SBase>();
-//
-// Reaction forwardReaction = controlledReaction.clone();
-// forwardReaction.setId(reaction_prefixId + "_forwardReaction");
-// forwardReaction.setReversible(false);
-// splitReactions.add(forwardReaction);
-//
-// Reaction reverseReaction = controlledReaction.clone();
-// reverseReaction.setId(reaction_prefixId + "_reverseReaction");
-// reverseReaction.setReversible(false);
-// reverseReaction.addModifier(modifierSpecies);
-// splitReactions.add(reverseReaction);
-//
-// mappedSplitReactions.put(catalysis.getRDFId(), splitReactions);
-//
-// ListOf<SpeciesReference> reactants = controlledReaction.getListOfProducts();
-// ListOf<SpeciesReference> products = controlledReaction.getListOfReactants();
-//
-// for(int index = 0; index < controlledReaction.getNumReactants(); index++)
-// {
-// controlledReaction.removeReactant(index);
-// }
-// for(int index = 0; index < controlledReaction.getNumProducts(); index++)
-// {
-// controlledReaction.removeProduct(index);
-// }
-//
-// for(SpeciesReference r : reactants)
-// {
-// controlledReaction.addReactant(r);
-// }
-// for(SpeciesReference p : products)
-// {
-// controlledReaction.addProduct(p);
-// }
-// }
-// else if(controlled.getConversionDirection() == ConversionDirectionType.RIGHT_TO_LEFT &&
-// catalysis.getCatalysisDirection() != CatalysisDirectionType.RIGHT_TO_LEFT)
-// {
-// //TODO:
-// }
-// else if(controlled.getConversionDirection() == ConversionDirectionType.REVERSIBLE &&
-// catalysis.getCatalysisDirection() == CatalysisDirectionType.RIGHT_TO_LEFT)
-// {
-// //TODO:
-// }
+ if(controlled.getConversionDirection() == ConversionDirectionType.REVERSIBLE &&
+ catalysis.getCatalysisDirection() == CatalysisDirectionType.LEFT_TO_RIGHT)
+ {
+ String reaction_prefixId = controlledReaction.getId();
+
+ Reaction forwardReaction = controlledReaction.clone();
+ forwardReaction.setId(reaction_prefixId + "_forwardReaction");
+ forwardReaction.setReversible(false);
+ forwardReaction.addModifier(modifierSpecies);
+
+ Reaction reverseReaction = controlledReaction.clone();
+ reverseReaction.setId(reaction_prefixId + "_reverseReaction");
+ reverseReaction.setReversible(false);
+ }
}
-
- catalysis.getCatalysisDirection(); //TODO: need to find real file cases on how this works
-
+
}
setControl_SBO(control, modifierSpecies);
@@ -1688,13 +1699,13 @@
kineticLaw.setMath(new ASTNode(Double.NaN));
int count = 0;
for(DeltaG deltaG : biochemReaction.getDeltaG())
- {
+ {
String prefix = getValidSBMLId(deltaG) + "_";
addLocalParameter(prefix + "deltaGPrime0", kineticLaw, deltaG.getDeltaGPrime0(), SBO.getGibbsFreeEnergyChange());
- addLocalParameter(prefix + "deltaGIonicStrength", kineticLaw, deltaG.getIonicStrength(), SBO.getGibbsFreeEnergyChange());
- addLocalParameter(prefix + "deltaGPh", kineticLaw, deltaG.getPh(), SBO.getGibbsFreeEnergyChange());
+ addLocalParameter(prefix + "deltaGIonicStrength", kineticLaw, deltaG.getIonicStrength(), SBO.getIonicStrength());
+ addLocalParameter(prefix + "deltaGPh", kineticLaw, deltaG.getPh(), SBO.getpH());
addLocalParameter(prefix + "deltaGPMg", kineticLaw, deltaG.getPMg(), SBO.getGibbsFreeEnergyChange());
- addLocalParameter(prefix + "deltaGTemperature", kineticLaw, deltaG.getTemperature(), SBO.getGibbsFreeEnergyChange());
+ addLocalParameter(prefix + "deltaGTemperature", kineticLaw, deltaG.getTemperature(), SBO.getThermodynamicTemperature());
}
for(Float deltaH : biochemReaction.getDeltaH())
{
@@ -1708,13 +1719,13 @@
{
String prefix = getValidSBMLId(kprime) + "_";
addLocalParameter(prefix + "KPrime", kineticLaw, kprime.getKPrime(), SBO.getEquilibriumConstant());
- addLocalParameter(prefix + "KPrimeIonicStrength", kineticLaw, kprime.getIonicStrength(), SBO.getEquilibriumConstant());
- addLocalParameter(prefix + "KPrimePh", kineticLaw, kprime.getPh(), SBO.getEquilibriumConstant());
+ addLocalParameter(prefix + "KPrimeIonicStrength", kineticLaw, kprime.getIonicStrength(), SBO.getIonicStrength());
+ addLocalParameter(prefix + "KPrimePh", kineticLaw, kprime.getPh(), SBO.getpH());
addLocalParameter(prefix + "KPrimeMg", kineticLaw, kprime.getPMg(), SBO.getEquilibriumConstant());
- addLocalParameter(prefix + "KPrimeTemperature", kineticLaw, kprime.getTemperature(), SBO.getEquilibriumConstant());
+ addLocalParameter(prefix + "KPrimeTemperature", kineticLaw, kprime.getTemperature(), SBO.getThermodynamicTemperature());
}
}
-
+
/**
* Creates a LocalParameter to attach to a KineticLaw
*
@@ -1726,7 +1737,7 @@
*/
private LocalParameter addLocalParameter(String id, KineticLaw kineticLaw, double value, int SBOvalue)
{
- LocalParameter localParam = kineticLaw.createLocalParameter(id);
+ LocalParameter localParam = kineticLaw.createLocalParameter(id);
localParam.setSBOTerm(SBOvalue);
localParam.setValue(value);
return localParam;
Modified: trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXConverter.java
===================================================================
--- trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXConverter.java 2016-08-06 05:29:39 UTC (rev 689)
+++ trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXConverter.java 2016-08-08 08:11:35 UTC (rev 690)
@@ -4,6 +4,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.biopax.paxtools.impl.level3.StoichiometryImpl;
+import org.biopax.paxtools.model.BioPAXFactory;
+import org.biopax.paxtools.model.BioPAXLevel;
import org.biopax.paxtools.model.Model;
import org.biopax.paxtools.model.level3.Catalysis;
import org.biopax.paxtools.model.level3.Complex;
@@ -48,12 +50,6 @@
public Model convert(SBMLDocument sbmlDocument)
{
- return convert2(sbmlDocument);
- }
-
-
- private Model convert2(SBMLDocument sbmlDocument) {
-
org.sbml.jsbml.Model sbmlTopLevelModel = sbmlDocument.getModel();
log.debug("First thing first: create a BioPAX model");
@@ -139,18 +135,29 @@
Model bpModel, Interaction interaction, Pathway pathway)
{
ListOf<ModifierSpeciesReference> listOfModifiers = reaction.getListOfModifiers();
+
for(ModifierSpeciesReference modifier : listOfModifiers)
{
+ Species species = sbmlModel.getSpecies(modifier.getSpecies());
+
if(interaction instanceof GeneticInteraction)
{
- Species species = sbmlModel.getSpecies(modifier.getSpecies());
Gene gene = sbml2BioPAXUtilities.convertSpeciesToE(bpModel, Gene.class, UnificationXref.class, species);
interaction.addParticipant(gene);
+ continue;
}
- else if(interaction instanceof TemplateReaction)
+
+ //Control could only be Modulation, TemplateReactionRegulation, or any other Control Interaction
+ Control control = sbml2BioPAXUtilities.convertModifier(bpModel, modifier, reaction);
+
+ pathway.addPathwayComponent(control);
+ control.addControlled(interaction);
+ Controller controller = (Controller) sbml2BioPAXUtilities.convertSpecies(bpModel, species);
+ control.addController(controller);
+
+ if(interaction instanceof TemplateReaction)
{
TemplateReaction templateReaction = (TemplateReaction) interaction;
- Species species = sbmlModel.getSpecies(modifier.getSpecies());
Entity entity = (Entity) sbml2BioPAXUtilities.convertSpecies(bpModel, species);
if(entity instanceof Dna || entity instanceof DnaRegion
|| entity instanceof Rna || entity instanceof RnaRegion)
@@ -164,7 +171,6 @@
Catalysis catalysis = (Catalysis) interaction;
if(modifier.getSBOTerm() == SBO.getCatalyticActivator())
{
- Species species = sbmlModel.getSpecies(modifier.getSpecies());
PhysicalEntity cofactorEntity = (PhysicalEntity) sbml2BioPAXUtilities.convertSpecies(bpModel, species);
catalysis.addCofactor(cofactorEntity);
}
@@ -173,14 +179,6 @@
catalysis.setControlType(ControlType.ACTIVATION);
}
}
- else {//This could be Modulation, TemplateReactionRegulation, or any other Control Interaction
- Control control = sbml2BioPAXUtilities.convertModifier(bpModel, modifier);
- pathway.addPathwayComponent(control);
- control.addControlled(interaction);
- Species species = sbmlModel.getSpecies(modifier.getSpecies());
- Controller controller = (Controller) sbml2BioPAXUtilities.convertSpecies(bpModel, species);
- control.addController(controller);
- }
// Modifiers -> Controls [end]
}
}
@@ -193,7 +191,8 @@
for (SpeciesReference speciesRef : listOfSpeciesReferences) {
Species species = sbmlModel.getSpecies(speciesRef.getSpecies());
Entity entity = sbml2BioPAXUtilities.convertSpecies(bpModel, species);
- if(interaction instanceof Conversion){
+ if(interaction instanceof Conversion)
+ {
Conversion conversion = (Conversion) interaction;
if(reaction.getReversible())
{
@@ -205,18 +204,32 @@
}
if(!Double.isNaN(speciesRef.getStoichiometry()))
{
- Stoichiometry conversionStoich = new StoichiometryImpl();
- conversionStoich.setStoichiometricCoefficient((float) speciesRef.getStoichiometry());
- conversion.addParticipantStoichiometry(conversionStoich);
+ parseStoichiometry(speciesRef, conversion, sbmlModel, bpModel);
}
}
else if(interaction instanceof TemplateReaction)
{
((TemplateReaction) interaction).addProduct((PhysicalEntity) entity);
}
- else if(interaction instanceof GeneticInteraction || interaction instanceof MolecularInteraction){
+ else if(interaction instanceof GeneticInteraction || interaction instanceof MolecularInteraction)
+ {
interaction.addParticipant(entity);
}
}
}
+
+ private void parseStoichiometry(SpeciesReference speciesRef, Conversion interaction,
+ org.sbml.jsbml.Model sbmlModel, Model bpModel)
+ {
+ BioPAXFactory bioPAXFactory = BioPAXLevel.L3.getDefaultFactory();
+ Stoichiometry stoichio = bioPAXFactory.create(Stoichiometry.class, speciesRef.getId());
+
+ stoichio.setStoichiometricCoefficient((float) speciesRef.getStoichiometry());
+
+ Species species = sbmlModel.getSpecies(speciesRef.getSpecies());
+ PhysicalEntity physicalEntityParticipant = (PhysicalEntity) sbml2BioPAXUtilities.convertSpecies(bpModel, species);
+ stoichio.setPhysicalEntity((PhysicalEntity) physicalEntityParticipant);
+
+ interaction.addParticipantStoichiometry(stoichio);
+ }
}
\ No newline at end of file
Modified: trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXUtilities.java
===================================================================
--- trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXUtilities.java 2016-08-06 05:29:39 UTC (rev 689)
+++ trunk/src/org/sbfc/converter/sbml2biopax/arman/SBML2BioPAXUtilities.java 2016-08-08 08:11:35 UTC (rev 690)
@@ -55,6 +55,7 @@
import org.biopax.paxtools.model.level3.SimplePhysicalEntity;
import org.biopax.paxtools.model.level3.SmallMolecule;
import org.biopax.paxtools.model.level3.SmallMoleculeReference;
+import org.biopax.paxtools.model.level3.Stoichiometry;
import org.biopax.paxtools.model.level3.TemplateDirectionType;
import org.biopax.paxtools.model.level3.TemplateReaction;
import org.biopax.paxtools.model.level3.TemplateReactionRegulation;
@@ -152,7 +153,7 @@
* (i.e. SBO term SBO:0000588 will create a Transport entity because this SBO value is an child of SBO:0000185)
*/
int reactionSBOValue = reaction.getSBOTerm();
-
+
if(SBO.isChildOf(reactionSBOValue, 231))
{
if(SBO.isChildOf(reactionSBOValue, 167))
@@ -213,18 +214,22 @@
//Default Interaction type
reactionClass = Interaction.class;
}
-
-
+
+
if(isConversionSet)
{
Conversion conversion = createBPEfromSBMLE(bpModel, rxnClass, reaction);
- conversion.setConversionDirection(
- reaction.getReversible()
- ? ConversionDirectionType.REVERSIBLE
- : ConversionDirectionType.RIGHT_TO_LEFT
- );
+ if(reaction.getReversible())
+ {
+ conversion.setConversionDirection(ConversionDirectionType.REVERSIBLE);
+ }
+ else
+ {
+ conversion.setConversionDirection(ConversionDirectionType.LEFT_TO_RIGHT);
+ }
+
conversion.setSpontaneous(reaction.getFast() ? true : false);
if(rxnClass.equals(TransportWithBiochemicalReaction.class) || rxnClass.equals(BiochemicalReaction.class))
@@ -254,47 +259,33 @@
KineticLaw reactionKL = reaction.getKineticLaw();
if(reactionKL != null)
{
+ DeltaG deltaG = bioPAXFactory.create(DeltaG.class, biochemicalReaction.getRDFId() + "_deltaGId");
+ KPrime kprime = bioPAXFactory.create(KPrime.class, biochemicalReaction.getRDFId() + "_KPrimeId");
+
for(LocalParameter localParam : reactionKL.getListOfLocalParameters())
{
String localParamId = localParam.getId();
if(localParam.getSBOTerm() == SBO.getGibbsFreeEnergyChange())
{
- //Create deltaG
- DeltaG deltaG = new DeltaGImpl();
-
- //TODO: how to set rdfId for deltaG?
- String suffix = "";
- int index = localParamId.length() - 1;
- while(localParamId.charAt(index) != '_')
- {
- suffix = localParamId.charAt(index--) + suffix ;
- }
- String rdfId = localParamId.substring(0, index);
-
-
- if(localParamId.endsWith("_deltaGPrime0"))
- {
- deltaG.setDeltaGPrime0((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_deltaGIonicStrength"))
- {
- deltaG.setIonicStrength((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_deltaGPh"))
- {
- deltaG.setPh((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_deltaGPMg"))
- {
- deltaG.setPMg((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_deltaGTemperature"))
- {
- deltaG.setTemperature((float) localParam.getValue());
- }
- biochemicalReaction.addDeltaG(deltaG);
+ deltaG.setDeltaGPrime0((float) localParam.getValue());
}
+ if(localParamId.endsWith("_deltaGIonicStrength"))
+ {
+ deltaG.setIonicStrength((float) localParam.getValue());
+ }
+ else if(localParamId.endsWith("_deltaGPh"))
+ {
+ deltaG.setPh((float) localParam.getValue());
+ }
+ else if(localParamId.endsWith("_deltaGPMg"))
+ {
+ deltaG.setPMg((float) localParam.getValue());
+ }
+ else if(localParamId.endsWith("_deltaGTemperature"))
+ {
+ deltaG.setTemperature((float) localParam.getValue());
+ }
else if(localParam.getSBOTerm() == SBO.getEnthalpyChange())
{
//deltaH
@@ -307,30 +298,29 @@
}
else if(localParam.getSBOTerm() == SBO.getEquilibriumConstant())
{
- //KEQ
- KPrime kprime = new KPrimeImpl();
- if(localParamId.endsWith("_KPrime"))
- {
- kprime.setKPrime((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_KPrimeIonicStrength"))
- {
- kprime.setIonicStrength((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_KPrimePh"))
- {
- kprime.setPh((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_KPrimeMg"))
- {
- kprime.setPMg((float) localParam.getValue());
- }
- else if(localParamId.endsWith("_KPrimeTemperature"))
- {
- kprime.setTemperature((float) localParam.getValue());
- }
+ kprime.setKPrime((float) localParam.getValue());
}
+ else if(localParamId.endsWith("_KPrimeIonicStrength"))
+ {
+ kprime.setIonicStrength((float) localParam.getValue());
+ }
+ else if(localParamId.endsWith("_KPrimePh"))
+ {
+ kprime.setPh((float) localParam.getValue());
+ }
+ else if(localParamId.endsWith("_KPrimeMg"))
+ {
+ kprime.setPMg((float) localParam.getValue());
+ }
+ else if(localParamId.endsWith("_KPrimeTemperature"))
+ {
+ kprime.setTemperature((float) localParam.getValue());
+ }
+
}
+
+ biochemicalReaction.addDeltaG(deltaG);
+ biochemicalReaction.addKEQ(kprime);
}
}
@@ -364,7 +354,7 @@
/*
* TODO: TBD - modify standardName
*/
- // named.setStandardName(name);
+ named.setStandardName(name);
named.setDisplayName(name);
named.getName().add(name);
}
@@ -376,35 +366,42 @@
* @param modifierSpeciesReference - The SBML ModifierSpeciesReference to be converted to a BioPAX Control Interaction
* @return The converted BioPAX Control Interaction
*/
- public Control convertModifier(Model bpModel, ModifierSpeciesReference modifierSpeciesReference) {
- // Interesting enough, these reference objects don't have an ID associated with them
- // That is why we are using hashcodes to generate unique BioPAX ID.
+ public Control convertModifier(Model bpModel, ModifierSpeciesReference modifierSpeciesReference, Reaction reaction) {
String id = completeId(modifierSpeciesReference.getId());
-
+
Control control = null;
-
+
//Check what type of control is this modifier
- int controlSBOValue = modifierSpeciesReference.getSBOTerm();
- if(controlSBOValue == 639 || controlSBOValue == 206 || controlSBOValue == 638 || controlSBOValue == 207
- || controlSBOValue == 20 || controlSBOValue == 640 || controlSBOValue == 637 || controlSBOValue == 636)
+ int reactionSBOValue = reaction.getSBOTerm();
+ if(SBO.isChildOf(reactionSBOValue, 589))
{
- control = createBPEfromSBMLE(bpModel, Modulation.class, modifierSpeciesReference, id);
+ //If reaction SBO value is a TemplateReaction (SBO:0000589), then create a TemplateReactionRegulation
+ control = createBPEfromSBMLE(bpModel, TemplateReactionRegulation.class, modifierSpeciesReference, id);
}
- else if(controlSBOValue == 20 || controlSBOValue == 21)
+ else if(SBO.isChildOf(reactionSBOValue, 167))
{
- //TODO: SBO value 20 will conflict with INHIBITION_OTHER and INHIBITION
- control = createBPEfromSBMLE(bpModel, TemplateReactionRegulation.class, modifierSpeciesReference, id);
+ /*
+ * Note:
+ * All Conversion SBO value maps to Modulation Entity
+ * Since all SBO value under SBO:0000167 contains SBO values that map to a Conversion Interaction,
+ * it should safe to check only the parent SBO value.
+ */
+ control = createBPEfromSBMLE(bpModel, Modulation.class, modifierSpeciesReference, id);
}
else
{
control = createBPEfromSBMLE(bpModel, Control.class, modifierSpeciesReference, id);
}
+
+ setControlType(control, modifierSpeciesReference.getSBOTerm());
- setControlType(control, modifierSpeciesReference.getSBOTerm());
+ for (Xref xref : generateXrefsForSBase(bpModel, modifierSpeciesReference)) {
+ control.addXref(xref);
+ }
return control;
}
-
+
public void setControlType(Control control, int modifierSBOTerm)
{
//TODO: same SBO terms for ControlType.INHIBITION_OTHER and INHIBITION;
@@ -457,46 +454,12 @@
}
public <T extends SimplePhysicalEntity, S extends EntityReference> T convertSpeciesToSPE(Model bpModel, Class<T> entityClass, Class<S> refClass, Species species) {
- Set<Xref> xrefs = generateXrefsForSBase(bpModel, species);
- HashSet<XReferrable> ers = new HashSet<XReferrable>();
- for (Xref xref : xrefs) {
- for (XReferrable xReferrable : xref.getXrefOf()) {
- // Only add the entity references
- if(xReferrable instanceof EntityReference) {
- ers.add(xReferrable);
- }
- }
- }
-
- S reference;
- if(ers.isEmpty()) {
- reference = createBPEfromSBMLE(bpModel, refClass, species, completeId("ref_" + species.getId()));
- for (Xref xref : xrefs) {
- reference.addXref(xref);
- }
- } else if(ers.size() == 1) { // There shouldn't be more than one
- reference = (S) ers.iterator().next();
- } else {
- log.warn(
- "There are more than one EntityReferences that match with the same unification xref for species: "
- + species.getName()
- + ". Picking the first one: "
- + ers.iterator().next().getRDFId()
- );
-
- reference = (S) ers.iterator().next();
- }
-
T entity = createBPEfromSBMLE(bpModel, entityClass, species);
- entity.setEntityReference(reference);
-
- // Clean-up non-used xrefs
- for (Xref xref : xrefs) {
- if(xref.getXrefOf().isEmpty()) {
- bpModel.remove(xref);
- }
+ for (Xref xref : generateXrefsForSBase(bpModel, species)) {
+ entity.addXref(xref);
}
-
+ //TODO: grab from sbml group to get biopax entityReference
+ //entity.setEntityReference(reference);
return entity;
}
@@ -507,7 +470,7 @@
String idToken = RegistryUtilities.getElementPart(resource);
String dataBase = RegistryUtilities.getDataPart(resource);
DataType datatype = RegistryUtilities.getDataType(dataBase);
-
+
if (datatype != null) {
dataBase = datatype.getName();
} else {
@@ -598,7 +561,7 @@
//If SBO value does not match any of the above, then assume species is a PhysicalEntity
physicalEntity = convertSpeciesToPE(bpModel, PhysicalEntity.class, UnificationXref.class, species);
}
-
+
if(!isPhysicalEntity){
return entity;
}
@@ -690,13 +653,11 @@
for (CVTerm cvTerm : annotation.getListOfCVTerms()) {
for (String resource : cvTerm.getResources()) {
// String xrefId = completeId(xrefClass.getSimpleName().toLowerCase() + "_" + cvTerm.hashCode());
- String xrefId = completeId(resource + cvTerm.hashCode());
+ String xrefId = completeId(resource);
// Let's not replicate xrefs if possible
Xref xref = (Xref) bpModel.getByID(xrefId);
- if(xref == null) {
- // if(resource.toLowerCase().contains("pubmed")) {
- // xref = resourceToXref(PublicationXref.class, xrefId, resource);
- // }
+ if(xref == null)
+ {
if(cvTerm.getQualifier().equals(Qualifier.BQB_UNKNOWN))
{
xref = resourceToXref(RelationshipXref.class, xrefId, resource);
Modified: trunk/test/org/sbfc/test/biopax2sbml/InteractionTests.java
===================================================================
--- trunk/test/org/sbfc/test/biopax2sbml/InteractionTests.java 2016-08-06 05:29:39 UTC (rev 689)
+++ trunk/test/org/sbfc/test/biopax2sbml/InteractionTests.java 2016-08-08 08:11:35 UTC (rev 690)
@@ -322,32 +322,6 @@
Assert.assertTrue(conversion.getSBOTerm() == SBO.getConversion());
}
- private void validateSBMLFile(SBMLDocument document)
- {
-
- String message = "Validation Problems Found by Webservice\n";
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.GENERAL_CONSISTENCY, true);
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.IDENTIFIER_CONSISTENCY, true);
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.OVERDETERMINED_MODEL, true);
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.UNITS_CONSISTENCY, true);
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.MATHML_CONSISTENCY, true);
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.SBO_CONSISTENCY, true);
- document.setConsistencyChecks(org.sbml.jsbml.validator.SBMLValidator.CHECK_CATEGORY.MODELING_PRACTICE, true);
- long numberOfErrors = document.checkConsistency();
- for (int i = 0; i < numberOfErrors; i++)
- {
- String error = document.getError(i).getMessage();
- message += i + ":" + error + "\n";
- i++;
- }
- System.out.println(message);
- }
-
- @Test public void test_PathwayInteraction()
- {
-
- }
-
@Test public void test_InteractionReaction()
{
org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
@@ -396,317 +370,7 @@
}
}
}
-
- @Test public void test_BiochemicalReactionFile()
- {
- String owlFile = fileDirectory + "biopax3-phosphorylation-reaction.owl";
- SBMLModel sbfcSBMLModel = InteractionTests.read_biopaxFile(owlFile);
- org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
-
- Assert.assertTrue(sbmlModel.getNumSpecies() == 5);
-
- Species protein = sbmlModel.getSpecies("Protein_5");
- Assert.assertTrue(protein.getId().equals("Protein_5"));
- Assert.assertTrue(protein.getName().equals("CHK2"));
- Assert.assertTrue(protein.getCompartment().equals("CellularLocationVocabulary_6"));
-
- Species SmallMolecule_21 = sbmlModel.getSpecies("SmallMolecule_21");
- Assert.assertTrue(SmallMolecule_21.getId().equals("SmallMolecule_21"));
- Assert.assertTrue(SmallMolecule_21.getName().equals("ADP"));
- Assert.assertTrue(SmallMolecule_21.getCompartment().equals("CellularLocationVocabulary_6"));
-
- Reaction BiochemicalReaction_2 = sbmlModel.getReaction("BiochemicalReaction_2");
- Assert.assertTrue(BiochemicalReaction_2.getName().equals("Phosphorylation and activation of CHK2 by ATM"));
- Assert.assertTrue(BiochemicalReaction_2.getSBOTerm() == SBO.getBiochemicalReaction());
- Assert.assertTrue(BiochemicalReaction_2.getCVTerms().size() == 3);
- Assert.assertTrue(BiochemicalReaction_2.isReversible());
- Assert.assertTrue(BiochemicalReaction_2.getNumReactants() == 2);
- Assert.assertTrue(BiochemicalReaction_2.getNumProducts() == 2);
- Assert.assertTrue(BiochemicalReaction_2.getNumModifiers() == 1);
- Assert.assertTrue(BiochemicalReaction_2.getModifier(0).getId().equals("Catalysis_1"));
- Assert.assertTrue(BiochemicalReaction_2.getModifier(0).getSBOTerm() == SBO.getCatalyst());
- Assert.assertTrue(BiochemicalReaction_2.getModifier(0).getSpecies().equals("Protein_27"));
- //TODO: modifier for protein 27 has stoichiometry value of 1
- for(SpeciesReference reactant : BiochemicalReaction_2.getListOfReactants())
- {
- if(reactant.getId().equals("Stoichiometry_1"))
- {
- Species Protein_5 = sbmlModel.getSpecies("Protein_5");
- Assert.assertTrue(Protein_5.getName().equals("CHK2"));
- Assert.assertTrue(Protein_5.getCVTerms().size() == 0);
- Assert.assertTrue(Protein_5.getCompartment().equals("CellularLocationVocabulary_6"));
- Assert.assertTrue(Protein_5.getSBOTerm() == SBO.getGeneric());
- Assert.assertTrue(reactant.getStoichiometry() == 1);
- }
- else if(reactant.getId().equals("Stoichiometry_4"))
- {
- Species SmallMolecule_13 = sbmlModel.getSpecies("SmallMolecule_13");
- Assert.assertTrue(SmallMolecule_13.getName().equals("ATP"));
- Assert.assertTrue(SmallMolecule_13.getSBOTerm() == SBO.getSmallMolecule());
- Assert.assertTrue(SmallMolecule_13.getCVTerms().size() == 0);
- Assert.assertTrue(reactant.getStoichiometry() == 1);
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- for(SpeciesReference product : BiochemicalReaction_2.getListOfProducts())
- {
- if(product.getSpecies().equals("Protein_16"))
- {
- Species Protein_5 = sbmlModel.getSpecies("Protein_16");
- Assert.assertTrue(Protein_5.getName().equals("CHK2"));
- Assert.assertTrue(Protein_5.getCVTerms().size() == 0);
- Assert.assertTrue(Protein_5.getCompartment().equals("CellularLocationVocabulary_6"));
- Assert.assertTrue(Protein_5.getSBOTerm() == SBO.getGeneric());
- }
- else if(product.getId().equals("Stoichiometry_3"))
- {
- Species SmallMolecule_13 = sbmlModel.getSpecies("SmallMolecule_21");
- Assert.assertTrue(SmallMolecule_13.getCompartment().equals("CellularLocationVocabulary_6"));
- Assert.assertTrue(SmallMolecule_13.getName().equals("ADP"));
- Assert.assertTrue(SmallMolecule_13.getSBOTerm() == SBO.getSmallMolecule());
- Assert.assertTrue(SmallMolecule_13.getCVTerms().size() == 0);
- Assert.assertTrue(product.getStoichiometry() == 1);
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- }
-
- @Test public void test_TemplateReactionFile()
- {
- String owlFile = fileDirectory + "biopax3-template-reaction.owl";
-
- SBMLModel sbfcSBMLModel = InteractionTests.read_biopaxFile(owlFile);
- org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
-
- Species Complex_37 = sbmlModel.getSpecies("Complex_37");
- Assert.assertTrue(Complex_37.getName().equals("Beta-catenin-TCF1"));
- Assert.assertTrue(Complex_37.getSBOTerm() == SBO.getComplex());
- Assert.assertTrue(Complex_37.getCVTerms().size() == 2);
- Assert.assertTrue(Complex_37.getCompartment().equals("CellularLocationVocabulary_3"));
- Compartment complexCompartment = sbmlModel.getCompartment(Complex_37.getCompartment());
- Assert.assertTrue(complexCompartment.getCVTerms().iterator().next().getBiologicalQualifierType().equals(Qualifier.BQB_IS));
- Assert.assertTrue(complexCompartment.getCVTerms().size() == 1);
-
- Species Protein_1 = sbmlModel.getSpecies("Protein_1");
- Assert.assertTrue(Protein_1.getSBOTerm() == SBO.getGeneric());
- Assert.assertTrue(Protein_1.getName().equals("Wnt8_protein"));
- Assert.assertTrue(Protein_1.getCVTerms().size() == 2);
- Assert.assertTrue(Protein_1.getCompartment().equals("CellularLocationVocabulary_3"));
- Compartment proteinCompartment = sbmlModel.getCompartment(Protein_1.getCompartment());
- Assert.assertTrue(proteinCompartment.getCVTerms().size() == 1);
- Assert.assertTrue(Protein_1.getCVTerm(0).getBiologicalQualifierType().equals(Qualifier.BQB_IS_DESCRIBED_BY));
- Assert.assertTrue(Protein_1.getCVTerm(1).getBiologicalQualifierType().equals(Qualifier.BQB_IS_DESCRIBED_BY));
-
- Species Protein_38 = sbmlModel.getSpecies("Protein_38");
- Assert.assertTrue(Protein_38.getSBOTerm() == SBO.getGeneric());
- Assert.assertTrue(Protein_38.getName().equals("TCF1_protein"));
- Assert.assertTrue(Protein_38.getCVTerms().size() == 2);
- Assert.assertTrue(Protein_38.getCompartment().equals("CellularLocationVocabulary_3"));
- Compartment protein38Compartment = sbmlModel.getCompartment(Protein_1.getCompartment());
- Assert.assertTrue(protein38Compartment.getCVTerms().size() == 1);
- Assert.assertTrue(Protein_38.getCVTerm(0).getBiologicalQualifierType().equals(Qualifier.BQB_IS_DESCRIBED_BY));
- Assert.assertTrue(Protein_38.getCVTerm(1).getBiologicalQualifierType().equals(Qualifier.BQB_IS_DESCRIBED_BY));
-
-
- Species Protein_2 = sbmlModel.getSpecies("Protein_2");
- Assert.assertTrue(Protein_2.getSBOTerm() == SBO.getGeneric());
- Assert.assertTrue(Protein_2.getName().equals("beta-catenin_protein"));
- Assert.assertTrue(Protein_2.getCVTerms().size() == 2);
- Assert.assertTrue(Protein_2.getCVTerm(0).getBiologicalQualifierType().equals(Qualifier.BQB_IS_DESCRIBED_BY));
- Assert.assertTrue(Protein_2.getCVTerm(1).getBiologicalQualifierType().equals(Qualifier.BQB_IS_DESCRIBED_BY));
- Assert.assertTrue(Protein_2.getCompartment().equals("CellularLocationVocabulary_3"));
- Compartment protein2Compartment = sbmlModel.getCompartment(Protein_1.getCompartment());
- Assert.assertTrue(protein2Compartment.getCVTerms().size() == 1);
-
-
- Reaction TemplateReaction_1 = sbmlModel.getReaction("TemplateReaction_1");
- Assert.assertTrue(TemplateReaction_1.getSBOTerm() == SBO.getTemplateReaction());
- Assert.assertTrue(TemplateReaction_1.getName().equals("Wnt8 transcription"));
- Assert.assertTrue(TemplateReaction_1.getCVTerms().size() == 2);
- Assert.assertTrue(TemplateReaction_1.getNumProducts() == 1);
- Assert.assertTrue(TemplateReaction_1.getNumModifiers() == 3);
- for(ModifierSpeciesReference modifier : TemplateReaction_1.getListOfModifiers())
- {
- String modifierId = modifier.getId();
- if(modifier.getSpecies().equals("DnaRegion_12"))
- {
- Species DnaRegion_12 = sbmlModel.getSpecies("DnaRegion_12");
- Assert.assertTrue(DnaRegion_12.getName().equals("Wnt8_gene"));
- Assert.assertTrue(DnaRegion_12.getCVTerms().size() == 3);
- }
- else if(modifierId.equals("TemplateReactionRegulation_28") )
- {
- Assert.assertTrue(modifier.getName().equals("Blimp1/Krox regulates Wnt8"));
- Assert.assertTrue(modifier.getSBOTerm() == SBO.getStimulator());
- Assert.assertTrue(modifier.getCVTerms().size() == 2);
- }
- else if(modifierId.equals("TemplateReactionRegulation_17"))
- {
- Assert.assertTrue(modifier.getName().equals("beta-catenin TCF1 regulates Wnt8"));
- Assert.assertTrue(modifier.getSBOTerm() == SBO.getStimulator());
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- Assert.assertTrue(TemplateReaction_1.getSBOTerm() == SBO.getTemplateReaction());
- Assert.assertTrue(TemplateReaction_1.getProduct(0).getSpecies().equals("Protein_1"));
-
- Reaction TemplateReaction_22 = sbmlModel.getReaction("TemplateReaction_22");
- Assert.assertTrue(TemplateReaction_22.getName().equals("Eve transcription"));
- Assert.assertTrue(TemplateReaction_22.getSBOTerm() == SBO.getTemplateReaction());
- Assert.assertTrue(TemplateReaction_22.getCVTerms().size() == 2);
- Assert.assertTrue(TemplateReaction_22.getNumProducts() == 1);
- Assert.assertTrue(TemplateReaction_22.getNumModifiers() == 3);
- Assert.assertTrue(TemplateReaction_22.getProduct(0).getSpecies().equals("Protein_25"));
- Species Protein_25 = sbmlModel.getSpecies("Protein_25");
- Assert.assertTrue(Protein_25.getName().equals("Eve_protein"));
- for(ModifierSpeciesReference modifier : TemplateReaction_22.getListOfModifiers())
- {
- String modifierId = modifier.getId();
- if(modifier.getSpecies().equals("DnaRegion_23"))
- {
- Species DnaRegion_23 = sbmlModel.getSpecies("DnaRegion_23");
- Assert.assertTrue(DnaRegion_23.getName().equals("Eve_gene"));
- Assert.assertTrue(DnaRegion_23.getCVTerms().size() == 3);
- Assert.assertTrue(DnaRegion_23.getCompartment().equals("CellularLocationVocabulary_3"));
- Assert.assertTrue(DnaRegion_23.getSBOTerm() == SBO.getDNASegment());
- }
- else if(modifierId.equals("TemplateReactionRegulation_30") )
- {
- Assert.assertTrue(modifier.getName().equals("Bilmp1/Krox regulates Eve"));
- Assert.assertTrue(modifier.getSBOTerm() == SBO.getStimulator());
- Assert.assertTrue(modifier.getCVTerms().size() == 2);
- Assert.assertTrue(modifier.getSpecies().equals("Protein_12"));
- }
- else if(modifierId.equals("TemplateReactionRegulation_27"))
- {
- Assert.assertTrue(modifier.getName().equals("beta-catenin TCF1 regulates Eve"));
- Assert.assertTrue(modifier.getSBOTerm() == SBO.getStimulator());
- Assert.assertTrue(modifier.getSpecies().equals("Complex_37"));
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- Reaction Blimp = sbmlModel.getReaction("Blimp");
- Assert.assertTrue(Blimp.getName().equals("Blimp1/Krox transcription"));
- Assert.assertTrue(Blimp.getSBOTerm() == SBO.getTemplateReaction());
- Assert.assertTrue(Blimp.getCVTerms().size() == 2);
- Assert.assertTrue(Blimp.getNumProducts() == 1);
- Assert.assertTrue(Blimp.getNumModifiers() == 2);
- Assert.assertTrue(Blimp.getProduct(0).getSpecies().equals("Protein_12"));
- for(ModifierSpeciesReference modifier : Blimp.getListOfModifiers())
- {
- String modifierId = modifier.getId();
- if(modifier.getSpecies().equals("DnaRegion_10"))
- {
- Species DnaRegion_23 = sbmlModel.getSpecies("DnaRegion_10");
- Assert.assertTrue(DnaRegion_23.getName().equals("Blimp1/Krox_gene"));
- Assert.assertTrue(DnaRegion_23.getCVTerms().size() == 3);
- Assert.assertTrue(DnaRegion_23.getCompartment().equals("CellularLocationVocabulary_3"));
- Assert.assertTrue(DnaRegion_23.getSBOTerm() == SBO.getDNASegment());
- }
- else if(modifierId.equals("TemplateReactionRegulation_14") )
- {
- Assert.assertTrue(modifier.getName().equals("beta-catenin TCF1 regulates Blimp1/Krox"));
- Assert.assertTrue(modifier.getSBOTerm() == SBO.getStimulator());
- Assert.assertTrue(modifier.getCVTerms().size() == 2);
- Assert.assertTrue(modifier.getSpecies().equals("Complex_37"));
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- }
- @Test public void test_GeneticInteractionFile()
- {
- String owlFile = fileDirectory + "biopax3-genetic-interaction.owl";
-
- SBMLModel sbfcSBMLModel = InteractionTests.read_biopaxFile(owlFile);
-
- org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
- Assert.assertTrue(sbmlModel.getModel().getId().equals("defaultSBMLModelId"));
- Assert.assertTrue(sbmlModel.getNumSpecies() == 2);
- Assert.assertTrue(sbmlModel.getNumReactions() == 1);
-
- Assert.assertTrue(sbmlModel.getNumModifierSpeciesReferences() == 2);
-
- for(ModifierSpeciesReference modifier : sbmlModel.getModifierSpeciesReferences())
- {
- if(modifier.getSpecies().equals("Gene_1") || modifier.getSpecies().equals("Gene_3"))
- {
- Assert.assertTrue(true);
- }
- }
-
- Species gene1 = sbmlModel.getSpecies("Gene_1");
- Assert.assertTrue(gene1.getName().equals("MLC1"));
- Assert.assertTrue(gene1.getSBOTerm() == SBO.getGene());
- Assert.assertTrue(gene1.getCVTermCount() == 1);
- Assert.assertTrue(gene1.getCVTerms().iterator().next().getBiologicalQualifierType().equals(Qualifier.BQB_IS));
-
- Species gene3 = sbmlModel.getSpecies("Gene_3");
- Assert.assertTrue(gene3.getName().equals("MYO2"));
- Assert.assertTrue(gene3.getSBOTerm() == SBO.getGene());
- Assert.assertTrue(gene3.getCVTerms().iterator().next().getBiologicalQualifierType().equals(Qualifier.BQB_IS));
- Assert.assertTrue(gene3.getCVTerms().iterator().next().getResources().size() == 1);
-
- Reaction GeneticInteraction_2 = sbmlModel.getReaction("GeneticInteraction_2");
- Assert.assertTrue(GeneticInteraction_2.getName().equals("MYO2 - MLC1"));
- Assert.assertTrue(GeneticInteraction_2.getSBOTerm() == SBO.getGeneticInteraction());
- Assert.assertTrue(GeneticInteraction_2.getCVTerms().size() == 2);
- Assert.assertTrue(GeneticInteraction_2.getNumModifiers() == 2);
- for(ModifierSpeciesReference modifier : GeneticInteraction_2.getListOfModifiers())
- {
- Assert.assertFalse(!modifier.getSpecies().equals("Gene_1") && !modifier.getSpecies().equals("Gene_3"));
- }
- Assert.assertTrue(GeneticInteraction_2.getNumProducts() == 2);
- for(SpeciesReference product : GeneticInteraction_2.getListOfProducts())
- {
- Assert.assertFalse(!product.getSpecies().equals("Gene_1") && !product.getSpecies().equals("Gene_3"));
- }
- Assert.assertTrue(GeneticInteraction_2.getNumReactants() == 2);
- for(SpeciesReference reactant : GeneticInteraction_2.getListOfReactants())
- {
- Assert.assertFalse(!reactant.getSpecies().equals("Gene_1") && !reactant.getSpecies().equals("Gene_3"));
- }
- }
-
- @Test public void test_MolecularInteractionFile()
- {
- String owlFile = fileDirectory + "biopax3-protein-interaction.owl";
-
- SBMLModel sbfcSBMLModel = read_biopaxFile(owlFile);
- org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
-
- Species Mdm2 = sbmlModel.getSpecies("Mdm2");
- Assert.assertTrue(Mdm2.getId().equals("Mdm2"));
- Assert.assertTrue(Mdm2.getName().equals("Mdm2"));
- Assert.assertTrue(Mdm2.getCompartment().equals("defaultCompartment"));
-
- Species p73 = sbmlModel.getSpecies("p73");
- Assert.assertTrue(p73.getId().equals("p73"));
- Assert.assertTrue(p73.getName().equals("p73"));
- Assert.assertTrue(p73.getCompartment().equals("defaultCompartment"));
-
- Reaction molecularInteraction = sbmlModel.getReaction("Mdm2_p73_by_coimmunoprecipitation");
- Assert.assertTrue(molecularInteraction.getName().equals("{Mdm2, p73} by coimmunoprecipitation"));
- Assert.assertTrue(molecularInteraction.getSBOTerm() == SBO.getMolecularInteraction());
- Assert.assertTrue(molecularInteraction.getNumReactants() == 2);
- Assert.assertTrue(molecularInteraction.getNumProducts() == 2);
- }
-
// @Test public void test_ComplexAssemblyFile()
// {
// String owlFile = fileDirectory + "INOH_GPCR_signaling-pertussis_toxin-.owl";
@@ -744,86 +408,8 @@
// //TODO:
// }
- @Test public void test_CatalysisFile()
- {
- String owlFile = fileDirectory + "biopax3-phosphorylation-reaction.owl";
- SBMLModel sbfcSBMLModel = InteractionTests.read_biopaxFile(owlFile);
- org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
-
- Assert.assertTrue(sbmlModel.getNumSpecies() == 5);
-
- Species protein = sbmlModel.getSpecies("Protein_5");
- Assert.assertTrue(protein.getId().equals("Protein_5"));
- Assert.assertTrue(protein.getName().equals("CHK2"));
- Assert.assertTrue(protein.getCompartment().equals("CellularLocationVocabulary_6"));
-
- Species SmallMolecule_21 = sbmlModel.getSpecies("SmallMolecule_21");
- Assert.assertTrue(SmallMolecule_21.getId().equals("SmallMolecule_21"));
- Assert.assertTrue(SmallMolecule_21.getName().equals("ADP"));
- Assert.assertTrue(SmallMolecule_21.getCompartment().equals("CellularLocationVocabulary_6"));
-
- Reaction BiochemicalReaction_2 = sbmlModel.getReaction("BiochemicalReaction_2");
- Assert.assertTrue(BiochemicalReaction_2.getName().equals("Phosphorylation and activation of CHK2 by ATM"));
- Assert.assertTrue(BiochemicalReaction_2.getSBOTerm() == SBO.getBiochemicalReaction());
- Assert.assertTrue(BiochemicalReaction_2.getCVTerms().size() == 3);
- Assert.assertTrue(BiochemicalReaction_2.isReversible());
- Assert.assertTrue(BiochemicalReaction_2.getNumReactants() == 2);
- Assert.assertTrue(BiochemicalReaction_2.getNumProducts() == 2);
- Assert.assertTrue(BiochemicalReaction_2.getNumModifiers() == 1);
- Assert.assertTrue(BiochemicalReaction_2.getModifier(0).getId().equals("Catalysis_1"));
- Assert.assertTrue(BiochemicalReaction_2.getModifier(0).getSBOTerm() == SBO.getCatalyst());
- Assert.assertTrue(BiochemicalReaction_2.getModifier(0).getSpecies().equals("Protein_27"));
- //TODO: modifier for protein 27 has stoichiometry value of 1
- for(SpeciesReference reactant : BiochemicalReaction_2.getListOfReactants())
- {
- if(reactant.getId().equals("Stoichiometry_1"))
- {
- Species Protein_5 = sbmlModel.getSpecies("Protein_5");
- Assert.assertTrue(Protein_5.getName().equals("CHK2"));
- Assert.assertTrue(Protein_5.getCVTerms().size() == 0);
- Assert.assertTrue(Protein_5.getCompartment().equals("CellularLocationVocabulary_6"));
- Assert.assertTrue(Protein_5.getSBOTerm() == SBO.getGeneric());
- Assert.assertTrue(reactant.getStoichiometry() == 1);
- }
- else if(reactant.getId().equals("Stoichiometry_4"))
- {
- Species SmallMolecule_13 = sbmlModel.getSpecies("SmallMolecule_13");
- Assert.assertTrue(SmallMolecule_13.getName().equals("ATP"));
- Assert.assertTrue(SmallMolecule_13.getSBOTerm() == SBO.getSmallMolecule());
- Assert.assertTrue(SmallMolecule_13.getCVTerms().size() == 0);
- Assert.assertTrue(reactant.getStoichiometry() == 1);
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- for(SpeciesReference product : BiochemicalReaction_2.getListOfProducts())
- {
- if(product.getSpecies().equals("Protein_16"))
- {
- Species Protein_5 = sbmlModel.getSpecies("Protein_16");
- Assert.assertTrue(Protein_5.getName().equals("CHK2"));
- Assert.assertTrue(Protein_5.getCVTerms().size() == 0);
- Assert.assertTrue(Protein_5.getCompartment().equals("CellularLocationVocabulary_6"));
- Assert.assertTrue(Protein_5.getSBOTerm() == SBO.getGeneric());
- }
- else if(product.getId().equals("Stoichiometry_3"))
- {
- Species SmallMolecule_13 = sbmlModel.getSpecies("SmallMolecule_21");
- Assert.assertTrue(SmallMolecule_13.getCompartment().equals("CellularLocationVocabulary_6"));
- Assert.assertTrue(SmallMolecule_13.getName().equals("ADP"));
- Assert.assertTrue(SmallMolecule_13.getSBOTerm() == SBO.getSmallMolecule());
- Assert.assertTrue(SmallMolecule_13.getCVTerms().size() == 0);
- Assert.assertTrue(product.getStoichiometry() == 1);
- }
- else
- {
- Assert.assertFalse(true);
- }
- }
- }
+
// @Test public void test_ModulationFile()
// {
// String owlFile = fileDirectory + "biopax-example-ecocyc-glycolysis.owl";
@@ -833,239 +419,7 @@
// //TODO:
// }
- @Test public void test_TemplateReactionRegulationFile()
- {
- String owlFile = fileDirectory + "biopax3-template-reaction.owl";
-
- SBMLModel sbfcSBMLModel = InteractionTests.read_biopaxFile(owlFile);
- org.sbml.jsbml.Model sbmlModel = sbfcSBMLModel.getModel();
-
- Species Complex_37 = sbmlModel.getSpecies("Complex_37");
- Assert.assertTrue(Complex_37.getName().equals("Beta-catenin-TCF1"));
- Assert.assertTrue(Complex_37.getSBOTerm() == SBO.getComplex());
- Assert.assertTrue(Complex_37.getCVTerms().size() == 2);
- Assert.assertTrue(Complex_37.getCompartment().equals("CellularLocationVocabulary_3"));
- Compartment complexCompartment = sbmlModel.getCompartment(Complex_37.getCompartment());
- Assert.assertTrue(complexCompartme...
[truncated message content] |