End-to-end eDNA metabarcoding from raw amplicons to community ecology. Covers QC, primer removal (mandatory before DADA2 filterAndTrim), denoising with OBITools3 v3 (obi stats plural; DMS-based) or DADA2 ASVs (Callahan 2017), decontam combined method as screening-not-classifier (Davis 2018), tag-jumping (Schnell 2015) with a platform-dependent baseline (NovaSeq patterned flow cells ~10x MiSeq), Hill-number effective species counts with coverage-based rarefaction (Jost 2006; Chao & Jost 2012; doubling rule), beta-diversity decomposition with MANDATORY PERMANOVA + PERMDISP pair (Anderson & Walsh 2013), constrained ordination, and the read-counts-not-abundance critique (Lamb 2019). Use when processing eDNA samples for biodiversity assessment, deciding ASV vs OTU, configuring OBITools3 v3, interpreting decontam screening, or reporting community comparisons with the dispersion confound check.
End-to-end eDNA metabarcoding from raw amplicons to community ecology. Covers QC, primer removal (mandatory before DADA2 filterAndTrim), denoising with OBITools3 v3 (obi stats plural; DMS-based) or DADA2 ASVs (Callahan 2017), decontam combined method as screening-not-classifier (Davis 2018), tag-jumping (Schnell 2015) with a platform-dependent baseline (NovaSeq patterned flow cells ~10x MiSeq), Hill-number effective species counts with coverage-based rarefaction (Jost 2006; Chao & Jost 2012; doubling rule), beta-diversity decomposition with MANDATORY PERMANOVA + PERMDISP pair (Anderson & Walsh 2013), constrained ordination, and the read-counts-not-abundance critique (Lamb 2019). Use when processing eDNA samples for biodiversity assessment, deciding ASV vs OTU, configuring OBITools3 v3, interpreting decontam screening, or reporting community comparisons with the dispersion confound check.
[{"after_demux":"Reads per sample >1000; negative controls <100 reads"},{"after_denoising":"Chimera rate <20% (>30% indicates library-prep issues); ASV/OTU count reasonable for marker"},{"after_decontam":"decontam combined method at threshold 0.1 (0.05 for low-biomass); biological-plausibility review of each flagged ASV; tag-jumping (Schnell 2015) rate quantified and filtered (~0.001-0.005 MiSeq; ~0.005-0.01 NovaSeq patterned flow cells)"},{"after_taxonomy":"Assignment rate marker-specific: 50-85% unassigned at species level is typical; report gap honestly"},{"after_diversity":"Hill numbers reported as effective species counts (not raw Shannon); coverage-based rarefaction at C=0.95; extrapolation bounded at 2x reference (doubling rule); sample completeness >80%"},{"after_ordination":"PERMANOVA + PERMDISP reported TOGETHER (Anderson & Walsh 2013); if betadisper significant, location conclusion is not supported"}]
Before using code patterns, verify installed versions match. If versions differ:
R: packageVersion('<pkg>') then ?function_name to verify parameters
CLI: <tool> --version then <tool> --help to confirm flags
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
eDNA Metabarcoding Pipeline
"Process my eDNA samples from raw reads to community ecology" -> Orchestrate primer removal, denoising (OBITools3 or DADA2), contamination filtering, taxonomy assignment, Hill number diversity estimation, and constrained ordination for species-environment analysis.
This is a workflow skill: it owns the chaining decisions and hand-offs, not the internals of any one step.
The governing principle
An eDNA community table is a position in a choice-chain (marker -> primer bias -> denoise -> decontam -> tag-jump -> taxonomy DB), never a census; the trustworthy result is decided at these seams.
The marker + primer set + reference DB are committed together (COI/12S/ITS/rbcL/18S). The marker fixes both what taxa amplify and the achievable assignment rate; 50-85% unassigned AT SPECIES LEVEL is TYPICAL (higher ranks assign far better) and must be reported honestly (a high unassigned fraction is a database gap, not a pipeline failure). Report the marker's known primer bias with every result.
Read counts are NOT abundance (Lamb 2019). eDNA read counts reflect biomass AND primer affinity AND copy number AND degradation — commit to presence/occupancy or effective-species-count framing, never raw-read "abundance". This is the eDNA analogue of the metagenomics read-fraction != cell-fraction seam.
Coverage-based (not size-based) rarefaction; Hill numbers as effective species counts; Chao1 is a LOWER bound. Commit to iNEXT coverage-standardization at C~0.95 and the doubling-rule extrapolation bound (Chao & Jost 2012); report Chao1 as ">=" and NEVER compute it after aggressive denoising (singletons stripped -> Chao1 degenerates to observed richness).
The platform sets the tag-jump baseline, committed at sequencing. The tag-jump phenomenon (Schnell 2015) has a platform-dependent rate: MiSeq index-hopping ~0.001-0.005 vs NovaSeq patterned flow cells ~10x higher; quantify and platform-filter the residual rate. And decontam is SCREENING, not a classifier (Davis 2018) — every flagged ASV gets a biological-plausibility review; retain only where statistics AND plausibility agree.
Made-once commitments
Commitment
Consequence inherited downstream
Marker + primer set + reference DB
What amplifies + the assignment rate; 50-85% unassigned at species level is typical; report the primer bias + DB release
Read-counts-not-abundance framing
Presence/occupancy or effective-species-count only; raw-read "abundance" is invalid
# Gate 1: Chimera rate <20%if(chimera_rate >0.20) message('WARNING: High chimera rate. Check primer removal and PCR conditions.')# Gate 2: ASV count reasonable for marker
n_asvs <- ncol(seqtab_nochim)
message(sprintf('ASVs after denoising: %d', n_asvs))# Typical ranges: COI 500-5000, 12S 50-500, ITS 200-3000
Step 4: Contamination Filtering
R (decontam)
library(decontam)
library(phyloseq)
ps <- phyloseq(otu_table(seqtab_nochim, taxa_are_rows =FALSE),
sample_data(meta))# Identify negative controls
sample_data(ps)$is_neg <- sample_data(ps)$sample_type =='negative_control'# Combined method (Davis 2018): uses BOTH negative controls AND DNA concentration# threshold=0.1 default; 0.05 for low-biomass samples# CRITICAL: output is SCREENING, not classification; biological-plausibility check requiredif('dna_concentration'%in% sample_variables(ps)){
contam <- isContaminant(ps, method ='combined', neg ='is_neg',
conc ='dna_concentration', threshold =0.1)}else{# Fall back to prevalence-only if no qPCR/Qubit DNA-concentration data
contam <- isContaminant(ps, method ='prevalence', neg ='is_neg',
threshold =0.1)}
message(sprintf('Flagged candidate contaminant ASVs: %d',sum(contam$contaminant)))
message('Manual review required: verify biological plausibility before deletion')
ps_clean <- prune_taxa(!contam$contaminant, ps)# Remove negative control samples
ps_clean <- subset_samples(ps_clean, sample_type !='negative_control')
# Tag-jumping: cross-contamination from index hopping during library prep / sequencing# Schnell 2015 Mol Ecol Resour 15:1289-1303 documented 0.1-2% per read pair# NovaSeq patterned flow cells have ~10x higher rates than MiSeq# Use platform-appropriate threshold:# MiSeq: 0.001-0.005 (0.1-0.5% of ASV total)# NovaSeq: 0.005-0.01 (0.5-1% of ASV total)# Quantify residual rate first from per-ASV cross-sample appearance
otu <- as(otu_table(ps_clean),'matrix')
max_per_asv <- apply(otu,2,max)
otu_filtered <- otu
# Set threshold by platform; default below is for MiSeq
tag_jump_frac <- 0.001
for(j in1:ncol(otu)){
threshold <- max_per_asv[j]* tag_jump_frac
otu_filtered[otu[, j]< threshold, j]<-0}
otu_table(ps_clean)<- otu_table(otu_filtered, taxa_are_rows =FALSE)# Modern alternative: metabaR::tagjumpslayer(metabarlist_obj, threshold = 0.03)
QC Checkpoint: Decontamination
# Gate: verify contaminant ASVs were removed from real samples
n_before <- ntaxa(ps)
n_after <- ntaxa(ps_clean)
message(sprintf('ASVs removed as contaminants: %d (%.1f%%)',
n_before - n_after,(n_before - n_after)/ n_before *100))if((n_before - n_after)/ n_before >0.5){
message('WARNING: >50% ASVs flagged as contaminants. Review decontam threshold.')}
# SILVA for 16S/18S, UNITE for ITS, custom for COI/12S# Reference databases must be formatted for DADA2# minBoot 50: minimum bootstrap confidence; 80 for more conservative assignments
taxa <- assignTaxonomy(seqtab_nochim,'reference_db.fa.gz', multithread =TRUE, minBoot =50)
taxa <- addSpecies(taxa,'species_db.fa.gz')
ecological-genomics/community-ecology - Ordination and indicator species
read-qc/quality-reports - Raw read quality assessment
reporting/automated-qc-reports - Aggregate FastQC across samples with MultiQC (a triage snapshot, not a pass/fail gate)
microbiome/amplicon-processing - 16S clinical alternative
References
Lamb PD, Hunter E, Pinnegar JK, et al (2019) How quantitative is metabarcoding? A meta-analytical approach. Molecular Ecology 28:420-430. DOI 10.1111/mec.14920. (read counts are not abundance.)
Schnell IB, Bohmann K, Gilbert MTP (2015) Tag jumps illuminated - reducing sequence-to-sample misidentifications in metabarcoding studies. Molecular Ecology Resources 15:1289-1303. DOI 10.1111/1755-0998.12402. (tag jumping.)
Davis NM, Proctor DM, Holmes SP, Relman DA, Callahan BJ (2018) Simple statistical identification and removal of contaminant sequences in marker-gene and metagenomics data. Microbiome 6:226. DOI 10.1186/s40168-018-0605-2. (decontam.)
Anderson MJ, Walsh DCI (2013) PERMANOVA, ANOSIM, and the Mantel test in the face of heterogeneous dispersions. Ecological Monographs 83:557-574. DOI 10.1890/12-2010.1. (PERMANOVA + PERMDISP.)