Skip to content

MIC Module 2 tutorial

Diana edited this page Aug 24, 2021 · 34 revisions

This lab is based on the 16S rRNA gene analysis method originally developed by Michael Hall and Robert Beiko, and was updated and modified by Diana Haider for the 2021 Microbiome workshop.

Introduction

The lab in this module is a walkthrough of an end-to-end pipeline using the command line interface for the analysis of high-throughput marker gene data including diversity, taxonomic and statistical explorations. The pipeline described is embedded in the latest version of QIIME2 (2021.4) which is a popular microbiome bioinformatics platform for microbial ecology. It uses software packages called plugins that can be developed by anyone and can be tracked through a provenance file automatically generated by QIIME2. Two scripts, accessible here, make the whole thing work: “download_Willis_et_al_data.sh” retrieves the sequences from the European Bioinformatics Institute through their relatively awesome API, and “qiime_commands.sh” to execute a chain of QIIME2 commands and generate a number of .qza and .qzv files. These files can be unzipped to reveal the sweet contents inside in case you want to (hypothetically, of course) feed them to a non-QIIME2 application. For this tutorial, we will go through each step individually after the import part.

Commonly used marker genes for microbiome analysis include the 16S ribosomal RNA (rRNA) for prokaryotes, 18S rRNA for eukaryotes, and the internal transcribed spacer (ITS) for fungi. In this tutorial, we will explore a 16S rRNA dataset from environmental samples collected along three stations from the Halifax Line at four different depths, amplified using two different primers. One interesting question is whether the primer choice under- or overrepresent certain taxa groups, and then impacts diversity measurements. Details on the data collection and processing can be found in the original paper that published the data.

After this lab you will be able to:

  • Import your raw sequences to QIIME2

Getting started

QIIME2 is recommended to be run in an independent conda environment to ensure consistency between different versions of the packages it uses. Here are the instructions for installation. For this instance, a qiime2 environment was already installed, it just needs to be activated.

conda activate qiime2-2021.4

You can visualize all available plugins by typing qiime. Your command line should look like this.

To start your analysis, two files are required:

  • Sequencing data
  • Metadata

The sequencing data will be in multiple FASTQ files. Each FASTQ file contains the raw DNA sequences, and information on the sequences, such as an identifier, the DNA sequence and the quality score of each called bases in text format. These files are usually very large, and are an intermediate for further analyses. The metadata file contains information about the samples allowing us to interpret the data in their biological context.

The structure of your folders should look like this

<ROOT>
|-- sequence data/           # Folder with collected data
    `-- raw reads            # Folder with the raw reads in FASTQ format
        `-- manifest.txt     # Manifest file
        `-- run*_            # Fastqs
    `-- METADATA.txt         # The metadata file
|-- qiime_artifacts          # Folder containing the results
    `-- reads.qza            # Reads artifact imported in QIIME2

16S data processing

Import raw reads to QIIME2

You can do this step yourself, but for this live lab, we will start with the already imported reads.qza file. If you want to fetch the dataset from EBI yourself, you can run bash download_Willis_et_al_data.sh bash script, but it is time consuming (~30 mins). The script downloads the FASTQ files from the EBI database, reformats the file names and creates a manifest file which is a text file with three columns. It guides the import in QIIME2 by providing the sample id, the filepath and the direction of the read if the data has paired reads (either reverse or forward).

Once the manifest file is ready, you can just use the qiime import function:

qiime tools import 
	--type 'SampleData[PairedEndSequencesWithQuality]' 
	--input-path import_to_qiime 
	--output-path CBW_reads

Quality control

qiime demux summarize
	--type 'SampleData[PairedEndSequencesWithQuality]' 
	--i-data CBW_reads.qza
	--o-visualization qual_viz.qzv
  • Paired end reads need to be joined

Clustering 16S sequences

qiime dada2 denoise-paired 
  --i-demultiplexed-seqs CBW_reads.qza
  --p-trim-left 
  --p-trunc-len 120 \
  --o-representative-sequences representative_sequences.qza
  --o-table unfiltered_table.qza
  --o-denoising-stats denoise_stats.qza
  --verbose #verbose can be added to any command line to print the details of what the computer is doing

From the feature table

Diversity analyses

Differential abundance

Barplots/ Heatmaps

From the representative sequences

Taxonomy classification

Alignment and phylogeny

Clone this wiki locally