Usage of Blockmodels with poisson covariates to correct sequencing effort
This commit is contained in:
parent
6fa32f2157
commit
97b4a43597
1 changed files with 16 additions and 0 deletions
16
blockmodels_correct_sampling_effort.R
Normal file
16
blockmodels_correct_sampling_effort.R
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
library(blockmodels)
|
||||||
|
library(phyloseq)
|
||||||
|
library(biomformat)
|
||||||
|
source("utils.R")
|
||||||
|
|
||||||
|
the_data <- import_biom("data/ravel/ravel.biom")
|
||||||
|
|
||||||
|
|
||||||
|
per_taxa_networks <- collapse_otu_at_taxo(the_data)
|
||||||
|
|
||||||
|
covar_mat <- t(colSums(per_taxa_networks[[2]]) %*% t(rep(1, nrow(per_taxa_networks[[2]]))))
|
||||||
|
|
||||||
|
fitted_model <- BM_poisson_covariates("LBM", adj = per_taxa_networks[[2]], covariates = list(covar_mat))
|
||||||
|
fitted_model$estimate()
|
||||||
|
|
||||||
|
fitted_model$model_parameters[[which.max(fitted_model$ICL)]]
|
||||||
Loading…
Add table
Reference in a new issue