source("utils.R") source("utils-bm-seq.R") library(biomformat) library(phyloseq) library(R.utils) library(stringr) library(sbm) library(blockmodels) library(tictoc) the_data <- import_biom("data/mach/kinetic.biom") # fit_res <- lapply(per_taxa_network, function(network) { # withTimeout( # expr = { # fit <- estimateBipartiteSBM(network, model = "poisson", estimOptions = list(plot = 0)) # }, timeout = 300, # onTimeout = "warning" # ) # if (exists("fit")) { # out <- fit # } else { # out <- NULL # } # return(fit) # }) # To init a BM model I need to provide memberships and ICL # And to compute with the dispatcher the previous values to init the models with ICL and memberships per_taxa_networks <- collapse_otu_at_taxo(the_data) tic() r2_model <- BM_poisson( membership_type = "LBM", adj = per_taxa_networks[[2]], # Account for the root verbosity = 6, plotting = "", ncores = 1, # parallelly::availableCores(), autosave = "r2test.Rds" ) r2_model$estimate() toc() r3_model <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 2, target_rank_id = 3, per_taxa_networks = per_taxa_networks, first_model = r2_model, autosave = "r3test.Rds") r4_model <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 3, per_taxa_networks = per_taxa_networks, first_model = r3_model) r5_model <- bm_propagate_taus_all_models(phyloseq_data = the_data, rank_id_start = 4, per_taxa_networks = per_taxa_networks, first_model = r4_model)