Additional analyses

Differential abundance

Differential abundance tests were done using the ANCOM plugin.

# Filter out the samples with less than 2319 reads (in the case of the 18S rRNA data)
qiime feature-table filter-samples \
--i-table feature_table_samples_filtered.qza \
--p-min-frequency 2319 \
--o-filtered-table temp.qza

Following the tutorial for ANCOM, I then want to collapse the table to genus level. Before I do this, I want to filter out low-abundance features. I follow Jamie Morton’s approach of removing those that only appear 10 times or fewer across all samples, as well as those that only appear in one sample (these aren’t useful):

# Filter features that only appear in a single sample
qiime feature-table filter-features \
--i-table temp.qza \
--p-min-samples 2 \
--o-filtered-table temp2.qza

# Filter features by reads
qiime feature-table filter-features \
--i-table temp2.qza \
--p-min-frequency 10 \
--o-filtered-table temp3.qza

mkdir ANCOM

# Collapse table at genus level
qiime taxa collapse \
--i-table temp3.qza \
--i-taxonomy taxonomy/classified_rep_seqs.qza \
--p-level 6 \
--o-collapsed-table ANCOM/feature_table_for_ANCOM.qza

rm temp.qza
rm temp2.qza
rm temp3.qza

(I didn’t want to keep the intermediate files, but they can be useful later if you need a filtered table for something else).

Then, to run ANCOM, I first have to add pseudocounts to get rid of any zeroes (because you can’t log 0):

cd ANCOM

# Add pseudocount
qiime composition add-pseudocount \
--i-table feature_table_for_ANCOM.qza \
--o-composition-table ANCOM_ready_table.qza

And finally, to run ANCOM.

# Run ANCOM on 18S data by cases/controls
qiime composition ancom \
--i-table ANCOM_ready_table.qza \
--m-metadata-file ../metadata_for_qiime2.txt \
--m-metadata-column group \
--o-visualization ancom_group_results.qzv \
--verbose

PCoA biplot

To make a biplot where the taxa that are contributing most strongly to the variance are overlaid onto the PCoA plot, I followed the suggestion in this forum post, with unweighted UniFrac here as an example:

mkdir biplot

# Make the relative frequency table from the rarefied table
qiime feature-table relative-frequency \
--i-table rarefied_table.qza \
--o-relative-frequency-table biplot/rarefied_table_relative.qza

# Make the biplot for unweighted UniFrac
qiime diversity pcoa-biplot \
--i-pcoa unweighted_unifrac_pcoa_results.qza \
--i-features biplot/rarefied_table_relative.qza \
--o-biplot biplot/biplot_matrix_unweighted_unifrac.qza

cd biplot

# Turn this matrix into an emperor plot
qiime emperor biplot \
--i-biplot biplot_matrix_unweighted_unifrac.qza \
--m-sample-metadata-file ../../metadata_for_qiime2_with_18S.txt \
--m-feature-metadata-file ../../taxonomy/classified_rep_seqs.qza \
--o-visualization unweighted_unifrac_emperor_biplot.qzv