Skip to content

Practice Lesson 4

This practice lesson is associated with Lesson 4 of the Microbiome Analysis with QIIME 2. In this practice lesson, we will work on filtering our feature table and representative sequences, classify our features, and generate a phylogenetic tree. We will continue working with the data from Zhang et al. 2022.

  1. Change directories to Practice (cd Practice).
  2. Let's do some initial filtering.

    1. Create a directory named 04_filter to save filtered tables.

      Solution
      mkdir 04_filter  
      

    2. Filter any samples that do not have a total read frequency greater than 1,000.

      Solution
      qiime feature-table filter-samples \
      --i-table 03_denoise/feature-table.qza \
      --p-min-frequency 1000 \
      --o-filtered-table 04_filter/filtered-table1.qza  
      

    3. Filter any features with a total abundance across all samples less than 10.

      Solution
      qiime feature-table filter-features \
      --i-table 04_filter/filtered-table1.qza \
      --p-min-frequency 10 \
      --o-filtered-table 04_filter/filtered-table2.qza  
      

  3. Classify the features using a trained classifier (/data/practice/gg-13-8-99-V3V4-nb-classifier.qza) and generate a summary of the results. These should be saved to a new directory (05_taxonomy). Feel free to try an alternative classification method.

    Solution
    mkdir 05_taxonomy 
    qiime feature-classifier classify-sklearn \
    --i-classifier /data/practice/gg-13-8-99-V3V4-nb-classifier.qza \
    --i-reads 03_denoise/asv-sequences.qza \
    --o-classification 05_taxonomy/taxonomy.qza  
    
    qiime metadata tabulate \
    --m-input-file 05_taxonomy/taxonomy.qza \
    --o-visualization 05_taxonomy/taxonomy.qzv  
    
    Solution

  4. Filter out mitochondria, chloroplasts, and assignments only at the kingdom / domain level. Generate a bar plot.

    Solution
    qiime taxa filter-table \
    --i-table 04_filter/filtered-table2.qza \
    --i-taxonomy 05_taxonomy/taxonomy.qza \
    --p-mode contains \
    --p-include p__ \
    --p-exclude 'p__;,Chloroplast,Mitochondria' \
    --o-filtered-table 04_filter/filtered-table3.qza  
    
    qiime taxa barplot \
    --i-table 04_filter/filtered-table3.qza \
    --i-taxonomy 05_taxonomy/taxonomy.qza \
    --m-metadata-file /data/practice/metadata.txt \
    --o-visualization 05_taxonomy/taxa-barplot.qzv 
    

  5. Generate a phylogenetic tree using SEPP fragment insertion. You can find a Greengenes SEPP reference file here. Also, see the Parkinson's Mouse Tutorial for help.

    Solution
    mkdir 06_tree   
    
    wget \
    -O "06_tree/sepp-refs-gg-13-8.qza" \
    "https://data.qiime2.org/2022.8/common/sepp-refs-gg-13-8.qza"  
    
    qiime fragment-insertion sepp \
    --i-representative-sequences 03_denoise/asv-sequences.qza \
    --i-reference-database 06_tree/sepp-refs-gg-13-8.qza \
    --o-tree 06_tree/tree.qza \
    --o-placements 06_tree/tree_placements.qza \
    --p-threads 10  
    

This will take a long time to complete. Feel free to ctrl + C to terminate. There will be a de novo phylogenetic tree available for the next exercise.