Question: Reading nested tags in SBML with SBMLR (R package)
0
gravatar for srinadee
4.3 years ago by
srinadee0
srinadee0 wrote:

Hello,

I have a SBML file. I want to create a tale including the ReactionID, Reaction Name, Reactant Species and Gene Association. Below is the structure of one reaction.

<reaction id="R_DM_4CRSOL" name="Sink needed to allow p-Cresol to leave system" reversible="false">
        <notes>
          <html xmlns="http://www.w3.org/1999/xhtml">
            <p>GENE_ASSOCIATION: B21_02644</p>
            <p>SUBSYSTEM: </p>
          </html>
        </notes>
        <listOfReactants>
          <speciesReference species="M_4crsol_c" stoichiometry="1"/>
          <speciesReference species="M_4crsol_c_boundary" stoichiometry="1"/>
        </listOfReactants>
        <kineticLaw>
          <math xmlns="http://www.w3.org/1998/Math/MathML">
            <ci> FLUX_VALUE </ci>
          </math>
          <listOfParameters>
            <parameter id="LOWER_BOUND" value="0" units="mmol_per_gDW_per_hr"/>
            .........
            <parameter id="FLUX_VALUE" value="0" units="mmol_per_gDW_per_hr"/>
          </listOfParameters>
        </kineticLaw>
      </reaction>

Below is the code I wrote to get the list of reactions and the corresponding metabolites. 

library(SBMLR)
sampleFile = readSBML("Sample.xml")
reactions = summary(sampleFile$reactions) #list of reactions
reactants = sampleFile$reactions$R_DM_4CRSOL$reactants #metabolites for each reaction

sampleFile doesn't identify the name attribute or the html tags related to gene association. Can someone please help on this? Thank you

R sbml sbmlr • 786 views
ADD COMMENTlink modified 4.3 years ago by radivot20 • written 4.3 years ago by srinadee0
Answer: Reading nested tags in SBML with SBMLR (R package)
2
gravatar for radivot
4.3 years ago by
radivot20
Cleveland Clinic
radivot20 wrote:

My goal when I wrote SBMLR was to bring SBML models into R for the purpose of solving differential equations. Things not critical to simulations did not necessarily come into the R object. Reading your file into R below shows what made it and where it ended up. So it looks like all notes in reactions and species went into one global note for the whole model. Because rsbml uses libsbml, and SBMLR does not, I suspect it does a better job of preserving SBML.  

library(SBMLR)
sampleFile = readSBML("~/ccf/SB/Sample.xml")
sampleFile

$sbml
                            xmlns                             level                           version 
"http://www.sbml.org/sbml/level2"                               "2"                               "1" 

$id
NULL

$notes
 [1] "FORMULA: C21H39N2O8PRS"      "CHARGE: -1"                  "FORMULA: C4H7NO3"            "CHARGE: 0"                  
 [5] "FORMULA: C2H2O6P"            "CHARGE: -3"                  "GENE_ASSOCIATION: B21_02644" "SUBSYSTEM:"                 
 [9] "GENE_ASSOCIATION:"           "SUBSYSTEM:"                  "GENE_ASSOCIATION:"           "SUBSYSTEM:"                 

$compartments
$compartments$p
$compartments$p$id
[1] "p"

$compartments$p$size
[1] 1

$compartments$p$name
[1] "Periplasm"


$compartments$c
$compartments$c$id
[1] "c"

$compartments$c$size
[1] 1

$compartments$c$name
[1] "Cytoplasm"


$compartments$e
$compartments$e$id
[1] "e"

$compartments$e$size
[1] 1

$compartments$e$name
[1] "Extracellular"

 

$species
$species$M_4crsol_c
$species$M_4crsol_c$id
[1] "M_4crsol_c"

$species$M_4crsol_c$ic
[1] 0

$species$M_4crsol_c$compartment
[1] "c"

$species$M_4crsol_c$bc
[1] FALSE


$species$M_4crsol_c_boundary
$species$M_4crsol_c_boundary$id
[1] "M_4crsol_c_boundary"

$species$M_4crsol_c_boundary$ic
[1] 0

$species$M_4crsol_c_boundary$compartment
[1] "c"

$species$M_4crsol_c_boundary$bc
[1] FALSE


$species$M_5drib_c
$species$M_5drib_c$id
[1] "M_5drib_c"

$species$M_5drib_c$ic
[1] 0

$species$M_5drib_c$compartment
[1] "c"

$species$M_5drib_c$bc
[1] FALSE

 

$globalParameters
list()

$rules
list()

$reactions
$reactions$R_DM_4CRSOL
$reactions$R_DM_4CRSOL$id
[1] "R_DM_4CRSOL"

$reactions$R_DM_4CRSOL$reversible
[1] FALSE

$reactions$R_DM_4CRSOL$reactants
[1] "M_4crsol_c"          "M_4crsol_c_boundary"

$reactions$R_DM_4CRSOL$parameters
          LOWER_BOUND OBJECTIVE_COEFFICIENT           UPPER_BOUND            FLUX_VALUE 
                    0                     0                  1000                     0 

$reactions$R_DM_4CRSOL$mathmlLaw
<ci>FLUX_VALUE</ci>

$reactions$R_DM_4CRSOL$exprLaw
FLUX_VALUE

$reactions$R_DM_4CRSOL$strLaw
[1] "FLUX_VALUE"

$reactions$R_DM_4CRSOL$law
function (r, p = NULL) 
{
    LOWER_BOUND = p["LOWER_BOUND"]
    OBJECTIVE_COEFFICIENT = p["OBJECTIVE_COEFFICIENT"]
    UPPER_BOUND = p["UPPER_BOUND"]
    FLUX_VALUE = p["FLUX_VALUE"]
    M_4crsol_c = r["M_4crsol_c"]
    M_4crsol_c_boundary = r["M_4crsol_c_boundary"]
    FLUX_VALUE
}
<environment: 0x11f689ea0>


$reactions$R_DM_5DRIB
$reactions$R_DM_5DRIB$id
[1] "R_DM_5DRIB"

$reactions$R_DM_5DRIB$reversible
[1] FALSE

$reactions$R_DM_5DRIB$reactants
[1] "M_5drib_c"           "M_4crsol_c_boundary"

$reactions$R_DM_5DRIB$parameters
          LOWER_BOUND OBJECTIVE_COEFFICIENT           UPPER_BOUND            FLUX_VALUE 
                    0                     0                  1000                     0 

$reactions$R_DM_5DRIB$mathmlLaw
<ci>FLUX_VALUE</ci>

$reactions$R_DM_5DRIB$exprLaw
FLUX_VALUE

$reactions$R_DM_5DRIB$strLaw
[1] "FLUX_VALUE"

$reactions$R_DM_5DRIB$law
function (r, p = NULL) 
{
    LOWER_BOUND = p["LOWER_BOUND"]
    OBJECTIVE_COEFFICIENT = p["OBJECTIVE_COEFFICIENT"]
    UPPER_BOUND = p["UPPER_BOUND"]
    FLUX_VALUE = p["FLUX_VALUE"]
    M_5drib_c = r["M_5drib_c"]
    M_4crsol_c_boundary = r["M_4crsol_c_boundary"]
    FLUX_VALUE
}
<environment: 0x11f39b380>


$reactions$R_DM_AACALD
$reactions$R_DM_AACALD$id
[1] "R_DM_AACALD"

$reactions$R_DM_AACALD$reversible
[1] FALSE

$reactions$R_DM_AACALD$reactants
[1] "M_4crsol_c_boundary" "M_4crsol_c"         

$reactions$R_DM_AACALD$parameters
          LOWER_BOUND OBJECTIVE_COEFFICIENT           UPPER_BOUND            FLUX_VALUE 
                    0                     0                  1000                     0 

$reactions$R_DM_AACALD$mathmlLaw
<ci>FLUX_VALUE</ci>

$reactions$R_DM_AACALD$exprLaw
FLUX_VALUE

$reactions$R_DM_AACALD$strLaw
[1] "FLUX_VALUE"

$reactions$R_DM_AACALD$law
function (r, p = NULL) 
{
    LOWER_BOUND = p["LOWER_BOUND"]
    OBJECTIVE_COEFFICIENT = p["OBJECTIVE_COEFFICIENT"]
    UPPER_BOUND = p["UPPER_BOUND"]
    FLUX_VALUE = p["FLUX_VALUE"]
    M_4crsol_c_boundary = r["M_4crsol_c_boundary"]
    M_4crsol_c = r["M_4crsol_c"]
    FLUX_VALUE
}
<environment: 0x1027c1668>

 

attr(,"class")
[1] "SBMLR"

 

 

ADD COMMENTlink written 4.3 years ago by radivot20

Thank you very much for the reply. The actual file is very large and it contains nearly 3000 reactions. Even though there is no direct mapping I think it get the tag names in order. I can merge them easily. Initially I tried using rsbml but it gave me an error saying the format of the file is wrong. I wrote about this in the forumn (Unable to read SBML file in rsbml) so far no luck. That's why I used SBMLR.  However this will solve my problem for now. Thanks alot

ADD REPLYlink written 4.3 years ago by srinadee0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 412 users visited in the last hour