Skip to content
Snippets Groups Projects
Commit f04aaf31 authored by Claus Jonathan Fritzemeier's avatar Claus Jonathan Fritzemeier
Browse files

bug fixed

parent 47742fd9
Branches rmReactBug
No related tags found
No related merge requests found
...@@ -211,8 +211,14 @@ addReact <- function(model, ...@@ -211,8 +211,14 @@ addReact <- function(model,
# subsystems # subsystems
if (any(is.na(subSystem))) { if (any(is.na(subSystem))) {
newsubSys <- rBind(subSys(model), ss <- subSys(model)
rep(FALSE, ncol(subSys(model)))) if(ncol(ss)==0){ # if no subSys defined, rbind (see else) failed
dim(ss) <- c(nrow(ss)+1, ncol(ss))
newsubSys <- ss
}
else {
newsubSys <- rBind(ss, rep(FALSE, ncol(subSys(model))))
}
} }
else { else {
if (is(subSystem, "logical")) { if (is(subSystem, "logical")) {
...@@ -230,14 +236,12 @@ addReact <- function(model, ...@@ -230,14 +236,12 @@ addReact <- function(model,
newrxnGeneMat <- rBind(rxnGeneMat(model), newrxnGeneMat <- rBind(rxnGeneMat(model),
rep(FALSE, ncol(rxnGeneMat(model)))) rep(FALSE, ncol(rxnGeneMat(model))))
} }
else if (nrow(rxnGeneMat(model)) > 0) { else { #if (nrow(rxnGeneMat(model)) > 0) {
newrxnGeneMat <- rxnGeneMat(model) newrxnGeneMat <- rxnGeneMat(model)
dim(newrxnGeneMat) <- c(nrow(newrxnGeneMat)+1, dim(newrxnGeneMat) <- c(nrow(newrxnGeneMat)+1,
ncol(newrxnGeneMat)) ncol(newrxnGeneMat))
} }
else { # do above else always.
newrxnGeneMat <- rxnGeneMat(model)
}
if ( (is.na(gprAssoc)) || (gprAssoc == "") ) { if ( (is.na(gprAssoc)) || (gprAssoc == "") ) {
if ((length(gprRules(model)) > 0)) { if ((length(gprRules(model)) > 0)) {
...@@ -274,14 +278,9 @@ addReact <- function(model, ...@@ -274,14 +278,9 @@ addReact <- function(model,
newrxnGeneMat <- cBind(newrxnGeneMat, newrxnGeneMat <- cBind(newrxnGeneMat,
rep(FALSE, nrow(newrxnGeneMat))) rep(FALSE, nrow(newrxnGeneMat)))
} }
# print("arsch")
} }
} }
# print(newrxnGeneMat)
# print(nCols)
# print(geneInd)
# rxnGeneMat # rxnGeneMat
newrxnGeneMat[nCols, geneInd] <- TRUE newrxnGeneMat[nCols, geneInd] <- TRUE
......
...@@ -148,8 +148,16 @@ rmReact <- function(model, react, rm_met = TRUE) { ...@@ -148,8 +148,16 @@ rmReact <- function(model, react, rm_met = TRUE) {
subSys(mod_out) <- subSys(model)[keepReact, , drop = FALSE] subSys(mod_out) <- subSys(model)[keepReact, , drop = FALSE]
ag <- unique(unlist(genes(mod_out))) ag <- unique(unlist(genes(mod_out)))
# old code tried to assign NULL to allGenes, if no gene was left.
if(length(ag)==0){
allGenes(mod_out) <- character(0)
}
else {
ncag <- nchar(ag) ncag <- nchar(ag)
allGenes(mod_out) <- ag[which(ncag != 0)] ag <- ag[which(ncag != 0)]
allGenes(mod_out) <- ag
}
# reaction to gene mapping # reaction to gene mapping
#SrGMbin <- rxnGeneMat(mod_out) != 0 #SrGMbin <- rxnGeneMat(mod_out) != 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment