diff --git a/DESCRIPTION b/DESCRIPTION index 6798ad6118f493a90e74bed390e9ce0e1d9d3a4e..d0982c35aec935ac92058c3e915c6c59d4dc034c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: sybilSBML Type: Package Title: SBML Integration in Package 'Sybil' -Version: 3.0.7 -Date: 2019-08-02 +Version: 3.0.8 +Date: 2020-03-10 Authors@R: c(person("Mayo", "Roettger", role = "cre", email = "mayo.roettger@hhu.de"), person("Gabriel", "Gelius-Dietrich", role = c("aut", "ctb")), person(c("C.", "Jonathan"), "Fritzemeier", role = "ctb", email = "clausjonathan.fritzemeier@uni-duesseldorf.de"), @@ -17,7 +17,7 @@ License: GPL-3 | file LICENSE LazyLoad: yes Collate: generics.R sbmlPtrClass.R sbmlErrorClass.R sybilSBML.R uglyHack.R readSBMLmod.R zzz.R -Packaged: 2019-08-02 15:05:20 UTC; mayo +Packaged: 2020-03-10 09:00:00 UTC; mayo Author: Mayo Roettger [cre], Gabriel Gelius-Dietrich [aut, ctb], C. Jonathan Fritzemeier [ctb], diff --git a/R/readSBMLmod.R b/R/readSBMLmod.R index 5575ee0da9c14f53c782ea73a0be53677864468d..66f13ef05989d08f043c6313f91bc53fea2adaae 100644 --- a/R/readSBMLmod.R +++ b/R/readSBMLmod.R @@ -973,16 +973,15 @@ else { # if there were fbcgprRules or notes with gpr rules, # create reaction x nGene matrix, with TRUE for respective genes for each reaction - if (isTRUE(hasNotes) || !is.null(fbcgprRules) ) { + if (isTRUE(hasNotes) || !is.null(fbcgprRules) ) { message("GPR mapping ... ", appendLF = FALSE) # Vector with all gene names != "": - #allGenes <- unique(allGenes) - #allGenesTMP <- unique(allGenes) allGenesTMP <- unique(unlist(genes)) temp <- nchar(allGenesTMP) allGenes <- allGenesTMP[which(temp != 0)] - + + # reaction x nGene matrix initialization with FALSE: rxnGeneMat <- Matrix::Matrix(FALSE, nrow = numreact, ncol = length(allGenes), @@ -990,7 +989,7 @@ else { for (i in 1 : numreact) { # if genes list element i has only 1 element and that element is not equal "" - if ( (length(genes[[i]] == 1)) && (genes[[i]] != "") ) { + if ( (length(genes[[i]] == 1)) && all(genes[[i]] != "") ) { geneInd <- match(genes[[i]], allGenes)# find gene in allGenes # Mark which genes are used in reaction with TRUE rxnGeneMat[i, geneInd] <- TRUE diff --git a/R/sybilSBML.R b/R/sybilSBML.R index 12c0a0a02603ba1224292db9a8c883b26b922b06..00afb097025668f68b509b581f56c885c8d0bdc5 100644 --- a/R/sybilSBML.R +++ b/R/sybilSBML.R @@ -362,15 +362,15 @@ writeSBML<- function(morg=NULL,level=2,version=4,fbcLevel=0,filename="export.xml # test if Matrix has no double values if( !all( S(morg) == floor(S(morg))) ) warning("Level 1 does not support double values") fbcLevel=0 - if(version != 2) - { - warning("just Level 1 Version 2 will be supported") - version=2 - } - }else if (level==2) + if(version != 2) + { + warning("just Level 1 Version 2 will be supported") + version=2 + } + } else if (level==2) { fbcLevel=0 - if(version >5) + if(version > 5) { warning("Level 2 Version 5 will be supported") version=5 @@ -380,16 +380,19 @@ writeSBML<- function(morg=NULL,level=2,version=4,fbcLevel=0,filename="export.xml warning("Level 2 Version 1 will be supported") version=1 } - } - else if (level==3) - { if(fbcLevel >2)fbcLevel=2 - if(version != 1) - { - print("Level 3 Version 1 will be supported") - version=1 - } - - }else { + } else if (level==3) + { + if(fbcLevel > 2) + { + print("FBC level 2 will be supported") + fbcLevel=2 + } + if(version != 1) + { + print("Level 3 Version 1 will be supported") + version=1 + } + } else { stop(" Support just for Level 1,2 and 3 \n") } @@ -630,6 +633,7 @@ writeSBML<- function(morg=NULL,level=2,version=4,fbcLevel=0,filename="export.xml as.integer(obj_coef(morg)), as.character(newsubS), subSysGroups, + as.character(names(subSysGroups)), as.character(deformatGene(gpr(morg))), as.numeric(shrinkMatrix(morg,j=1:react_num(morg))), mod_notes, diff --git a/configure b/configure index 331c6a410c86fb2487eb9a35b57d79fa235d8f73..c1eee2afb8b8e52383259ec7e164a4a8fe00fd82 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sybilSBML 3.0.7. +# Generated by GNU Autoconf 2.69 for sybilSBML 3.0.8. # # Report bugs to <mayo.roettger@hhu.de>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sybilSBML' PACKAGE_TARNAME='sybilsbml' -PACKAGE_VERSION='3.0.7' -PACKAGE_STRING='sybilSBML 3.0.7' +PACKAGE_VERSION='3.0.8' +PACKAGE_STRING='sybilSBML 3.0.8' PACKAGE_BUGREPORT='mayo.roettger@hhu.de' PACKAGE_URL='' @@ -1241,7 +1241,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sybilSBML 3.0.7 to adapt to many kinds of systems. +\`configure' configures sybilSBML 3.0.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1303,7 +1303,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sybilSBML 3.0.7:";; + short | recursive ) echo "Configuration of sybilSBML 3.0.8:";; esac cat <<\_ACEOF @@ -1390,7 +1390,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sybilSBML configure 3.0.7 +sybilSBML configure 3.0.8 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1759,7 +1759,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sybilSBML $as_me 3.0.7, which was +It was created by sybilSBML $as_me 3.0.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2118,7 +2118,7 @@ if test -z "${R_HOME}"; then fi CC=`"${R_HOME}/bin/R" CMD config CC` -CPP=`"${R_HOME}/bin/R" CMD config CPP` +#CPP=`"${R_HOME}/bin/R" CMD config CPP` CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS` CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS` ac_ext=c @@ -4249,7 +4249,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sybilSBML $as_me 3.0.7, which was +This file was extended by sybilSBML $as_me 3.0.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4311,7 +4311,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sybilSBML config.status 3.0.7 +sybilSBML config.status 3.0.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index b06394883dbb205e35d64f08f6fecdb478cf56f1..da793207fa181a33719c5d9fe87272dca88b8919 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([sybilSBML], [3.0.7], [mayo.roettger@hhu.de]) +AC_INIT([sybilSBML], [3.0.8], [mayo.roettger@hhu.de]) dnl # -------------------------------------------------------------------- dnl # global (environment) variables @@ -21,7 +21,7 @@ fi dnl # GNU R default settings CC=`"${R_HOME}/bin/R" CMD config CC` -CPP=`"${R_HOME}/bin/R" CMD config CPP` +#CPP=`"${R_HOME}/bin/R" CMD config CPP` CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS` CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS` AC_PROG_CC diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 06c5ee4841d8c865a8fe13ec695836bcf0cc68e9..bf802cd533a26157a145f683858b87dcbf1c8634 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -6,15 +6,19 @@ \newcommand{\CRANpkg}{\href{https://cran.r-project.org/package=#1}{\pkg{#1}}} % ---------------------------------------------------------------------------- % -\section{Changes in version 3.0.4 - 3.0.7 2019-08-02}{ +\section{Changes in version 3.0.4 - 3.0.8 2020-03-10}{ \itemize{ \item Maintainer change. \item Changes to be able to build package without libSBML FBC and Groups plugins. In that case, FBC-constraints and groups in the SBML model will be ignored. Added functions \code{isAvailableFBCPlugin} and \code{isAvailableGroupsPlugin}. + \item Corrections for CRAN, where && or || encountered arguments of length > 1. + \item Fix for CRAN issue: 'config' variable 'CPP' is deprecated. + \item Fix for CRAN issue: too many states (abstraction error?). } } + % ---------------------------------------------------------------------------- % \section{Changes in version 3.0.3 2018-01-02}{ \itemize{ @@ -23,6 +27,7 @@ for some newer models. } } + % ---------------------------------------------------------------------------- % \section{Changes in version 3.0.2 2017-10-24}{ \itemize{ diff --git a/src/Makevars b/src/Makevars deleted file mode 100644 index 5838658e85fd269833f18ecd4d5efd55afdbab67..0000000000000000000000000000000000000000 --- a/src/Makevars +++ /dev/null @@ -1,3 +0,0 @@ -PKG_CFLAGS= -PKG_CPPFLAGS=-I/usr/include -I/usr/local/include -I/usr/include/sbml -I/usr/local/include/sbml -PKG_LIBS= -L/usr/local/lib -L/usr/lib -L/usr/lib64 -lsbml diff --git a/src/config.h b/src/config.h deleted file mode 100644 index 60423413a273333855cd80ab44d6eeff29f80032..0000000000000000000000000000000000000000 --- a/src/config.h +++ /dev/null @@ -1,82 +0,0 @@ -/* src/config.h. Generated from config.h.in by configure. */ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the `FbcReactionPlugin_getLowerFluxBound' function. - */ -#define HAVE_FBCREACTIONPLUGIN_GETLOWERFLUXBOUND 1 - -/* define if FBC plugin is available */ -#define HAVE_FBC_PLUGIN 1 - -/* Define to 1 if you have the `GeneProductAssociation_setAssociation' - function. */ -#define HAVE_GENEPRODUCTASSOCIATION_SETASSOCIATION 1 - -/* define if Groups plugin is available */ -#define HAVE_GROUPS_PLUGIN 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `sbml' library (-lsbml). */ -#define HAVE_LIBSBML 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `SBase_getPlugin' function. */ -#define HAVE_SBASE_GETPLUGIN 1 - -/* Define to 1 if you have the `SBMLExtensionRegistry_getRegisteredPackages' - function. */ -#define HAVE_SBMLEXTENSIONREGISTRY_GETREGISTEREDPACKAGES 1 - -/* Define to 1 if you have the <sbml/packages/fbc/common/FbcExtensionTypes.h> - header file. */ -#define HAVE_SBML_PACKAGES_FBC_COMMON_FBCEXTENSIONTYPES_H 1 - -/* Define to 1 if you have the - <sbml/packages/groups/common/GroupsExtensionTypes.h> header file. */ -#define HAVE_SBML_PACKAGES_GROUPS_COMMON_GROUPSEXTENSIONTYPES_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "mayo.roettger@hhu.de" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "sybilSBML" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "sybilSBML 3.0.6" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "sybilsbml" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "3.0.6" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 diff --git a/src/init.c b/src/init.c index 89e831f3a03b1de23304dbe68768d27dfad63afe..d5905ed09ea7fc396d76416b4e9775ec77951596 100644 --- a/src/init.c +++ b/src/init.c @@ -55,7 +55,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, 34}, + {"exportSBML", (DL_FUNC) &exportSBML, 35}, {"getSBMLFbcversion", (DL_FUNC) &getSBMLFbcversion, 1}, {"isAvailableFbcPlugin", (DL_FUNC) &isAvailableFbcPlugin, 0}, {"isAvailableGroupsPlugin", (DL_FUNC) &isAvailableGroupsPlugin, 0}, diff --git a/src/sybilSBML.c b/src/sybilSBML.c index 32e1b948a749a5f1bd73515d474a2c0d25c61b0a..a76ff8ce9583d690b933fbffb970526e7ad70286 100644 --- a/src/sybilSBML.c +++ b/src/sybilSBML.c @@ -1682,12 +1682,12 @@ 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 subSysGroups, 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 subSysGroups, SEXP subSysGroupsNames, 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) { #if defined(HAVE_FBC_PLUGIN) && defined(HAVE_GROUPS_PLUGIN) - //Varaibles from R + //Variables from R const char* fname = CHAR(STRING_ELT(filename, 0)); - const char* model_desc = CHAR(STRING_ELT(mod_desc, 0)); + //unused: const char* model_desc = CHAR(STRING_ELT(mod_desc, 0)); const char* model_name = CHAR(STRING_ELT(mod_name, 0)); int SBMLlevel = INTEGER(level)[0]; @@ -1698,7 +1698,7 @@ SEXP exportSBML (SEXP version, SEXP level, SEXP FbcLevel, SEXP filename, SEXP sy double sybilmin = sybilmax*(-1); // variable FBC - XMLNamespaces_t * fbc; + //currently unused: XMLNamespaces_t * fbc; SBMLNamespaces_t * sbmlns; FluxBound_t * fluxBound; Objective_t * objective; @@ -1712,13 +1712,13 @@ SEXP exportSBML (SEXP version, SEXP level, SEXP FbcLevel, SEXP filename, SEXP sy // Variable inital - - SBMLDocument_t* sbmlDoc; + SBMLDocument_t* sbmlDoc = NULL; + Model_t* model; XMLNamespaces_t* xmlns; - UnitDefinition_t* unitdef; - Unit_t* unit; + //currently unused: UnitDefinition_t* unitdef; + //currently unused: Unit_t* unit; Species_t *sp; Reaction_t* reaction; @@ -1727,7 +1727,7 @@ SEXP exportSBML (SEXP version, SEXP level, SEXP FbcLevel, SEXP filename, SEXP sy KineticLaw_t* kl; Parameter_t* para; - // ASTNode_t* flux; + // ASTNode_t* flux; ASTNode_t* astMath; //ASTNode_t* ast; //char* mathXMLString; @@ -2300,6 +2300,7 @@ SEXP exportSBML (SEXP version, SEXP level, SEXP FbcLevel, SEXP filename, SEXP sy }// ENDE REACTION + if(SBMLfbcversion == 1) { @@ -2358,30 +2359,31 @@ SEXP exportSBML (SEXP version, SEXP level, SEXP FbcLevel, SEXP filename, SEXP sy } } - + /* add subsystem as groups if fbc is >= 2 */ if(SBMLfbcversion >= 2){ if(!Rf_isNull(subSysGroups)){ - GroupsModelPlugin_t* groupsPlug = NULL; + GroupsModelPlugin_t* groupsPlug = NULL; groupsPlug = (GroupsModelPlugin_t*) SBase_getPlugin((SBase_t *)(model), "groups"); - + for(int i=0; i < Rf_length(subSysGroups); i++){ Group_t* newGroup = GroupsModelPlugin_createGroup(groupsPlug); Group_setKindAsString(newGroup, "partonomy"); - Group_setName(newGroup, CHAR(STRING_ELT(Rf_getAttrib(subSysGroups, R_NamesSymbol), i))); + Group_setName(newGroup, CHAR(STRING_ELT(subSysGroupsNames, i))); SBase_setSBOTerm((SBase_t *) newGroup, 0000633); - + for(int j=0; j < Rf_length(VECTOR_ELT(subSysGroups, i)); j++){ Member_t* newMember = Member_create(SBMLlevel, SBMLversion, SBMLgroupsversion); Member_setIdRef(newMember, CHAR(STRING_ELT(VECTOR_ELT(subSysGroups, i), j))); Group_addMember(newGroup, newMember); } + //GroupsModelPlugin_addGroup(groupsPlug, newGroup); } } } - + // write SBML file int result = writeSBML(sbmlDoc, fname); SEXP out = R_NilValue; @@ -2390,7 +2392,7 @@ SEXP exportSBML (SEXP version, SEXP level, SEXP FbcLevel, SEXP filename, SEXP sy #else SEXP out = Rf_ScalarLogical(0);/* no success */ #endif - + //UNPROTECT(1); return out; } diff --git a/src/sybilSBML.h b/src/sybilSBML.h index 3f7526a9b3028359fdf7d8338798ff1e592e6044..86ce41def8c3acc49affc94c3eb1b89a9b57e4d6 100644 --- a/src/sybilSBML.h +++ b/src/sybilSBML.h @@ -112,7 +112,7 @@ SEXP getSBMLGroupsList(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 subSysGroups, 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 subSysGroups, SEXP subSysGroupsNames, 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); /* check, if FBC-Plugin is available */ SEXP isAvailableFbcPlugin(); diff --git a/src/symbols.rds b/src/symbols.rds index 86d3f8e1d4117ef59178496ee79fda1f4224d930..6c50fca8d9500273b256cbe890ebb2d111bb0c44 100644 Binary files a/src/symbols.rds and b/src/symbols.rds differ