human-microbiome-compendium/multipartite-lbm.R
2025-10-17 16:47:54 +02:00

23 lines
818 B
R

library("sbm")
library("phyloseq")
library("microbiome")
source("load-europe.R")
# Define the taxonomy structure as a multipartite network
type <- "bipartite"
model <- "poisson"
## Define all adjacency matrices
kingdom_sample_mat <- otu_table(aggregate_taxa(cpd_phyloseq_europe, level = "kingdom"))
phylum_sample_mat <- otu_table(aggregate_taxa(cpd_phyloseq_europe, level = "phylum"))
class_sample_mat <- otu_table(aggregate_taxa(cpd_phyloseq_europe, level = "class"))
order_sample_mat <- otu_table(aggregate_taxa(cpd_phyloseq_europe, level = "order"))
family_sample_mat <- otu_table(aggregate_taxa(cpd_phyloseq_europe, level = "family"))
genus_sample_mat <- otu_table(aggregate_taxa(cpd_phyloseq_europe, level = "genus"))
## Define taxonomic relations
## Define the SBMs
KingdomSample <- defineSBM(otu_table())