I want to get the mean and median abundance or relative abundance for each bacteria species from OTU tables

I am a novice at using command line and would like help on how to proceed with obtaining the mean/median abundance for bacteria species used in published data. The two papers I am referencing that use the same data are https://doi.org/10.1073%2Fpnas.1420815112 and https://doi.org/10.1098%2Frspb.2015.1139. I imported the files and see that I have access to the OTU table in biom format for bacterial and fungal species. How should I go about getting this data in order to set a baseline for my samples?

1 Like

Hi @Violette_Ramirez,
Welcome to the :qiime2: forum!
Have you imported your files into qiime2? if so, can you please share the full command that you used to import? also can you explain the baseline are you hoping to set?
-Hannah

1 Like

Hi Hannah!

I unziped the the otu_tables_wTax.zip to get the 16S_otu_table_wTax.biom file and used the following commands to import and get qza/qzv files to view in qiime2

biom convert -i 16S_otu_table_wTax.biom -o 16S_otu_table_wTax.biomv210format --table-type="OTU table" --to-hdf5

qiime tools import --type 'FeatureTable[Frequency]' --input-path 16S_otu_table_wTax.biomv210format --output-path 16S_feature-table.qza

qiime feature-table summarize --i-table 16S_feature-table.qza --o-visualization 16S_feature-table-summary.qzv

Now wish to get the relative abundance of the bacteria in the study. I am using R to do so.

In R
install.packages(c("phyloseq", "biomformat"))
library(phyloseq)
library(biomformat)
biom_data <- read_biom("16S_otu_table_wTax.biom")

The readme_update.txt says otu_tables_wTax.zip --> Biom-format OTU tables for bacteria and fungi with taxonomic information. Sample ID appended with .I refers to indoor dust, while sample ID appended with .O refers to outdoor dust. So I used

physeq <-make_phyloseq(otu_table(biom_data), tax_table(biom_data))

Currently I am stuck here in R, my console doesnt finish the command

Now to calculate the relative abundance
physeq_relabund <- transform_sample_counts(physeq, function(x) x / sum(x))

and to view the results;
head(otu_table(physeq_relabund))

Any help about how to get the relative abundance for this data to set as a baseline for comparing indoor dust samples

1 Like

Hi @Violette_Ramirez,
Thank you for all the info! We can definitely figure this out. I would like to mention that you can calculate the relative abundance in qiime! qiime feature-table relative-abundance would do the trick. Is there a specific reason why you are trying to do this in R?

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.