Description Usage Arguments Value Examples
Using the resultant OTU table biom file produced by QIIME, find the relative abundance and sample prevalence of all OTUs and store results in dataframe. Resultant dataframe will show taxonomic classification, abundance, and prevalence for all OTUs.
1 | make_prev_df(biom_file)
|
biom_file |
Full path name of OTU table biom file |
Returns dataframe combining sample prevalence, abundance, and taxonomic classification for all OTUs.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function(biom_file){
phylo <- import_biom(biom_file)
prevdf = apply(X = otu_table(phylo),MARGIN = ifelse(taxa_are_rows(ps), yes=1, no=2), FUN=function(x){sum(x>0)}) #find prevalence of each taxa per sample
#bind together taxonomic information and prevalence and total abundance of each taxa into one dataframe
prevdf = data.frame(Prevalence = prevdf, TotalAbundance = taxa_sums(phylo), tax_table(phylo))
prevdf <- prevdf[prevdf$Prevalence > 0,] #remove taxa not present in samples
return(prevdf)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.