Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sybilSBML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
general
ccb
sybilSBML
Commits
440f385c
Commit
440f385c
authored
8 years ago
by
ardalan
Browse files
Options
Downloads
Patches
Plain Diff
new Parameter for export
parent
bcb360a9
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
R/sybilSBML.R
+15
-16
15 additions, 16 deletions
R/sybilSBML.R
src/init.c
+1
-1
1 addition, 1 deletion
src/init.c
src/sybilSBML.c
+2304
-2296
2304 additions, 2296 deletions
src/sybilSBML.c
src/sybilSBML.h
+1
-1
1 addition, 1 deletion
src/sybilSBML.h
with
2321 additions
and
2314 deletions
R/sybilSBML.R
+
15
−
16
View file @
440f385c
...
@@ -331,8 +331,7 @@ deformatGene<-function(idstr) {
...
@@ -331,8 +331,7 @@ deformatGene<-function(idstr) {
return
(
idstr
)
return
(
idstr
)
}
}
exportSBML
<-
function
(
morg
=
NULL
,
level
=
2
,
version
=
4
,
FbcLevel
=
0
,
filename
=
"export.xml"
,
validation
=
TRUE
){
exportSBML
<-
function
(
morg
=
NULL
,
level
=
2
,
version
=
4
,
FbcLevel
=
0
,
filename
=
"export.xml"
,
recoverExtMet
=
TRUE
,
printNotes
=
TRUE
,
printAnnos
=
TRUE
,
validation
=
FALSE
){
#morg<-modelorg[["modelorg"]]
if
(
class
(
morg
)
!=
"modelorg"
){
if
(
class
(
morg
)
!=
"modelorg"
){
stop
(
"morg has to be of class modelorg\n"
)
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
...
@@ -382,12 +381,14 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
##EXCHANGE REACTIONS##
##EXCHANGE REACTIONS##
ex
<-
findExchReact
(
morg
)
ex
<-
findExchReact
(
morg
)
ex_react
<-
NULL
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
)))
if
(
!
(
all
(
diag
(
S
(
morg
)[
met_pos
(
ex
),
react_pos
(
ex
)])
==
-1
)))
stop
(
"exchange reactions with Scoeff different than -1\n"
)
stop
(
"exchange reactions with Scoeff different than -1\n"
)
ex_react
<-
as.integer
(
react_pos
(
ex
))
ex_react
<-
as.integer
(
react_pos
(
ex
))
}
}
### Build wrapper for C Function #####
### Build wrapper for C Function #####
...
@@ -415,27 +416,24 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
...
@@ -415,27 +416,24 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
newsubS
<-
NULL
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"
)
)
if
(
.hasSlot
(
morg
,
"mod_attr"
)
&&
.hasSlot
(
morg
,
"comp_attr"
)
&&
.hasSlot
(
morg
,
"met_attr"
)
&&
.hasSlot
(
morg
,
"react_attr"
)
)
newSybil
<-
TRUE
newSybil
<-
TRUE
else
newSybil
<-
FALSE
else
newSybil
<-
FALSE
### Start newSybil attr
### Start newSybil attr
if
(
newSybil
)
if
(
newSybil
)
{
{
if
(
"notes"
%in%
colnames
(
mod_attr
(
morg
)))
mod_notes
<-
as.character
(
mod_attr
(
morg
)[[
'notes'
]])
if
(
(
"notes"
%in%
colnames
(
mod_attr
(
morg
)))
&&
(
printNotes
)
)
mod_notes
<-
as.character
(
mod_attr
(
morg
)[[
'notes'
]])
if
(
"annotation"
%in%
colnames
(
mod_attr
(
morg
)))
mod_annotation
<-
as.character
(
mod_attr
(
morg
)[[
'annotation'
]])
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
(
(
"notes"
%in%
colnames
(
comp_attr
(
morg
)))
&&
(
printNotes
)
)
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
(
(
"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
(
"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
(
"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
(
"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
{
# delete Formular and charge from notes to do
met_notes
<-
as.character
(
as.list
((
met_attr
(
morg
)[[
'notes'
]])))
met_notes
<-
as.character
(
as.list
((
met_attr
(
morg
)[[
'notes'
]])))
if
(
!
is.null
(
met_charge
)
||
!
is.null
(
met_formula
))
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
...
@@ -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
# 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'
]])))
react_notes
<-
as.character
(
as.list
((
react_attr
(
morg
)[[
'notes'
]])))
# using
# using
...
@@ -565,6 +563,7 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
...
@@ -565,6 +563,7 @@ exportSBML<- function(morg=NULL,level=2,version=4,FbcLevel=0,filename="export.xm
react_notes
,
react_notes
,
react_anno
,
react_anno
,
ex_react
,
ex_react
,
as.logical
(
validation
),
as.character
(
deformatGene
(
allgenes
))
as.character
(
deformatGene
(
allgenes
))
)
)
return
(
success
)
return
(
success
)
...
...
This diff is collapsed.
Click to expand it.
src/init.c
+
1
−
1
View file @
440f385c
...
@@ -54,7 +54,7 @@ static const R_CallMethodDef callMethods[] = {
...
@@ -54,7 +54,7 @@ static const R_CallMethodDef callMethods[] = {
{
"getSBMLCompartList"
,
(
DL_FUNC
)
&
getSBMLCompartList
,
1
},
{
"getSBMLCompartList"
,
(
DL_FUNC
)
&
getSBMLCompartList
,
1
},
{
"getSBMLSpeciesList"
,
(
DL_FUNC
)
&
getSBMLSpeciesList
,
1
},
{
"getSBMLSpeciesList"
,
(
DL_FUNC
)
&
getSBMLSpeciesList
,
1
},
{
"getSBMLReactionsList"
,
(
DL_FUNC
)
&
getSBMLReactionsList
,
1
},
{
"getSBMLReactionsList"
,
(
DL_FUNC
)
&
getSBMLReactionsList
,
1
},
{
"exportSBML"
,
(
DL_FUNC
)
&
exportSBML
,
3
3
},
{
"exportSBML"
,
(
DL_FUNC
)
&
exportSBML
,
3
4
},
{
"getSBMLFbcversion"
,
(
DL_FUNC
)
&
getSBMLFbcversion
,
1
},
{
"getSBMLFbcversion"
,
(
DL_FUNC
)
&
getSBMLFbcversion
,
1
},
{
NULL
,
NULL
,
0
}
{
NULL
,
NULL
,
0
}
};
};
...
...
This diff is collapsed.
Click to expand it.
src/sybilSBML.c
+
2304
−
2296
View file @
440f385c
...
@@ -1605,7 +1605,7 @@ void ParseModtoAnno (SBase_t* comp , char* Mannocopy)
...
@@ -1605,7 +1605,7 @@ void ParseModtoAnno (SBase_t* comp , char* Mannocopy)
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
)
{
{
//Varaibles from R
//Varaibles from R
const
char
*
fname
=
CHAR
(
STRING_ELT
(
filename
,
0
));
const
char
*
fname
=
CHAR
(
STRING_ELT
(
filename
,
0
));
...
@@ -1791,7 +1791,6 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
...
@@ -1791,7 +1791,6 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
Compartment_setId
(
comp
,
sName
);
Compartment_setId
(
comp
,
sName
);
Compartment_setConstant
(
comp
,
1
);
Compartment_setConstant
(
comp
,
1
);
if
(
strcmp
(
sName
,
"BOUNDARY"
)
==
0
||
strcmp
(
sName
,
"Boundary"
)
==
0
||
strcmp
(
sName
,
"boundary"
)
==
0
)
hasBoundary
=
1
;
if
(
strcmp
(
sName
,
"BOUNDARY"
)
==
0
||
strcmp
(
sName
,
"Boundary"
)
==
0
||
strcmp
(
sName
,
"boundary"
)
==
0
)
hasBoundary
=
1
;
if
(
!
Rf_isNull
(
com_notes
)
&&
Rf_length
(
com_notes
)
>
1
)
if
(
!
Rf_isNull
(
com_notes
)
&&
Rf_length
(
com_notes
)
>
1
)
{
{
char
*
Cnotes
=
(
char
*
)
CHAR
(
STRING_ELT
(
com_notes
,
i
));
char
*
Cnotes
=
(
char
*
)
CHAR
(
STRING_ELT
(
com_notes
,
i
));
...
@@ -1819,7 +1818,7 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
...
@@ -1819,7 +1818,7 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
/* Boundary Compartment */
/* Boundary Compartment */
if
(
hasBoundary
==
0
&&
Rf_isNull
(
met_bnd
)
&&
Rf_length
(
met_bnd
)
<=
1
)
if
(
hasBoundary
==
0
&&
Rf_isNull
(
met_bnd
)
&&
Rf_length
(
met_bnd
)
<=
1
&&
!
Rf_isNull
(
ex_react
)
)
{
{
comp
=
Model_createCompartment
(
model
);
comp
=
Model_createCompartment
(
model
);
Compartment_setId
(
comp
,
"BOUNDARY"
);
Compartment_setId
(
comp
,
"BOUNDARY"
);
...
@@ -1903,13 +1902,8 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
...
@@ -1903,13 +1902,8 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
if
((
Manno
!=
NULL
)
&&
(
Manno
[
0
]
!=
'\0'
))
if
((
Manno
!=
NULL
)
&&
(
Manno
[
0
]
!=
'\0'
))
{
{
//XMLNode_t * xmlannotation= RDFAnnotationParser_createAnnotation();
//XMLNode_t *rdf=RDFAnnotationParser_createRDFAnnotation(2,4);
//XMLNode_addChild(xmlannotation,(const XMLNode_t*) rdf);
//char *Mmetaid = (char*) CHAR(STRING_ELT(met_metaid, i));
SBase_setMetaId
((
SBase_t
*
)
sp
,
CHAR
(
STRING_ELT
(
met_id
,
i
)));
SBase_setMetaId
((
SBase_t
*
)
sp
,
CHAR
(
STRING_ELT
(
met_id
,
i
)));
//SBase_appendAnnotation((SBase_t*)sp, xmlannotation );
// COPY STRING
// COPY STRING
char
*
Manno
=
(
char
*
)
CHAR
(
STRING_ELT
(
met_anno
,
i
));
char
*
Manno
=
(
char
*
)
CHAR
(
STRING_ELT
(
met_anno
,
i
));
...
@@ -2094,7 +2088,7 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
...
@@ -2094,7 +2088,7 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
SpeciesReference_setStoichiometry
(
spr
,
fabs
(
REAL
(
SMatrix
)[
hash
]));
SpeciesReference_setStoichiometry
(
spr
,
fabs
(
REAL
(
SMatrix
)[
hash
]));
//is Exchange Reaction
//is Exchange Reaction
if
(
isexchange
==
1
)
if
(
isexchange
==
1
&&
!
Rf_isNull
(
ex_react
)
)
{
{
/* Create boundary Species */
/* Create boundary Species */
sp
=
Model_createSpecies
(
model
);
sp
=
Model_createSpecies
(
model
);
...
@@ -2281,6 +2275,20 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
...
@@ -2281,6 +2275,20 @@ SEXP exportSBML (SEXP version, SEXP level,SEXP FbcLevel, SEXP filename,SEXP sybi
}
}
}
}
// if VALIDATION TRUE FIND ERRORS
if
(
LOGICAL
(
validation
)[
0
]
==
1
)
{
unsigned
int
errors
=
0
;
errors
=
SBMLDocument_getNumErrors
(
sbmlDoc
);
// errors += SBMLDocument_checkConsistency(sbmlDoc); warnings
if
(
errors
>
0
){
SBMLDocument_printErrors
(
sbmlDoc
,
stdout
);
printf
(
"
\n
"
);
}
else
printf
(
"No errors
\n
"
);
}
// write SBML file
int
result
=
writeSBML
(
sbmlDoc
,
fname
);
int
result
=
writeSBML
(
sbmlDoc
,
fname
);
SEXP
out
=
R_NilValue
;
SEXP
out
=
R_NilValue
;
if
(
result
)
out
=
Rf_mkString
(
append_strings
(
"Wrote file"
,
fname
,
" "
));
if
(
result
)
out
=
Rf_mkString
(
append_strings
(
"Wrote file"
,
fname
,
" "
));
...
...
This diff is collapsed.
Click to expand it.
src/sybilSBML.h
+
1
−
1
View file @
440f385c
...
@@ -109,5 +109,5 @@ SEXP getSBMLSpeciesList(SEXP sbmlmod);
...
@@ -109,5 +109,5 @@ SEXP getSBMLSpeciesList(SEXP sbmlmod);
SEXP
getSBMLReactionsList
(
SEXP
sbmlmod
);
SEXP
getSBMLReactionsList
(
SEXP
sbmlmod
);
/* export Modelorg to SBML*/
/* 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
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment