diff --git a/networkComplexityBigg/modelchecks/checkFunctions.R b/networkComplexityBigg/modelchecks/checkFunctions.R new file mode 100644 index 0000000000000000000000000000000000000000..7948aed666b6c56fbbfa971a9ab5d6131c3e0736 --- /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)) + +}