16S Microbial analysis with Nanopore data


question Questions
  • How can we analyse the health status of the soil?

  • How do plants modify the composition of microbial communities?

objectives Objectives
  • Use Nanopore data for studying soil metagenomics

  • Analyze and preprocess Nanopore reads

  • Use Kraken2 to assign a taxonomic labels

requirements Requirements

time Time estimation: 2 hours

Supporting Materials

last_modification Last modification: Feb 25, 2021


Healthy soils are an essential element in maintaining the planet’s ecological balance. That is why their protection must be considered a priority in order to guarantee the well-being of humanity. The alteration of microbial populations often precedes changes in the physical and chemical properties of soils, so monitoring their condition can serve to predict their future evolution, allowing to develop strategies to mitigate ecosystem damage.

Advances in sequencing technologies have opened up the possibility of using the study of taxa present in bacterial communities as indicators of soil condition. For such an approach to be possible, variations in microbial populations need to be less affected by spatial factors than by human-derived alterations, which has been confirmed by various investigations (Hermans et al. 2016, Fierer and Jackson 2006).

Among the environmental variables that have shown the greatest correlation with alterations in the composition of bacterial communities are soil pH, the carbon-nitrogen ratio (C:N), and the co-concentrations of Olsen P (a measure of plant available phosphorus), aluminium and copper (Fig. 1).

Bacterial bioindicators
Figure 1: Relationship between bacterial community composition and soil parameters. The radius of each circle represents the taxon abundance that was accounted for by each soil variable, based on adjusted R-squared values from distance-based multivariate multiple regression analyses. The univariate relationship between the abundance of each taxon and soil variables, calculated using Pearson’s correlation coefficient, is represented by the color of the circle. Phyla or classes are ordered according to overall abundance in all the samples, from most abundant (top) to least abundant (bottom). Image published originally in Hermans et al. 2016.

On the other hand, many species of microorganisms establish complex symbiotic relationships with plant organisms. The fraction of the substrate that is directly influenced by root secretions and associated microorganism is known as rhizosphere. Thus, for example, bacteria of the genus Bacillus, Pseudomonas or Burkholderia appear associated with the plant roots, protecting them from pathogenic microorganisms.

Bacterial communities
Figure 2: Representation of the relationships between root microbiomes and plant organisms.

In this tutorial, we will use sequencing data obtained through the MinION sequencer (Oxford Nanopore Technologies) with two objectives: 1) evaluate the health status of soil samples and 2) study how microbial populations are modified by their interaction with plant roots. This example was inspired by Brown et al. 2017.


In this tutorial, we will cover:

  1. Background on data
    1. The datasets
  2. Get data
  3. Assess datasets quality
    1. Quality control using FastQC and MultiQC
  4. Improve the dataset quality
    1. Adapter and chimera removal with porechop
    2. Filter sequences with fastp
  5. Re-evaluate datasets quality
  6. Assign taxonomic classifications
    1. Taxonomic classification with Kraken2
  7. Analyze taxonomic assigment
    1. Visualize the taxonomical classification with Krona
  8. Conclusion

Background on data

Next, we will introduce some details about the datasets that we are going to use to perform the analysis.

The datasets

In this example, we will use a dataset originally hosted in the NCBI SRA database, with the accession number SRP194577. To obtain the samples, the DNA was extracted using the Zymo Research Kit, followed by PCR amplification of 16S rRNA genes. Sequencing was carried out on a Nanopore Minion device. We are going to use four datasets, corresponding to two experimental conditions:

  • Soil:
    • Surface sample (0-5 cm): bulk_top.fastq.gz
    • Deep sample (10-15 cm): bulk_bottom.fastq.gz
  • Rhizosphere:
    • Surface sample (0-5 cm): rhizosphere_top.fastq.gz
    • Deep sample (10-15 cm): rhizosphere_bottom.fastq.gz

question Question

Why do we sequence the 16S rRNA genes for analyzing microbial communities?

solution Solution

There are several reasons to use these genes as taxonomic markers. First, they are constituent parts of ribosomes, a piece of highly-conserved biological machinery, which makes them universally distributed. On the other hand, these genes present regions with varying degrees of sequence variability, which allows them to be used as a species-specific signature.

Get data

hands_on Hands-on: Data upload

  1. Create a new history for this tutorial
  2. Import the files from Zenodo:

    • Open the file galaxy-upload upload menu
    • Click on Collection tab
    • Click of the Paste/Fetch button
    • Paste the Zenodo links and press Start and Build
    • Assign a name to the new collection: soil collection
    • Copy the link location
    • Open the Galaxy Upload Manager (galaxy-upload on the top-right of the tool panel)

    • Select Paste/Fetch Data
    • Paste the link into the text field

    • Press Start

    • Close the window

    By default, Galaxy uses the URL as the name, so rename the files with a more useful name.

    tip Tip: Importing data from a data library

    As an alternative to uploading the data from a URL or your computer, the files may also have been made available from a shared data library:

    • Go into Shared data (top panel) then Data libraries

    • Find the correct folder (ask your instructor)

    • Select the desired files
    • Click on the To History button near the top and select as Datasets from the dropdown menu
    • In the pop-up window, select the history you want to import the files to (or create a new one)
    • Click on Import

Assess datasets quality

Before starting to work on our datasets, it is necessary to assess their quality. This is an essential step if we aim to obtain a meaningful downstream analysis.

details FASTQ sequence quality format

FASTQ format is a text-based format for storing both a biological sequence and its corresponding quality scores. Both the sequence letter and the quality score are encoded with a single ASCII character for brevity. You can find more info in the Wikipedia article.

Quality control using FastQC and MultiQC

FastQC is one of the most widely used tools to check the quality of the samples generated by High Throughput Sequencing (HTS) technologies.

hands_on Hands-on: Quality check

  1. FastQC Tool: toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.72+galaxy1 with the following parameters:
    • param-collection “Dataset collection”: soil collection
  2. Rename the outputs as FastQC unprocessed: Raw and FastQC unprocessed: Web
  3. MultiQC Tool: toolshed.g2.bx.psu.edu/repos/iuc/multiqc/multiqc/1.8+galaxy1 with the following parameters:
    • In “Results”:
      • “Which tool was used generate logs?”: FastQC
      • param-collection “Dataset collection”:

        • FastQC unprocessed: Raw
  4. Click on the galaxy-eye (eye) icon and inspect the generated HTML file

FastQC provides information on various parameters, such as the range of quality values across all bases at each position. MultiQC allows summarizing the output of different outputs from FastQC.

FastQC plots length
Figure 3: Sequence length distribution

In the first place, we are going to analyse the sequence length distribution of the different datasets.

question Question

  1. Can you explain the sequence length distribution plot?

solution Solution

The main peak, around 1700 bp, corresponds approximately to the length of the gene coding for 16S rRNA. There is also a secondary peak around 200 bp, which may be due to truncated amplifications, or as a result of non-specific hybridization of primers used for PCR.

FastQC plots quality
Figure 4: Per base sequence quality

If we examine figure 3, we can see that up to 3000 bp the quality of our sequencing data is around a Phred score of 12, which is a relatively low value compared to other sequencing technologies. This is explained because Nanopore reads poses high error rates in the basecalled reads (10% as compared to 1% for Illumina). However, Nanopore sequencing generates very long reads (in theory only limited by the mechanisms of extraction of the genetic material), enabling the sequencing of the complete 16S rRNA gene, which makes it possible to identify bacterial taxa at higher resolution.

FasTQC plots CG
Figure 5: Per sequence GC content

Let’s have a look at figure 4, which shows the content of the GC by sequence.

question Questions

What can cause GC content to show a bimodal peak?

solution Solution

There are several possible causes for the presence of twin peaks in the GC content. One possible explanation is the presence of adapters in the sequence. Another possible cause is some kind of contamination, such as chimeras.

comment Comments

For more information on the topic of quality control, please see our training materials here.

Improve the dataset quality

In order to improve the quality of our data, we will use two tools presented above, porechop and fastp.

Adapter and chimera removal with porechop

Nanopore sequencing technology requires to ligate adapters to both ends of genomic material to facilitate the strand capture and loading of a processive enzyme at the 5’end, boosting the effectiveness of the sequencing process. Adapter sequences should be removed because they can interfere with aligment of reads to 16S rRNA gene reference database, for which we will use the porechop tool (Wick 2017).

