Flatten works
This commit is contained in:
parent
1c24b1edc5
commit
8cffc3062b
3 changed files with 86 additions and 32 deletions
|
|
@ -19,9 +19,11 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.sbml.jsbml.Model;
|
||||
import org.sbml.jsbml.SBMLDocument;
|
||||
import org.sbml.jsbml.SBMLException;
|
||||
import org.sbml.jsbml.SBMLWriter;
|
||||
|
|
@ -432,20 +434,71 @@ public class Converter {
|
|||
|
||||
try
|
||||
{
|
||||
inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null);
|
||||
/*
|
||||
File path = new File(fullInputFileName);
|
||||
BioObservable p = null;
|
||||
BioModel bioModel = BioModel.createBioModel(path.getParent(), p);
|
||||
bioModel.load(fullInputFileName);
|
||||
org.sbml.libsbml.SBMLReader reader = new org.sbml.libsbml.SBMLReader();
|
||||
org.sbml.libsbml.SBMLDocument document = reader.readSBML(fullInputFileName);
|
||||
document.setPackageRequired("comp", true);
|
||||
org.sbml.libsbml.CompModelPlugin sbmlCompModel = (org.sbml.libsbml.CompModelPlugin) document.getModel().getPlugin("comp");
|
||||
long numSubModels = sbmlCompModel.getNumSubmodels();
|
||||
System.err.println(numSubModels);
|
||||
*/
|
||||
|
||||
inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null);
|
||||
//SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound);
|
||||
|
||||
File path = new File(fullInputFileName);
|
||||
BioModel bioModel = new BioModel(path.getParent());
|
||||
bioModel.load(fullInputFileName);
|
||||
bioModel.createCompPlugin();
|
||||
System.err.println(bioModel.getListOfSubmodels());
|
||||
|
||||
if(bioModel.getListOfSubmodels().isEmpty())
|
||||
{
|
||||
SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound);
|
||||
}else {
|
||||
if (bioModel.flattenModel(true) != null) {
|
||||
SBMLDocument sbml = bioModel.flattenModel(true);
|
||||
SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (bioModel.flattenModel(true) != null) {
|
||||
SBMLDocument sbml = bioModel.flattenModel(true);
|
||||
//SBMLDocument sbml = bioModel.getSBMLDocument();
|
||||
//System.err.println(inputSBMLDoc.equals(inputSBMLDoc));
|
||||
//System.err.println(sbml.equals(sbml));
|
||||
//System.err.println(sbml.equals(sbml));
|
||||
SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound);
|
||||
|
||||
/*
|
||||
File path = new File(fullInputFileName);
|
||||
// BioObservable p = null;
|
||||
// BioModel bioModel = BioModel.createBioModel(path.getParent(), p);
|
||||
BioModel bioModel = new BioModel(path.getParent());
|
||||
bioModel.load(fullInputFileName);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (bioModel.flattenModel(true) != null) {
|
||||
//SBMLDocument sbml = bioModel.flattenModel(true);
|
||||
SBMLDocument sbml = bioModel.getSBMLDocument();
|
||||
//System.err.println(inputSBMLDoc.equals(inputSBMLDoc));
|
||||
//System.err.println(sbml.equals(sbml));
|
||||
//System.err.println(sbml.equals(sbml));
|
||||
//SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
catch (XMLStreamException e)
|
||||
|
|
|
|||
|
|
@ -6399,7 +6399,7 @@ public class BioModel extends CoreObservable{
|
|||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> getListOfSubmodels() throws XMLStreamException, IOException, BioSimException {
|
||||
public ArrayList<String> getListOfSubmodels() throws XMLStreamException, IOException, BioSimException { // Changed private to public (Lukas)
|
||||
ArrayList<String> comps = new ArrayList<String>();
|
||||
|
||||
if (this.getGridEnabledFromFile(filename.replace(".gcm",".xml"))) {
|
||||
|
|
|
|||
|
|
@ -1968,7 +1968,8 @@ public class SBMLutilities extends CoreObservable
|
|||
{
|
||||
String leftStr = convertMath2PrismProperty(math.getLeftChild());
|
||||
String rightStr = convertMath2PrismProperty(math.getRightChild());
|
||||
return "(" + leftStr + " ^ " + rightStr + ")";
|
||||
//return "(" + leftStr + " ^ " + rightStr + ")";
|
||||
return "pow(" + leftStr + " , " + rightStr + ")";
|
||||
}
|
||||
else if (math.getType() == ASTNode.Type.RATIONAL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue