diff --git a/DESCRIPTION b/DESCRIPTION index a46a8fadbfcd2b5899b420b9d55f380ea899d004..b02d8a554b395fb81d9967500b47a775d73a8e61 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: sybilSBML Type: Package Title: SBML Integration in Package 'Sybil' Version: 3.0.2 -Date: 2017-01-12 +Date: 2017-10-24 Authors@R: c(person(c("C.", "Jonathan"), "Fritzemeier", role = c("cre", "ctb"), email = "clausjonathan.fritzemeier@uni-duesseldorf.de"), person("Gabriel", "Gelius-Dietrich", role = c("aut", "ctb")), person("Deya", "Alzoubi", role = "ctb"), @@ -16,7 +16,7 @@ License: GPL-3 | file LICENSE LazyLoad: yes Collate: generics.R sbmlPtrClass.R sbmlErrorClass.R sybilSBML.R uglyHack.R readSBMLmod.R zzz.R -Packaged: 2017-01-12 07:11:55 UTC; jonathan +Packaged: 2017-10-24 07:11:55 UTC; jonathan Author: C. Jonathan Fritzemeier [cre, ctb], Gabriel Gelius-Dietrich [aut, ctb], Deya Alzoubi [ctb], diff --git a/R/sybilSBML.R b/R/sybilSBML.R index b3eb40bee432ac7871489f4779c8fd2d086de6b1..88abbc47d3ee600616b9b72268e842a38aef2d49 100644 --- a/R/sybilSBML.R +++ b/R/sybilSBML.R @@ -421,20 +421,63 @@ writeSBML<- function(morg=NULL,level=2,version=4,fbcLevel=0,filename="export.xml ### Start newSybil attr if(newSybil) { - 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(mod_attr(morg))) && (printNotes) ) { + mod_notes<-as.character(mod_attr(morg)[['notes']]) + if(any(is.na(mod_notes))){ + stop("mod_notes mustn't be NA") + } + } + if(("annotation" %in% colnames(mod_attr(morg))) && (printAnnos) ) { + mod_annotation<-as.character(mod_attr(morg)[['annotation']]) + if(any(is.na(mod_annotation))){ + stop("mod_annotation mustn't be NA") + } + } - 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(("notes" %in% colnames(comp_attr(morg))) && (printNotes) ){ + com_notes<-as.character(as.list((comp_attr(morg)[['notes']]))) + if(any(is.na(com_notes))){ + stop("com_notes mustn't be NA") + } + } + if(("annotation" %in% colnames(comp_attr(morg))) && (printAnnos) ){ + com_annotation<-as.character(as.list((comp_attr(morg)[['annotation']]))) + if(any(is.na(com_annotation))){ + stop("com_annotation mustn't be NA") + } + } - 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))) && (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("charge" %in% colnames(met_attr(morg))){ + met_charge<- as.integer(as.list((met_attr(morg)[['charge']]))) + if(any(is.na(met_charge))){ + stop("met_charge mustn't be NA") + } + } + if("chemicalFormula" %in% colnames(met_attr(morg))){ + met_formula<-as.character(as.list((met_attr(morg)[['chemicalFormula']]))) + if(any(is.na(met_formula))){ + stop("met_formula mustn't be NA") + } + } + if(("annotation" %in% colnames(met_attr(morg))) && (printAnnos)){ + met_anno<-as.character(as.list((met_attr(morg)[['annotation']]))) + if(any(is.na(mod_notes))){ + stop("met_anno mustn't be NA") + } + } + if("boundaryCondition" %in% colnames(met_attr(morg))){ + met_bnd<-as.logical(as.list((met_attr(morg)[['boundaryCondition']]))) + if(any(is.na(met_bnd))){ + stop("met_bnd mustn't be NA") + } + } 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(any(is.na(met_notes))){ + stop("met_notes mustn't be NA") + } if (!is.null(met_charge) || !is.null(met_formula)) { for ( i in 1:met_num(morg)) @@ -478,12 +521,21 @@ writeSBML<- function(morg=NULL,level=2,version=4,fbcLevel=0,filename="export.xml } } - if(("annotation" %in% colnames(react_attr(morg))) && (printAnnos)) 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']]))) + if(any(is.na(react_anno))){ + stop("react_anno mustn't be NA") + } + } # Merge Notes with "our" Notes and make sure gpr Rules from gpr if(("notes" %in% colnames(react_attr(morg))) && (printNotes)) { react_notes<-as.character(as.list((react_attr(morg)[['notes']]))) + if(any(is.na(react_notes))){ + stop("react_notes mustn't be NA") + } + # using # SubSystem EXISTIERT nicht colnames(subSys(ec)) @@ -572,4 +624,4 @@ writeSBML<- function(morg=NULL,level=2,version=4,fbcLevel=0,filename="export.xml } else message(paste("Could not write file ",filename,"\n",sep=""), appendLF = FALSE); return (success) -} \ No newline at end of file +} diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 043c9615087a4614204fb3a54940ca80891369c3..e90f8c537de81f3bf32503dbcb22bb8a3d190366 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -5,6 +5,12 @@ \encoding{UTF-8} \newcommand{\CRANpkg}{\href{https://cran.r-project.org/package=#1}{\pkg{#1}}} +% ---------------------------------------------------------------------------- % +\section{Changes in version 3.0.2 2017-10-24}{ + \itemize{ + \item Removed bug when trying to write models with NA in, e.g. \code{met_attr}. + } +} % ---------------------------------------------------------------------------- % \section{Changes in version 3.0.1 2016-12-16}{