comment Comment

If you are interested in Nanopore sequecing technology, you can find more information in Jain et al. 2016.

On the other hand, chimeric sequences are considered a contaminant and should be removed because they can result in artificial inflation of the microbial diversity. With Porechop you can eliminate them.

hands_on Hands-on: Remove adapters with porechop

  1. Porechop Tool: toolshed.g2.bx.psu.edu/repos/iuc/porechop/porechop/0.2.3 with the following parameters:
    • “Input FASTA/FASTQ”: param-collection soil collection
    • “Output format for the reads: fastq
  2. Rename the output as soil collection trimmed

Filter sequences with fastp

To increase the specificity of the analysis, we will select the reads with lengths between 1000 bp and 2000 bp, which are more informative from a taxonomic point of view, because they include both preserved and hypervariable regions of the 16S rRNA gene. In addition, sequences will be filtered on a minimum average read quality score of 9, according to the recommendations from (missing reference). This stage will be carried out through the use of fastp (Chen et al. 2018), an open-source tool designed to process FASTQ files.

hands_on Hands-on: Filter sequence with fastp

  1. fastp Tool: toolshed.g2.bx.psu.edu/repos/iuc/fastp/fastp/0.20.1+galaxy0 with the following parameters:
    • “Single-end or paired reads: Single-end
      • param-collection “Dataset collection”: soil collection trimmed
        • In “Adapter Trimming Options”:
          • “Disable adapter trimming”: Yes
    • In “Filter Options”:
      • In “Quality filtering options”:
        • “Qualified quality phred”: 9
      • In “Length filtering options”:
        • “Length required”: 1000
        • “Maximum length”: 2000
    • In “Read Modification Options”:
      • “PolyG tail trimming”: Disable polyG tail trimming
  2. Rename the output as soil collection processed

Re-evaluate datasets quality

After processing the sequences, we are going to analyze them again using FastQC and MultiQC to see if we have managed to correct the anomalies that we had detected.

hands_on Hands-on: Quality check

  1. FastQC Tool: toolshed.g2.bx.psu.edu/repos/devteam/fastqc/fastqc/0.72+galaxy1 with the following parameters:
    • param-collection “Dataset collection”: soil collection processed
  2. Rename the outputs as FastQC processed: Raw and FastQC processed: Web
  3. MultiQC Tool: toolshed.g2.bx.psu.edu/repos/iuc/multiqc/multiqc/1.8+galaxy1 with the following parameters:
    • In “Results”:
      • “Which tool was used generate logs?”: FastQC
      • param-collection “Dataset collection”:

        • FastQC processed: Raw
  4. Click on the galaxy-eye (eye) icon and inspect the generated HTML file

We can verify that after processing the samples, the GC content presents a unimodal distribution, which indicates that the anomalies in the sequences have been successfully eliminated (Figure 6).

FasTQC plots GC
Figure 6: Per sequence GC content in processed samples

Assign taxonomic classifications

One of the key steps in metagenomic data analysis is to identify the taxon to which the individual reads belong. Taxonomic classification tools are based on microbial genome databases to identify the origin of each sequence.

Taxonomic classification with Kraken2

To perform the taxonomic classification we will use Kraken2 ((missing reference)). This tool uses the minimizer method to sample the k-mers (all the read’s subsequences of length k) in a deterministic fashion in order to reduce memory constumption and processing time. In addition, it masks low-complexity sequences from reference sequences by using dustmasker.

comment Comments

Kraken2 uses a compact hash table, a probabilistic data structure that allows for faster queries and lower memory requirements. It applies a spaced seed mask of s spaces to the minimizer and calculates a compact hash code, which is then used as a search query in its compact hash table; the lowest common ancestor (LCA) taxon associated with the compact hash code is then assigned to the k-mer. You can find more information about the Kraken2 algorithm in the paper Improved metagenomic analysis with Kraken 2.

Taxonomic classification
Figure 7: Kraken2 sequence classification algorithm. To classify a sequence, each l-mer is mapped to the lowest common ancestor (LCA) of the genomes that contain that l-mer in a database. In the classification tree, each node has a weight equal to the number of l-mers in the sequence associated with the node’s taxon. Image originally published in Wood and Salzberg 2014.

