Hello, I'm now trying to create a C# software using SBML.
And I've confronted one problem on libsbml C# bindings (version 3.3.2).
When I try to load particular SBML model with readSBMLFromString function (Code 1),
getModel function returns null. And with readSBML function (Code 2), this problem does not occur.
This problem happened when I used BIOMD0000000012.xml or some other models on BioModels Database.
And I found it did not occur with libsbml python bindings.
Is there someone having the same problem?
Or should I use readSBML function?
Thanks.
// Code 1
public static void TestLoadSBMLFromString(string filename)
{
StreamReader reader = new StreamReader(filename);
string aSbmlString = reader.ReadToEnd();
reader.Close();
SBMLDocument document = libsbml.libsbml.readSBMLFromString(aSbmlString);
Model model = document.getModel();
if (model == null)
{
throw new Exception(string.Format("failed to get model. :{0}", filename));
}
}
// Code 2
public static void TestLoadSBML(string filename)
{
SBMLDocument document = libsbml.libsbml.readSBML(filename);
Model model = document.getModel();
if (model == null)
{
throw new Exception(string.Format("failed to get model. :{0}", filename));
}
}