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

bug in doubleFluxDel

parent 9a6ae39e
Branches
No related tags found
No related merge requests found
...@@ -60,8 +60,8 @@ doubleFluxDel <- function(model, react1, react2, lb = NULL, ub = NULL, ...@@ -60,8 +60,8 @@ doubleFluxDel <- function(model, react1, react2, lb = NULL, ub = NULL,
} }
} }
react1 <- sort(react_pos(react1)) react1 <- (react_pos(react1)) # removed sort here
react2 <- sort(react_pos(react2)) react2 <- (react_pos(react2)) # removed sort here
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
...@@ -94,6 +94,11 @@ doubleFluxDel <- function(model, react1, react2, lb = NULL, ub = NULL, ...@@ -94,6 +94,11 @@ doubleFluxDel <- function(model, react1, react2, lb = NULL, ub = NULL,
# print(react2) # print(react2)
if (isTRUE(allComb)) { if (isTRUE(allComb)) {
# if allComb is used, duplicated entries in react1 or react2 dont make
# sense:
react1 <- unique(react1)
react2 <- unique(react2)
# Compute Boolean matrix with TRUE in the upper triangonal # Compute Boolean matrix with TRUE in the upper triangonal
# (the maximum number of comparisons) # (the maximum number of comparisons)
...@@ -130,38 +135,38 @@ doubleFluxDel <- function(model, react1, react2, lb = NULL, ub = NULL, ...@@ -130,38 +135,38 @@ doubleFluxDel <- function(model, react1, react2, lb = NULL, ub = NULL,
# The number of TRUE's in tmpMAT is equal to the number of optimizations # The number of TRUE's in tmpMAT is equal to the number of optimizations
num_opt <- sum(tmpMAT == TRUE) num_opt <- sum(tmpMAT == TRUE)
}
else {
tmpMAT <- matrix(FALSE, nrow = react_num(model),
ncol = react_num(model))
for (i in 1:num_react1) {
tmpMAT[react1[i], react2[i]] <- TRUE
}
#tmpMAT[geneList1, geneList2] <- TRUE
num_opt <- num_react1
tmpMAT <- tmpMAT[react1, react2]
}
rownames(tmpMAT) <- react1 rownames(tmpMAT) <- react1
colnames(tmpMAT) <- react2 colnames(tmpMAT) <- react2
deletions <- which(tmpMAT == TRUE, arr.ind = TRUE)
koreactID <- cbind(react1[deletions[,"row"]],
react2[deletions[,"col"]])
}
else {
koreactID <- cbind(react1, react2)
# tmpMAT <- matrix(FALSE, nrow = react_num(model),
# ncol = react_num(model))
# for (i in 1:num_react1) {
# tmpMAT[react1[i], react2[i]] <- TRUE
# }
# #tmpMAT[geneList1, geneList2] <- TRUE
# browser()
# num_opt <- num_react1
# tmpMAT <- tmpMAT[react1, react2]
}
koreact <- lapply(seq_len(nrow(koreactID)), function(x) koreactID[x, ])
browser()
# The number of TRUE's in tmpMAT is equal to the number of optimizations # The number of TRUE's in tmpMAT is equal to the number of optimizations
# print(num_opt) # print(num_opt)
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# run optimization # # run optimization #
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
deletions <- which(tmpMAT == TRUE, arr.ind = TRUE)
koreactID <- cbind(react1[deletions[,"row"]],
react2[deletions[,"col"]])
koreact <- lapply(seq_len(nrow(koreactID)), function(x) koreactID[x, ])
if (is.null(lb)) { if (is.null(lb)) {
lb <- rep(0, length(koreact)) lb <- rep(0, length(koreact))
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
\item \code{findExchangeReact} can now deal with real big matrices (>30.000 columns). \item \code{findExchangeReact} can now deal with real big matrices (>30.000 columns).
\item additional example for readProb and writeProb. \item additional example for readProb and writeProb.
\item modified \code{multiDel} to not use \code{require} \item modified \code{multiDel} to not use \code{require}
\item \code{doubleFluxDel} had a bug if \code{react1} or \code{react2} contained duplicated entries.
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment