knitr::opts_chunk$set(echo = FALSE)
remote_dir="https://raw.githubusercontent.com/PacktPublishing/R-Bioinformatics-Cookbook/master" library(metacoder) biom_file <- file.path(remote_dir, "datasets", "ch5", "rich_high_count_otu.biom") taxdata <- parse_qiime_biom(biom_file) sample_ids <- paste0("Sample", 1:6) print(taxdata$data$otu_table) hist_data <- colSums(taxdata$data$otu_table[, sample_ids]) hist(hist_data, prob= TRUE, breaks=3) lines(density(hist_data, adjust = 2), col="red") taxdata$data$rarefied_otus <- rarefy_obs(taxdata, "otu_table", other_cols = TRUE) low_otu_index <- rowSums(taxdata$data$rarefied_otus[, sample_ids]) <=20 print(low_otu_index) taxdata <- filter_obs(taxdata, "rarefied_otus", ! low_otu_index) print(taxdata$data$rarefied_otus)
library(vegan) rotated_otu_table <- t(taxdata$data$otu_table[,sample_ids]) rarecurve(rotated_otu_table, sample = min(colSums(taxdata$data$otu_table[,sample_ids])))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.