Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
general
ccb
sybilSBML
Commits
02eb5c2d
Commit
02eb5c2d
authored
Nov 23, 2016
by
Claus Jonathan Fritzemeier
Browse files
Merge branch 'writeSBML' of git.hhu.de:bioinformatik/sybilsbml into writeSBML
parents
aa140f1e
440f385c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
R/sybilSBML.R
View file @
02eb5c2d
...
...
@@ -331,8 +331,7 @@ deformatGene<-function(idstr) {
return
(
idstr
)
}
exportSBML
<-
function
(
morg
=
NULL
,
level
=
2
,
version
=
4
,
FbcLevel
=
0
,
filename
=
"export.xml"
,
validation
=
TRUE
){
#morg<-modelorg[["modelorg"]]
exportSBML
<-
function
(
morg
=
NULL
,
level
=
2
,
version
=
4
,
FbcLevel
=
0
,
filename
=
"export.xml"
,
recoverExtMet
=
TRUE
,
printNotes
=
TRUE
,
printAnnos
=
TRUE
,
validation
=
FALSE
){
if
(
class
(
morg
)
!=
"modelorg"
){
stop
(
"morg has to be of class modelorg\n"
)
}
...
...
@@ -382,12 +381,14 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
##EXCHANGE REACTIONS##
ex
<-
findExchReact
(
morg
)
ex_react
<-
NULL
if
(
!
is.null
(
ex
))
# if recoverExtMet== FALSE => null for ex_react
if
(
(
!
is.null
(
ex
))
&&
(
recoverExtMet
)
)
{
if
(
!
(
all
(
diag
(
S
(
morg
)[
met_pos
(
ex
),
react_pos
(
ex
)])
==
-1
)))
stop
(
"exchange reactions with Scoeff different than -1\n"
)
ex_react
<-
as.integer
(
react_pos
(
ex
))
}
### Build wrapper for C Function #####
...
...
@@ -414,28 +415,25 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
else
modhasubSys
<-
TRUE
newsubS
<-
NULL
# TODO ATRRIBUTE NUR LESEN BEI NEUER SYBIL VERSION
if
(
.hasSlot
(
morg
,
"mod_attr"
)
&&
.hasSlot
(
morg
,
"comp_attr"
)
&&
.hasSlot
(
morg
,
"met_attr"
)
&&
.hasSlot
(
morg
,
"react_attr"
)
)
newSybil
<-
TRUE
newSybil
<-
TRUE
else
newSybil
<-
FALSE
### Start newSybil attr
if
(
newSybil
)
{
if
(
"notes"
%in%
colnames
(
mod_attr
(
morg
)))
mod_notes
<-
as.character
(
mod_attr
(
morg
)[[
'notes'
]])
if
(
"annotation"
%in%
colnames
(
mod_attr
(
morg
)))
mod_annotation
<-
as.character
(
mod_attr
(
morg
)[[
'annotation'
]])
if
(
(
"notes"
%in%
colnames
(
mod_attr
(
morg
)))
&&
(
printNotes
)
)
mod_notes
<-
as.character
(
mod_attr
(
morg
)[[
'notes'
]])
if
(
(
"annotation"
%in%
colnames
(
mod_attr
(
morg
)))
&&
(
printAnnos
)
)
mod_annotation
<-
as.character
(
mod_attr
(
morg
)[[
'annotation'
]])
if
(
"notes"
%in%
colnames
(
comp_attr
(
morg
)))
com_notes
<-
as.character
(
as.list
((
comp_attr
(
morg
)[[
'notes'
]])))
if
(
"annotation"
%in%
colnames
(
comp_attr
(
morg
)))
com_annotation
<-
as.character
(
as.list
((
comp_attr
(
morg
)[[
'annotation'
]])))
if
(
(
"notes"
%in%
colnames
(
comp_attr
(
morg
)))
&&
(
printNotes
)
)
com_notes
<-
as.character
(
as.list
((
comp_attr
(
morg
)[[
'notes'
]])))
if
(
(
"annotation"
%in%
colnames
(
comp_attr
(
morg
)))
&&
(
printAnnos
)
)
com_annotation
<-
as.character
(
as.list
((
comp_attr
(
morg
)[[
'annotation'
]])))
if
(
"charge"
%in%
colnames
(
met_attr
(
morg
)))
met_charge
<-
as.integer
(
as.list
((
met_attr
(
morg
)[[
'charge'
]])))
if
(
"chemicalFormula"
%in%
colnames
(
met_attr
(
morg
)))
met_formula
<-
as.character
(
as.list
((
met_attr
(
morg
)[[
'chemicalFormula'
]])))
if
(
"annotation"
%in%
colnames
(
met_attr
(
morg
)))
met_anno
<-
as.character
(
as.list
((
met_attr
(
morg
)[[
'annotation'
]])))
if
(
(
"annotation"
%in%
colnames
(
met_attr
(
morg
)))
&&
(
printAnnos
))
met_anno
<-
as.character
(
as.list
((
met_attr
(
morg
)[[
'annotation'
]])))
if
(
"boundaryCondition"
%in%
colnames
(
met_attr
(
morg
)))
met_bnd
<-
as.logical
(
as.list
((
met_attr
(
morg
)[[
'boundaryCondition'
]])))
if
(
"notes"
%in%
colnames
(
met_attr
(
morg
)))
if
(
(
"notes"
%in%
colnames
(
met_attr
(
morg
)))
&&
(
printNotes
)
)
{
# delete Formular and charge from notes to do
met_notes
<-
as.character
(
as.list
((
met_attr
(
morg
)[[
'notes'
]])))
if
(
!
is.null
(
met_charge
)
||
!
is.null
(
met_formula
))
...
...
@@ -481,10 +479,10 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
}
}
if
(
"annotation"
%in%
colnames
(
react_attr
(
morg
)))
react_anno
<-
as.character
(
as.list
((
react_attr
(
morg
)[[
'annotation'
]])))
if
(
(
"annotation"
%in%
colnames
(
react_attr
(
morg
)))
&&
(
printAnnos
))
react_anno
<-
as.character
(
as.list
((
react_attr
(
morg
)[[
'annotation'
]])))
# Merge Notes with "our" Notes and make sure gpr Rules from gpr
if
(
"notes"
%in%
colnames
(
react_attr
(
morg
)))
if
(
(
"notes"
%in%
colnames
(
react_attr
(
morg
)))
&&
(
printNotes
))
{
react_notes
<-
as.character
(
as.list
((
react_attr
(
morg
)[[
'notes'
]])))
# using
...
...
@@ -565,6 +563,7 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
react_notes
,
react_anno
,
ex_react
,
as.logical
(
validation
),
as.character
(
deformatGene
(
allgenes
))
)
return
(
success
)
...
...
src/init.c
View file @
02eb5c2d
...
...
@@ -54,7 +54,7 @@ static const R_CallMethodDef callMethods[] = {
{
"getSBMLCompartList"
,
(
DL_FUNC
)
&
getSBMLCompartList
,
1
},
{
"getSBMLSpeciesList"
,
(
DL_FUNC
)
&
getSBMLSpeciesList
,
1
},
{
"getSBMLReactionsList"
,
(
DL_FUNC
)
&
getSBMLReactionsList
,
1
},
{
"exportSBML"
,
(
DL_FUNC
)
&
exportSBML
,
3
3
},
{
"exportSBML"
,
(
DL_FUNC
)
&
exportSBML
,
3
4
},
{
"getSBMLFbcversion"
,
(
DL_FUNC
)
&
getSBMLFbcversion
,
1
},
{
NULL
,
NULL
,
0
}
};
...
...
src/sybilSBML.c
View file @
02eb5c2d
This diff is collapsed.
Click to expand it.
src/sybilSBML.h
View file @
02eb5c2d
...
...
@@ -109,5 +109,5 @@ SEXP getSBMLSpeciesList(SEXP sbmlmod);
SEXP
getSBMLReactionsList
(
SEXP
sbmlmod
);
/* export Modelorg to SBML*/
SEXP
exportSBML
(
SEXP
version
,
SEXP
level
,
SEXP
FbcLevel
,
SEXP
filename
,
SEXP
sybil_max
,
SEXP
mod_desc
,
SEXP
mod_name
,
SEXP
mod_compart
,
SEXP
met_id
,
SEXP
met_name
,
SEXP
met_comp
,
SEXP
met_form
,
SEXP
met_charge
,
SEXP
react_id
,
SEXP
react_name
,
SEXP
react_rev
,
SEXP
lowbnd
,
SEXP
uppbnd
,
SEXP
obj_coef
,
SEXP
subSys
,
SEXP
gpr
,
SEXP
SMatrix
,
SEXP
mod_notes
,
SEXP
mod_anno
,
SEXP
com_notes
,
SEXP
com_anno
,
SEXP
met_notes
,
SEXP
met_anno
,
SEXP
met_bnd
,
SEXP
react_notes
,
SEXP
react_anno
,
SEXP
ex_react
,
SEXP
allgenes
);
SEXP
exportSBML
(
SEXP
version
,
SEXP
level
,
SEXP
FbcLevel
,
SEXP
filename
,
SEXP
sybil_max
,
SEXP
mod_desc
,
SEXP
mod_name
,
SEXP
mod_compart
,
SEXP
met_id
,
SEXP
met_name
,
SEXP
met_comp
,
SEXP
met_form
,
SEXP
met_charge
,
SEXP
react_id
,
SEXP
react_name
,
SEXP
react_rev
,
SEXP
lowbnd
,
SEXP
uppbnd
,
SEXP
obj_coef
,
SEXP
subSys
,
SEXP
gpr
,
SEXP
SMatrix
,
SEXP
mod_notes
,
SEXP
mod_anno
,
SEXP
com_notes
,
SEXP
com_anno
,
SEXP
met_notes
,
SEXP
met_anno
,
SEXP
met_bnd
,
SEXP
react_notes
,
SEXP
react_anno
,
SEXP
ex_react
,
SEXP
validation
,
SEXP
allgenes
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment