From f2c84f30a1e631936d7df20c259c30b7785640b9 Mon Sep 17 00:00:00 2001 From: Claus Jonathan Fritzemeier <clausjonathan.fritzemeier@hhu.de> Date: Fri, 9 Sep 2016 12:43:38 +0200 Subject: [PATCH] after rmReact columns in rxnGeneMatrix and allGenes didnt match --- R/rmReact.R | 16 ++-------------- inst/NEWS.Rd | 2 ++ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/R/rmReact.R b/R/rmReact.R index 0efb32c..c420d70 100644 --- a/R/rmReact.R +++ b/R/rmReact.R @@ -162,21 +162,9 @@ rmReact <- function(model, react, rm_met = TRUE) { ag <- ag[which(ncag != 0)] allGenes(mod_out) <- ag } - #TODO: update indices in the GPR rules accoording to the updated allGenes slot! - - # reaction to gene mapping - #SrGMbin <- rxnGeneMat(mod_out) != 0 - - #SrGMbindiag <- diag(crossprod(SrGMbin)) - - #keepGenes <- ifelse(SrGMbindiag == 0, FALSE, TRUE) - keepGenes <- sapply(allGenes(model), function(x) match(x, allGenes(mod_out))) - keepGenes <- ifelse(is.na(keepGenes), FALSE, TRUE) - #print(keepGenes) - - rxnGeneMat(mod_out) <- rxnGeneMat(mod_out)[, keepGenes, drop = FALSE] - #print(dim(rxnGeneMat)) + newGeneOrder <- match(allGenes(mod_out), allGenes(model)) + rxnGeneMat(mod_out) <- rxnGeneMat(mod_out)[, newGeneOrder, drop = FALSE] } diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 9f9fd1f..7e44a59 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -8,6 +8,8 @@ \section{Changes in version 2.0.1 2016-07-05}{ \itemize{ + \item After \code{rmReact} the columns of \code{rxnGeneMat} and + \code{allGenes}-slot did not match. \item \code{upgradeModelorg} was not working correctly, when all gprRules are empty. } -- GitLab