PacBio 16S rRNA amplicon Analysis

Author

Anwesh, DBT-CMI

Published

July 15, 2026

Started on 24-06-26

Testing the anlysis of 16S rRNA reads derived from PacBio instruments

Working directory: test_pacbio

Get data

Download SraRunTable. Make a list of SRR IDs

$ cut -f 1 -d "," SraRunTable.csv | grep 'Run' -v > samples_list.txt

Select required columns from the RunTable and save as metadata.tsv (Table 1)

Table 1: Metadata
SampleID BioProject BioSample env_broad_scale env_local_scale env_medium geo_loc_name SampleName Organism
SRR23329747 PRJNA930143 SAMN33051429 Shrimp culture farm Pond 5 culture pond India: Andhra Pradesh WFS_C Penaeus vannamei
SRR23329748 PRJNA930143 SAMN33051429 Shrimp culture farm Pond 5 culture pond India: Andhra Pradesh WFS_B Penaeus vannamei
SRR23329749 PRJNA930143 SAMN33051429 Shrimp culture farm Pond 5 culture pond India: Andhra Pradesh WFS_A Penaeus vannamei
SRR23295634 PRJNA930143 SAMN32984423 Shrimp culture Farm Pond 1 Healthy Shrimp gut India: Andhra pradesh C1_C Penaeus vannamei
SRR23295635 PRJNA930143 SAMN32984423 Shrimp culture Farm Pond 1 Healthy Shrimp gut India: Andhra pradesh C1_B Penaeus vannamei
SRR23295636 PRJNA930143 SAMN32984423 Shrimp culture Farm Pond 1 Healthy Shrimp gut India: Andhra pradesh C1_A Penaeus vannamei

Download SRA files and extract

