Compare commits

..

No commits in common. "de4984c2c0257a364362642b9e28f3551c6fdac3" and "e6c38905b36b4e5b7e8ac12040bd3d9d5acdc493" have entirely different histories.

2 changed files with 1 additions and 43 deletions

View file

@ -6,7 +6,7 @@ path <- args[1]
base_folder <- str_remove(string = path, pattern = "/tmp[0-9]*/?$")
base_folder <- str_remove(string = path, pattern = "/tmp[0-9]*$")
print(base_folder)
epoch <- str_extract(string = path, pattern = "(?<=tmp)([0-9]*)")

View file

@ -1,42 +0,0 @@
library(sbm)
library(phyloseq)
library(biomformat)
library(here)
source("utils.R")
options(parallelly.availableCores.custom = function() {
ncores <- min(parallelly::availableCores(), 64)
max(1L, ncores)
})
message(paste("Number of cores available:", parallelly::availableCores()))
args <- commandArgs(trailingOnly = TRUE)
if (length(args) == 0) {
author <- "mach"
} else {
author <- args[1]
}
message("For author: ", author)
the_data <- import_biom(here("data", author, paste0(author, ".biom")))
epoch <- as.integer(Sys.time())
per_taxa_networks <- collapse_otu_at_taxo(the_data)
per_taxa_networks <- per_taxa_networks[-1]
lbm_list <- lapply(seq_along(per_taxa_networks), function(idx) {
defineSBM(per_taxa_networks[[idx]], model = "poisson", dimLabels = c(row = paste0("Rank", idx + 1), col = "Sample"))
})
lbm_list_covariates <- lapply(seq_along(per_taxa_networks), function(idx) {
covar_sd <- log(rep(1, nrow(per_taxa_networks[[idx]])) %*% t(colSums(per_taxa_networks[[idx]])))
defineSBM(per_taxa_networks[[idx]], model = "poisson", dimLabels = c(row = paste0("Rank", idx + 1), col = "Sample"), covariates = list(covar_sd))
})
multipartite_fit <- estimateMultipartiteSBM(listSBM = lbm_list, estimOptions = list(initBM = FALSE))
multipartite_covariates_fit <- estimateMultipartiteSBM(listSBM = lbm_list_covariates, estimOptions = list(initBM = FALSE))
plot(multipartite_covariates_fit)