Skip to content

fix(dev): correct ITS primers to gITS7/ITS4; add the ITS case to the prep page - #116

Merged
cjfields merged 2 commits into
mainfrom
fix/its-primers-gits7-its4
Aug 3, 2026
Merged

fix(dev): correct ITS primers to gITS7/ITS4; add the ITS case to the prep page#116
cjfields merged 2 commits into
mainfrom
fix/its-primers-gits7-its4

Conversation

@cjfields

@cjfields cjfields commented Aug 2, 2026

Copy link
Copy Markdown
Member

dev/cutadapt_ITS.sh was a copy of the V3–V4 script with ITS1f/ITS2 pasted in, taken on the strength of the NCBI annotation Design: ITS1FI2-ITS2 (ITS2). Verified against the reads (two samples, 50k reads, 5' end), neither named primer is present:

primer R1 R2
gITS7 GTGARTCATCGARTCTTTG 92.5% (offset 0, no pad) 0%
ITS4 TCCTCCGCTTATTGATATGC 0% 90.9% (offset 4, constant GATA pad)
ITS1F / ITS1FI2 / ITS1 / ITS1F_KYO2 0% 0%
ITS86F 49.3% 0%

ITS86F is the non-degenerate form of gITS7 and matches only the subset where the degenerate base is A — confirmed by base composition at that position (53.4% A / 46.6% G, i.e. real degenerate synthesis).

As written the script would have stripped nothing. Corrected, it removes both primers to 0.00% residual at 97.6% pair retention, leaving R1 median 231 nt (250−19) and R2 226 nt (250−24), exactly as predicted.

The inverse failure

gITS7+ITS4 amplifies the ITS2 region, so here the region label is right and the primer names are wrong — the opposite of the 16S arm in the same deposit. The trap is that "ITS2" names both a region and a primer: ITS1FI2 + the ITS2 primer would amplify ITS1, so the annotation contradicts its own region label. Reading either half as authoritative sends you somewhere different.

Two ITS-specific hazards now documented

  • ITS length varies by hundreds of nt across taxa, so any --trunc-len is a taxonomic filter, not a quality one — it systematically deletes every fungus above the cutoff. Same asymmetry at the merge step: long-ITS taxa may fail to overlap and drop out, so an ITS merge rate is not taxonomically neutral the way a 16S one is.
  • Short amplicons read through into the far primer, so -a/-A are load-bearing here rather than belt-and-braces.

Neither hazard exists on a fixed-insert 16S amplicon, so 16S habits do not transfer.

Also worth noting: the offsets here are constant (R1 at 0, R2 at 4), so a fixed --trim-left would work on this arm — unlike the 16S arm. Spacer layout is a property of a prep, not a platform, and has to be measured per dataset rather than assumed in either direction. The script's diagnostic now prints offset distributions for both primers and says which reading implies which.

Adds a section to docs/findings/reading-the-prep.md recording the ITS case as the second example.

cjfields and others added 2 commits August 2, 2026 00:04
…prep page

dev/cutadapt_ITS.sh was a copy of the V3-V4 script with ITS1f/ITS2 pasted in on
the strength of the NCBI annotation ("Design: ITS1FI2-ITS2 (ITS2)"). Verified
against the reads, neither named primer is present:

  R1  gITS7 GTGARTCATCGARTCTTTG   92.5%, offset 0, no pad
  R2  ITS4  TCCTCCGCTTATTGATATGC  90.9%, offset 4 behind a constant GATA pad
      ITS1F / ITS1FI2 / ITS1 / ITS1F_KYO2: 0%

As written the script would have stripped nothing. Corrected, it removes both
primers to 0.00% residual at 97.6% pair retention, leaving R1 median 231 nt
(250-19) and R2 226 nt (250-24) as expected.

gITS7+ITS4 amplifies the ITS2 region, so unlike the 16S arm the REGION label is
right and the PRIMER NAMES are wrong -- the inverse failure in the same deposit.
"ITS2" names both a region and a primer, and ITS1FI2 + the ITS2 primer would
amplify ITS1, so the annotation contradicts itself.

Two ITS-specific hazards now documented in the script's next-steps and on the
findings page: ITS length varies by hundreds of nt across taxa, so any
--trunc-len is a taxonomic filter rather than a quality one, and short amplicons
read through into the far primer so -a/-A are load-bearing. Also notes the
offsets here are constant (a fixed --trim-left would work), unlike the 16S arm --
spacer layout is a property of a prep, not a platform.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dev/subsample_fastq.py rarefies a run to several fractions at once for
depth-ladder experiments (how does inference move as coverage per variant
falls?).

seqkit is the preferred tool where available and the docstring says so --
`seqkit sample -p F -s SEED` was verified reproducible, pair-synced and
nested across fractions at fixed seed. This script covers the two cases
seqkit does not guarantee by construction: its nesting is emergent from
per-record PRNG draws rather than documented, and its pair sync is
positional so it desynchronises silently if a mate is reordered.

Here the keep/drop decision is a hash of the read NAME, so nesting and pair
safety hold by definition regardless of file order, and a mate mismatch is a
hard error. Whole ladder in one decompression pass; realized counts to TSV.

Also fixes a stale cutadapt_v3v4.sh usage string in cutadapt_ITS.sh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@cjfields
cjfields merged commit a7b7745 into main Aug 3, 2026
7 checks passed
@cjfields
cjfields deleted the fix/its-primers-gits7-its4 branch August 3, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant