Commit 4719c472 authored by Sylvain Soliman's avatar Sylvain Soliman

first SBML qual parsing, without libsbml which is unusable

parent f56ffc1a
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1"
xmlns:qual="http://www.sbml.org/sbml/level3/version1/qual/version1" qual:required="true">
<model id="example">
<listOfCompartments>
<compartment id="cytosol" name="cytosol" constant="true"/>
<compartment id="nucleus" name="nucleus" constant="true"/>
</listOfCompartments>
<qual:listOfQualitativeSpecies>
<qual:qualitativeSpecies qual:compartment="cytosol" qual:constant="false"
qual:id="A" qual:maxLevel="2"/>
<qual:qualitativeSpecies qual:compartment="cytosol" qual:constant="false"
qual:id="B" qual:maxLevel="1"/>
<qual:qualitativeSpecies qual:compartment="nucleus" qual:constant="false"
qual:id="C" qual:maxLevel="1"/>
</qual:listOfQualitativeSpecies>
<qual:listOfTransitions>
<qual:transition qual:id="tr_B">
<qual:listOfInputs>
<qual:input qual:id="theta_B_A" qual:qualitativeSpecies="A"
qual:thresholdLevel="1" qual:transitionEffect="none"
qual:sign="positive"/>
</qual:listOfInputs>
<qual:listOfOutputs>
<qual:output qual:transitionEffect="assignmentLevel"
qual:qualitativeSpecies="B"/>
</qual:listOfOutputs>
<qual:listOfFunctionTerms>
<qual:functionTerm qual:resultLevel="1">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<!-- A >= 1-->
<apply>
<geq/>
<ci>A</ci>
<ci>theta_B_A</ci>
</apply>
</math>
</qual:functionTerm>
<qual:defaultTerm qual:resultLevel="0"/>
</qual:listOfFunctionTerms>
</qual:transition>
<qual:transition qual:id="tr_A">
<qual:listOfInputs>
<qual:input qual:id="theta_A_A1" qual:qualitativeSpecies="A"
qual:thresholdLevel="1" qual:transitionEffect="none"
qual:sign="positive"/>
<qual:input qual:id="theta_A_A2" qual:qualitativeSpecies="A"
qual:thresholdLevel="2" qual:transitionEffect="none"
qual:sign="negative"/>
<qual:input qual:id="theta_A_C" qual:qualitativeSpecies="C"
qual:thresholdLevel="1" qual:transitionEffect="none"
qual:sign="positive"/>
</qual:listOfInputs>
<qual:listOfOutputs>
<qual:output qual:qualitativeSpecies="A"
qual:transitionEffect="assignmentLevel"/>
</qual:listOfOutputs>
<qual:listOfFunctionTerms>
<qual:functionTerm qual:resultLevel="2">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<!-- (A >= 1 and A < 2) or (C >= 1 and A >= 1)-->
<apply>
<or/>
<apply>
<and/>
<apply>
<geq/>
<ci>A</ci>
<ci>theta_A_A1</ci>
</apply>
<apply>
<lt/>
<ci>A</ci>
<ci>theta_A_A2</ci>
</apply>
</apply>
<apply>
<and/>
<apply>
<geq/>
<ci>C</ci>
<ci>theta_A_C</ci>
</apply>
<apply>
<geq/>
<ci>A</ci>
<ci>theta_A_A1</ci>
</apply>
</apply>
</apply>
</math>
</qual:functionTerm>
<qual:functionTerm qual:resultLevel="1">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<!-- (A < 1) and C >= 1 -->
<apply>
<and/>
<apply>
<lt/>
<ci>A</ci>
<ci>theta_A_A1</ci>
</apply>
<apply>
<geq/>
<ci>C</ci>
<ci>theta_A_C</ci>
</apply>
</apply>
</math>
</qual:functionTerm>
<qual:defaultTerm qual:resultLevel="0"/>
</qual:listOfFunctionTerms>
</qual:transition>
<qual:transition qual:id="tr_C">
<qual:listOfInputs>
<qual:input qual:id="theta_C_B" qual:qualitativeSpecies="B"
qual:thresholdLevel="1" qual:transitionEffect="none"
qual:sign="positive"/>
</qual:listOfInputs>
<qual:listOfOutputs>
<qual:output qual:qualitativeSpecies="C"
qual:transitionEffect="assignmentLevel"/>
</qual:listOfOutputs>
<qual:listOfFunctionTerms>
<qual:functionTerm qual:resultLevel="1">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<!-- B >= 1-->
<apply>
<geq/>
<ci>B</ci>
<ci>theta_C_B</ci>
</apply>
</math>
</qual:functionTerm>
<qual:defaultTerm qual:resultLevel="0"/>
</qual:listOfFunctionTerms>
</qual:transition>
</qual:listOfTransitions>
</model>
</sbml>
:- module(
sbml_qual_files,
[
load_qual/1,
add_qual/1,
add_qual_file/1
]
).
:- use_module(library(sgml)).
:- devdoc('\\section{Commands}').
load_qual(InputFile) :-
biocham_command,
type(InputFile, input_file),
doc('
acts as \\command{load_biocham/1} but importing influences and
initial state (and only that!) from an SBML3qual .sbml file.
'),
load_all('sbml', InputFile).
add_qual(InputFile) :-
biocham_command,
type(InputFile, input_file),
doc('
acts as \\command{add_biocham/1} but importing influences and
initial state (and only that!) from an SBML3qual .sbml file.
'),
add_all('sbml', InputFile).
:- devdoc('\\section{Public API}').
models:add_file_suffix('sbml', add_qual_file).
add_qual_file(Filename) :-
% FIXME should check for level=3 and qual:required=true in attributes of
% sbml element
load_xml_file(Filename, [element(sbml, _, T)]),
length(T, N),
write(T),nl, write(N), nl.
:- use_module(library(plunit)).
:- begin_tests(sbml_qual_files).
test(
'load_qual',
[true(Influences = [ 'B' -> 'BL', 'BL' -> 'BLL' | _ ])]
) :-
load('modules/sbml/examples/foo_grn.sbml'),
all_items([kind: influence], Influences).
:- end_tests(sbml_qual_files).
......@@ -30,6 +30,7 @@
- models.pl
*** SBML files
- sbml_files.pl
- sbml_qual_files.pl
*** ODE files
- ode.pl
- odefunction.pl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment