From 470e4c906d06c481d4f0e8d8df6f4c8015808b84 Mon Sep 17 00:00:00 2001 From: Sajjad Ghaffarinasabsharabiani <ghaffas@hhu.de> Date: Tue, 9 Aug 2022 10:24:44 +0000 Subject: [PATCH] Upload New File --- .../modelchecks/checkFunctions.R | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 networkComplexityBigg/modelchecks/checkFunctions.R diff --git a/networkComplexityBigg/modelchecks/checkFunctions.R b/networkComplexityBigg/modelchecks/checkFunctions.R new file mode 100644 index 0000000..7948aed --- /dev/null +++ b/networkComplexityBigg/modelchecks/checkFunctions.R @@ -0,0 +1,37 @@ +compareReactionsFromDifferentModels <- function(models, id){ + + if(length(id)==1){ + id <- rep(id, length(models)) + } + names(id) <- models + stopifnot(length(models)==length(id)) + + + s <- lapply(models, + function(m){ + sm <- shrinkMatrix(allModels[[m]], j=id[m]) + sm[order(rownames(sm)), ,drop=F] + } + ) + + # are rownames equal!? + rn <- lapply(s, rownames) + if(!all(table(unlist(rn))==length(models))){ + print(models) + print(id) + print(table(unlist(rn))) + stop("reaction definition differ in checked models") + } + + + s <- do.call(cBind, s) + +# print(s) + + check <- apply(s, 1, function(x){ + length(unique(x))==1 + }) + + return(all(check)) + +} -- GitLab