For this tutorial, we will use the SILVA database (Quast et al. 2012). It includes over 3.2 million 16S rRNA sequences from the Bacteria, Archaea and Eukaryota domains.

hands_on Hands-on: Assign taxonomic labels with Kraken2

  1. Kraken2 Tool: toolshed.g2.bx.psu.edu/repos/iuc/kraken2/kraken2/2.0.8_beta+galaxy0 with the following parameters:
    • “Single or paired reads: Single
    • param-collection “Dataset collection”: soil collection processed
    • “Print scientific names instead of just taxids”: Yes
    • “Confidence”: 0.1
    • In “Create Report”:
      • “Print a report with aggregrate counts/clade to file”: Yes
      • “Format report output like Kraken 1’s kraken-mpa-report”: Yes
    • “Select a Kraken2 database”: Silva (Created: 2020-06-24T164526Z, kmer-len=35, minimizer-len=31, minimizer-spaces=6)

    comment Comment

    A confidence score of 0.1 means that at least 10% of the k-mers should match entries in the database. This value can be reduced if a less restrictive taxonomic assignation is desired.

Analyze taxonomic assigment

Once we have assigned the corresponding taxa to each sequence, the next step is to properly visualize the data, for which we will use the Krona pie chart tool (Ondov et al. 2011). But before that, we need to adjust the format of the data output from Kraken2.

hands_on Hands-on: Adjust dataset format

  1. Reverse Tool: toolshed.g2.bx.psu.edu/repos/iuc/datamash_reverse/datamash_reverse/1.1.0 with the following parameters:
    • param-collection “Dataset collection”: Report: Kraken2 on collection
  2. Replace Text Tool: toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_replace_in_line/1.1.2 with the following parameters:
    • param-collection “Dataset collection”: Reverse on collection
    • In “Replacement”:
      • param-repeat “Insert Replacement”
        • “Find pattern”: \|
        • “Replace with”: \t
  3. Remove beginning Tool: Remove+beginning1 with the following parameters:
    • param-collection “Dataset collection”: Replace Text on collection

Visualize the taxonomical classification with Krona

Krona allows hierarchical data to be explored with zooming, multi-layered pie charts. With this tool, we can easily visualize the composition of the bacterial communities and compare how the populations of microorganisms are modified according to the conditions of the environment.

hands_on Hands-on: Visualize metagenomics analysis results

  1. Krona pie chart Tool: toolshed.g2.bx.psu.edu/repos/crs4/taxonomy_krona_chart/taxonomy_krona_chart/2.7.1 with the following parameters:
    • “What is the type of your input data”: Tabular
    • param-collection “Dataset collection”: Remove beginning on collection
    • “Provide a name for the basal rank”: Bacteria

Let’s take a look at the result. Using the search bar we can check if certain taxa are present.

question Questions

  1. What can we say about the health status of the soil samples?
  2. Are there significant differences in the bacterial population structure between soil samples and rhizosphere samples?

solution Solution

  1. The low presence of Alphaproteobacteria (including members of the order Rhizobiales), as well as the abundance of Bacteroidetes and Gammaproteobacteria, suggest that the soil is highly exposed to phosphorus. This mineral is strongly associated with the anthropogenic activity as it is an important component of agrochemicals.
  2. We can observe that there are important differences in the structure of the bacterial populations between the soil and rhizosphere samples. Particularly significant is the increase in phylum Plactomycetes, which are usually abundant in the rhizosphere.


In this tutorial we used MinION Nanopore sequencing data to study the health status of soil samples and the structure of bacterial populations. The results indicate that the soil suffers some degree of erosion as a result of their exposure to agrochemicals. We have also been able to study how the composition of microbial communities is modified in presence of plant organisms.

keypoints Key points

  • We learned to use MinION Nanopore data for analyzing the health status of the soil

  • We preprocessed Nanopore sequences in order to improve their quality

Useful literature

Further information, including links to documentation and original publications, regarding the tools, analysis techniques and the interpretation of results described in this tutorial can be found here.


  1. Fierer, N., and R. B. Jackson, 2006 The diversity and biogeography of soil bacterial communities. Proceedings of the National Academy of Sciences 103: 626–631. 10.1073/pnas.0507535103
  2. Ondov, B. D., N. H. Bergman, and A. M. Phillippy, 2011 Interactive metagenomic visualization in a Web browser. BMC Bioinformatics 12: 10.1186/1471-2105-12-385
  3. Quast, C., E. Pruesse, P. Yilmaz, J. Gerken, T. Schweer et al., 2012 The SILVA ribosomal RNA gene database project: improved data processing and web-based tools. Nucleic Acids Research 41: D590–D596. 10.1093/nar/gks1219
  4. Wood, D. E., and S. L. Salzberg, 2014 Kraken: ultrafast metagenomic sequence classification using exact alignments. Genome Biology 15: R46. 10.1186/gb-2014-15-3-r46
  5. Hermans, S. M., H. L. Buckley, B. S. Case, F. Curran-Cournane, M. Taylor et al., 2016 Bacteria as Emerging Indicators of Soil Condition (F. E. Loeffler, Ed.). Applied and Environmental Microbiology 83: 10.1128/aem.02826-16
  6. Jain, M., H. E. Olsen, B. Paten, and M. Akeson, 2016 The Oxford Nanopore MinION: delivery of nanopore sequencing to the genomics community. Genome Biology 17: 10.1186/s13059-016-1103-0
  7. Wick, R., 2017 Porechop. GitHub. https://github.com/rrwick/Porechop
  8. Brown, B. L., M. Watson, S. S. Minot, M. C. Rivera, and R. B. Franklin, 2017 MinION™ nanopore sequencing of environmental metagenomes: a synthetic approach. GigaScience 6: 10.1093/gigascience/gix007
  9. Chen, S., Y. Zhou, Y. Chen, and J. Gu, 2018 fastp: an ultra-fast all-in-one FASTQ preprocessor. 10.1101/274100


Did you use this material as an instructor? Feel free to give us feedback on how it went.

Click here to load Google feedback frame

Citing this Tutorial

  1. Cristóbal Gallardo, 2021 16S Microbial analysis with Nanopore data (Galaxy Training Materials). /training-material/topics/metagenomics/tutorials/nanopore-16S-metagenomics/tutorial.html Online; accessed TODAY
  2. Batut et al., 2018 Community-Driven Data Analysis Training for Biology Cell Systems 10.1016/j.cels.2018.05.012

details BibTeX

    author = "Cristóbal Gallardo",
    title = "16S Microbial analysis with Nanopore data (Galaxy Training Materials)",
    year = "2021",
    month = "02",
    day = "25"
    url = "\url{/training-material/topics/metagenomics/tutorials/nanopore-16S-metagenomics/tutorial.html}",
    note = "[Online; accessed TODAY]"
        doi = {10.1016/j.cels.2018.05.012},
        url = {https://doi.org/10.1016%2Fj.cels.2018.05.012},
        year = 2018,
        month = {jun},
        publisher = {Elsevier {BV}},
        volume = {6},
        number = {6},
        pages = {752--758.e1},
        author = {B{\'{e}}r{\'{e}}nice Batut and Saskia Hiltemann and Andrea Bagnacani and Dannon Baker and Vivek Bhardwaj and Clemens Blank and Anthony Bretaudeau and Loraine Brillet-Gu{\'{e}}guen and Martin {\v{C}}ech and John Chilton and Dave Clements and Olivia Doppelt-Azeroual and Anika Erxleben and Mallory Ann Freeberg and Simon Gladman and Youri Hoogstrate and Hans-Rudolf Hotz and Torsten Houwaart and Pratik Jagtap and Delphine Larivi{\`{e}}re and Gildas Le Corguill{\'{e}} and Thomas Manke and Fabien Mareuil and Fidel Ram{\'{\i}}rez and Devon Ryan and Florian Christoph Sigloch and Nicola Soranzo and Joachim Wolff and Pavankumar Videm and Markus Wolfien and Aisanjiang Wubuli and Dilmurat Yusuf and James Taylor and Rolf Backofen and Anton Nekrutenko and Björn Grüning},
        title = {Community-Driven Data Analysis Training for Biology},
        journal = {Cell Systems}

congratulations Congratulations on successfully completing this tutorial!