$ mkdir sra_files
(sra)$ prefetch -p -O sra_files --option-file samples_list.txt
$ mkdir raw_reads
(sra)$ fasterq-dump sra_files/* -O raw_reads/ -p
# Alternatively, use fasterq-dump on the samples_list.txt, directly
Tip--split-3

No need to use -3 when extracting PacBio reads

Read and Primer counts

Counting the total number of reads and primers in each sample (Table 2)

$ echo -e "Sample\tTotal_Reads\tF_count\tR_count" > read_primer_counts.tsv
$ for sample in $(cat samples_list.txt); do echo -e "$sample\t"$(grep '^@' raw_reads/$sample.fastq -c)"\t"$(grep 'AG[GA]GTT[TC]GAT[TC][AC]TGGCTCAG' raw_reads/$sample.fastq -c)"\t"$(grep 'AAGTCGTAACAAGGTA[GA]C[TC]' raw_reads/$sample.fastq -c); done >> read_primer_counts.tsv
Table 2: Read and primer counts (Raw)
Sample Total_Reads F_count R_count
SRR23329747 78914 63001 68737
SRR23329748 20608 16704 18132
SRR23329749 52649 37512 45635
SRR23295634 47915 37416 41583
SRR23295635 35292 28459 31158
SRR23295636 65084 48502 54104

Compress raw reads (optional)

$ pigz -v raw_reads/*

QIIME2

Only a few reads do not have primer sequences.
Trying two different methods:

  • run denoise-ccs to perform all primer removal and dada2 steps
  • remove primers and run denoise-ccs to perform just the dada2 steps

QIIME2 version: 2026.1

Installation

Note
  • Tried QIIME 2026.4, but it uses scikit-learn v1.7.1 which is incompatible with existing classifiers.
  • A classifier was built with the new version, but the evaluators are not available in QIIME 2026.4, as on 3rd Jul 2026 - check ncbi_classifier.qmd (note to self).
  • So using the latest version of QIIME2 with scikit-learn v1.4.2, i.e. 2026.1
$ conda env create --name q2_261 --file https://raw.githubusercontent.com/qiime2/distributions/refs/heads/dev/2026.1/amplicon/released/qiime2-amplicon-ubuntu-latest-conda.yml

Make a manifest file (Table 3)

$ echo -e "sample-id\tabsolute-filepath" > manifest_raw.tsv
$ awk '{ print $1"\t$PWD/raw_reads/"$1".fastq.gz" }' samples_list.txt >> manifest_raw.tsv
Table 3: Manifest (Raw reads)
sample.id absolute.filepath
SRR23329747 $PWD/raw_reads/SRR23329747.fastq.gz
SRR23329748 $PWD/raw_reads/SRR23329748.fastq.gz
SRR23329749 $PWD/raw_reads/SRR23329749.fastq.gz
SRR23295634 $PWD/raw_reads/SRR23295634.fastq.gz
SRR23295635 $PWD/raw_reads/SRR23295635.fastq.gz
SRR23295636 $PWD/raw_reads/SRR23295636.fastq.gz

Import data into q2 pipeline

$ mkdir q2_raw
(q2_261)$ qiime tools import --type 'SampleData[SequencesWithQuality]' --input-path manifest_raw.tsv --output-path q2_raw/1_import.qza --input-format SingleEndFastqManifestPhred33V2
$ cd q2_raw
(q2_261)$ qiime demux summarize --i-data 1_import.qza --o-visualization 1_import.qzv

Denoise directly

Run DADA2

(q2_261)$ qiime dada2 denoise-ccs --i-demultiplexed-seqs 1_import.qza --p-front AGRGTTYGATYMTGGCTCAG --p-adapter AAGTCGTAACAAGGTARCY --p-min-len 1000 --p-max-len 1600 --p-n-threads 10 --o-table 2_table.qza --o-representative-sequences 2_repseqs.qza --o-denoising-stats 2_stats.qza --o-base-transition-stats 2_bt_stats.qza
# Generate visualization for stats
(q2_261)$ qiime metadata tabulate --m-input-file 2_stats.qza --o-visualization 2_stats.qzv
CautionVery few reads

Only a few reads were retained ranging from 1-74 per sample.
Trying the reverse complement “RGYTACCTTGTTACGACTT” as an argument for --p-adapter. Mentioned here and here

Upon searching for the above sequence, it was found a few bp before the 3’ region and in very less numbers.

$ grep '[GA]G[TC]TACCTTGTTACGACTT' raw_reads/SRR23295634.fastq
# 64 occurrences

Anyways, trying the modification

(q2_261)$ qiime dada2 denoise-ccs --i-demultiplexed-seqs 1_import.qza --p-front AGRGTTYGATYMTGGCTCAG --p-adapter RGYTACCTTGTTACGACTT --p-min-len 1000 --p-max-len 1600 --p-n-threads 10 --o-table 2_table2.qza --o-representative-sequences 2_repseqs2.qza --o-denoising-stats 2_stats2.qza --o-base-transition-stats 2_bt_stats2.qza
# Approximately 3 hrs 40 mins
(q2_261)$ qiime metadata tabulate --m-input-file 2_stats2.qza --o-visualization 2_stats2.qzv
(q2_261)$ qiime feature-table summarize --i-table 2_table2.qza --o-feature-frequencies 2_feature_freqs2.qza --o-sample-frequencies 2_sample_freqs2.qza  --o-summary 2_table2.qzv --m-metadata-file ../metadata.tsv
(q2_261)$ qiime feature-table tabulate-seqs --i-data 2_repseqs2.qza --o-visualization 2_repseqs2.qzv

Approximately 78-88% reads survived primer removal step and by the end 32-67% survived the DADA2 process (Table 4)

Table 4: Denoising stats (raw2)
sample.id input primer.removed percentage.of.input.primer.removed filtered percentage.of.input.passed.filter denoised non.chimeric percentage.of.input.non.chimeric
#q2:types numeric numeric numeric numeric numeric numeric numeric numeric
SRR23295634 47872 41663 87.03 26723 55.82 20507 18893 39.47
SRR23295635 35263 31375 88.97 18357 52.06 12067 11443 32.45
SRR23295636 65015 55324 85.09 38005 58.46 30891 28658 44.08
SRR23329747 78834 69399 88.03 53949 68.43 51408 49375 62.63
SRR23329748 20586 17647 85.72 14096 68.47 13835 13835 67.21
SRR23329749 52602 41119 78.17 32064 60.96 30844 30049 57.13

Trying without the --p-adapter

(q2_261)$ qiime dada2 denoise-ccs --i-demultiplexed-seqs 1_import.qza --p-front AGRGTTYGATYMTGGCTCAG --p-min-len 1000 --p-max-len 1600 --p-n-threads 10 --o-table 2_table3.qza --o-representative-sequences 2_repseqs3.qza --o-denoising-stats 2_stats3.qza --o-base-transition-stats 2_bt_stats3.qza
# Approximately 3 hrs 40 mins
(q2_261)$ qiime metadata tabulate --m-input-file 2_stats3.qza --o-visualization 2_stats3.qzv
(q2_261)$ qiime feature-table summarize --i-table 2_table3.qza --o-feature-frequencies 2_feature_freqs3.qza --o-sample-frequencies 2_sample_freqs3.qza  --o-summary 2_table3.qzv --m-metadata-file ../metadata.tsv
(q2_261)$ qiime feature-table tabulate-seqs --i-data 2_repseqs3.qza --o-visualization 2_repseqs3.qzv

The output is almost same as above (Table 5)

Table 5: Denoising stats (raw3)
sample.id input primer.removed percentage.of.input.primer.removed filtered percentage.of.input.passed.filter denoised non.chimeric percentage.of.input.non.chimeric
#q2:types numeric numeric numeric numeric numeric numeric numeric numeric
SRR23295634 47872 42974 89.77 26982 56.36 19539 18256 38.14
SRR23295635 35263 31953 90.61 18288 51.86 11257 10766 30.53
SRR23295636 65015 57200 87.98 38264 58.85 28809 26137 40.2
SRR23329747 78834 71218 90.34 54443 69.06 51003 48029 60.92
SRR23329748 20586 18281 88.8 14352 69.72 13387 13277 64.5
SRR23329749 52602 42021 79.88 32122 61.07 30021 28713 54.59

Remove primers and denoise

Trying BBDuk, instead of the default adapters.fa file, a new file, pacbio_primers.fa, with required primer sequences was used

BBDuk

(qc)$ bbduk.sh in=raw_reads/SRR23295634.fastq.gz out=bb_out/SRR23295634.fq.gz ref=~/pacbio_primers.fa copyundefined k=17 mink=7 hdist=1 hdist2=0 ktrim=rl

The same was run as script on all samples - run_bbduk_PacBio.py (not provided here)
utility_paths.csv was modified to look for pacbio_primers.fa (irrelevant; self note)
After processing with bbduk.sh no primer sequences were found (Table 6)

$ echo -e "Sample\tTotal_reads\tF_count\tR_count" > read_primer_counts_postFilt.tsv
$ for sample in $(cat samples_list.txt); do echo -e "$sample\t"$(zcat bb_out/$sample.fq.gz | grep '^@' -c)"\t"$(zcat bb_out/$sample.fq.gz | grep 'AG[GA]GTT[TC]GAT[TC][AC]TGGCTCAG' -c)"\t"$(zcat bb_out/$sample.fq.gz | grep 'AAGTCGTAACAAGGTA[GA]C[TC]' -c); done >> read_primer_counts_postFilt.tsv
Table 6: Read and primer counts (Filtered)
Sample Total_Reads F_count R_count
SRR23329747 78945 0 0
SRR23329748 20622 0 0
SRR23329749 52660 0 0
SRR23295634 47964 0 0
SRR23295635 35322 0 0
SRR23295636 65136 0 0

There is a change in the quality score, maximum was set to 50 (probably because BBduk was made for short reads!).

Generate manifest file (Table 7)

$ echo -e "sample-id\tabsolute-filepath" > manifest_filt.tsv
$ awk '{ print $1"\t$PWD/bb_out/"$1".fq.gz" }' samples_list.txt >> manifest_filt.tsv 
Table 7: Manifest (Filtered reads)
sample.id absolute.filepath
SRR23329747 $PWD/bb_out/SRR23329747.fq.gz
SRR23329748 $PWD/bb_out/SRR23329748.fq.gz
SRR23329749 $PWD/bb_out/SRR23329749.fq.gz
SRR23295634 $PWD/bb_out/SRR23295634.fq.gz
SRR23295635 $PWD/bb_out/SRR23295635.fq.gz
SRR23295636 $PWD/bb_out/SRR23295636.fq.gz

Import

$ mkdir q2_filt
(q2_261)$ qiime tools import --type 'SampleData[SequencesWithQuality]' --input-path manifest_filt.tsv --output-path q2_filt/1_import.qza --input-format SingleEndFastqManifestPhred33V2
$ cd q2_filt
(q2_261)$ qiime demux summarize --i-data 1_import.qza --o-visualization 1_import.qzv

Since the primers were removed, denoise-ccs should discard all reads if primer sequence was provided

(q2_261)$ qiime dada2 denoise-ccs --i-demultiplexed-seqs 1_import.qza --p-front AGRGTTYGATYMTGGCTCAG --p-min-len 1000 --p-max-len 1600 --p-n-threads 10 --o-table 2_table.qza --o-representative-sequences 2_repseqs.qza --o-denoising-stats 2_stats.qza --o-base-transition-stats 2_bt_stats.qza
(q2_261)$ qiime metadata tabulate --m-input-file 2_stats.qza --o-visualization 2_stats.qzv

Yes, nearly no output

Howerver, since --p-front is a required parameter, excluding it or providing empty string throws error

# Throws error
(q2_261)$ qiime dada2 denoise-ccs --i-demultiplexed-seqs 1_import.qza --p-front "" --p-min-len 1000 --p-max-len 1600 --p-n-threads 10 --o-table 2_table.qza --o-representative-sequences 2_repseqs2.qza --o-denoising-stats 2_stats2.qza --o-base-transition-stats 2_bt_stats2.qza

Instead of empty string providing N as an argument for --p-front should run and include all sequences, as it will expect any base at the beginning

(q2_261)$ qiime dada2 denoise-ccs --i-demultiplexed-seqs 1_import.qza --p-front N --p-min-len 1000 --p-max-len 1600 --p-n-threads 10 --o-table 2_table2.qza --o-representative-sequences 2_repseqs2.qza --o-denoising-stats 2_stats2.qza --o-base-transition-stats 2_bt_stats2.qza
# Approximately 3 hrs 40 mins
(q2_261)$ qiime metadata tabulate --m-input-file 2_stats2.qza --o-visualization 2_stats2.qzv
(q2_261)$ qiime feature-table summarize --i-table 2_table2.qza --o-feature-frequencies 2_feature_freqs2.qza --o-sample-frequencies 2_sample_freqs2.qza  --o-summary 2_table2.qzv --m-metadata-file ../metadata.tsv
(q2_261)$ qiime feature-table tabulate-seqs --i-data 2_repseqs2.qza --o-visualization 2_repseqs2.qzv

There is a slight improvement over the previous method (Table 8)

Table 8: Denoising stats (filt2)
sample.id input primer.removed percentage.of.input.primer.removed filtered percentage.of.input.passed.filter denoised non.chimeric percentage.of.input.non.chimeric
#q2:types numeric numeric numeric numeric numeric numeric numeric numeric
SRR23295634 47872 47872 100 30220 63.13 23146 22359 46.71
SRR23295635 35263 35263 100 20246 57.41 13446 13189 37.4
SRR23295636 65015 65015 100 44002 67.68 35566 33838 52.05
SRR23329747 78834 78834 100 60100 76.24 56564 53754 68.19
SRR23329748 20586 20586 100 16119 78.3 15807 15807 76.79
SRR23329749 52602 52602 100 40091 76.22 38310 37227 70.77

What about the sequence lengths?

Table 9: raw2
(a) Descriptive Stats
Statistic Value
count 1631.00
min 1066.00
max 1594.00
mean 1442.26
range 528.00
std 36.16
(b) Percentiles
Quantile Value
0.02 1385.0
0.09 1405.7
0.25 1420.0
0.50 1445.0
0.75 1460.0
0.91 1482.0
0.98 1520.4
Table 10: raw3
(a) Descriptive Stats
Statistic Value
count 1725.00
min 1122.00
max 1590.00
mean 1459.32
range 468.00
std 36.46
(b) Percentiles
Quantile Value
0.02 1402.96
0.09 1423.00
0.25 1438.00
0.50 1464.00
0.75 1478.00
0.91 1499.00
0.98 1536.04
Table 11: filt2
(a) Descriptive Stats
Statistic Value
count 1684.00
min 1066.00
max 1593.00
mean 1439.50
range 527.00
std 40.06
(b) Percentiles
Quantile Value
0.02 1363.98
0.09 1400.94
0.25 1419.00
0.50 1444.00
0.75 1459.00
0.91 1481.00
0.98 1519.34

Using raw3 and filt2 for downstream analysis

Classification

Silva classifier may not give species level resolution. Since we have full length 16S rRNA reads, other classifiers like GreenGenes, GTDB, or NCBI may be useful. Most of the classiffiers are avaialble at QIIME2 resources page.

With NCBI classifier

# in q2_raw directory
(q2_261)$ qiime feature-classifier classify-sklearn --i-classifier ~/ncbi_refseqs_classifier_04032026.qza --i-reads 2_repseqs3.qza --o-classification 3_taxonomy_ncbi.qza --p-n-jobs 10
(q2_261)$ qiime metadata tabulate --m-input-file 3_taxonomy_ncbi.qza --o-visualization 3_taxonomy_ncbi.qzv
(q2_261)$ qiime taxa barplot --i-table 2_table3.qza --i-taxonomy 3_taxonomy_ncbi.qza --m-metadata-file ../metadata.tsv --o-visualization 3_taxa_plots_ncbi.qzv

Phylogeny

With mafft and iqtree

# in q2_raw
(q2_261)$ qiime phylogeny align-to-tree-mafft-iqtree --p-seed 380 --p-alrt 1000 --p-substitution-model 'GTR+G' --p-n-threads 10 --i-sequences 2_repseqs3.qza --o-alignment 4_aligned_repseqs.qza --o-masked-alignment 4_masked_rep_seqs.qza --o-tree 4_unrooted_tree.qza --o-rooted-tree 4_rooted_tree.qza

Rarefaction curves

# in q2_raw
(q2_261)$ qiime diversity alpha-rarefaction --i-table 2_table3.qza --i-phylogeny 4_rooted_tree.qza --p-max-depth 45000 --m-metadata-file ../metadata.tsv --o-visualization 5_alpha_rarefaction.qzv

The minimum feature count should be sufficient for rarefaction (Figure 1)

Figure 1: Alpha rarefaction curves (raw3)

Repeat these 3 steps (classification, phylogeny, and rarefaction curves) in the q2_filt directory

After classification and generation of taxa plots, it was observed that there were only 4 species identified across the samples. q2_filt method is not suitable for analysis.

Using HiFi 16S workflow

The official package for 16S amplicon analysis

Installation

As on 04 Jul 2026, newest version of nextflow is not working with this workflow. Using an older version (24.10)

$ git clone https://github.com/PacificBiosciences/HiFi-16S-workflow.git
$ cd HiFi-16S-workflow/
$ mamba create -n pb_16s
(pb_16s)$ mamba install -c bioconda nextflow=24.10*
(pb_16s)$ nextflow run main.nf --download_db

Run

(pb_16s)$ nextflow run main.nf --input /run/media/anwesh/hdd_4tb/Files/Analyses/Microbiome/amplicon/test_pacbio/manifest_pb16s.tsv --metadata /run/media/anwesh/hdd_4tb/Files/Analyses/Microbiome/amplicon/test_pacbio/metadata.tsv --outdir /run/media/anwesh/hdd_4tb/Files/Analyses/Microbiome/amplicon/test_pacbio/pb_16s --dada2_cpu 10 --vsearch_cpu 10 --cutadapt_cpu 10 --publish_dir_mode copy

All steps, except the last html report generation, were successful.

Use --skip_primer_trim parameter to skip primer trimming

Outputs

The numbers are slightly higher that the above methods (Table 12)

Table 12: Denoising stats (pb_16s)
sample.id input filtered percentage.of.input.passed.filter denoised non.chimeric percentage.of.input.non.chimeric
#q2:types numeric numeric numeric numeric numeric numeric
SRR23295634 47221 32814 69.49 25548 23568 49.91
SRR23295635 34849 22034 63.23 14797 14357 41.2
SRR23295636 64074 47509 74.15 39159 36398 56.81
SRR23329747 77958 63892 81.96 60919 57670 73.98
SRR23329748 19052 15790 82.88 15524 15520 81.46
SRR23329749 45923 37544 81.75 36198 35084 76.4

Sequence lengths: Visualization was not generated by the pipeline, so, generating one

# in pb_16s directory
(q2_261)$ qiime feature-table tabulate-seqs --i-data dada2/dada2-ccs_rep_filtered.qza --o-visualization results/dada2_rep_filtered.qzv
Table 13: Sequence lengths
(a) Descriptive Stats
Statistic Value
count 1364.00
min 1164.00
max 1586.00
mean 1443.12
range 422.00
std 33.25
(b) Percentiles
Quantile Value
0.02 1386.00
0.09 1407.00
0.25 1421.00
0.50 1445.00
0.75 1464.25
0.91 1482.00
0.98 1516.00
Figure 2: Alpha rarefaction curves (pb_16s)

The HiFi workflow is better over QIIME2 based outputs, with the provided parameters. QIIME2 workflow may need tweaking for a better output.