Agent skill

Amplicon Primer Clipping

by GPTomics in GPTomics/bioSkills

Soft- or hard-clips PCR primer footprints from aligned amplicon BAMs so primer bases stop masquerading as confirmed reference sequence.

MITAuto-check passedResearch & Science

Install Amplicon Primer Clipping

skills CLI
$ npx skills add GPTomics/bioSkills --skill bio-alignment-amplicon-clipping -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install GPTomics/bioSkills bio-alignment-amplicon-clipping --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/GPTomics/bioSkills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/alignment-files/alignment-amplicon-clipping .claude/skills/bio-alignment-amplicon-clipping && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bio-alignment-amplicon-clipping
GitHub stars
1.2k
Used in
2 other repos
Token cost
~2.2k tokens
SKILL.md length
959 words
Files
3
Skills in repo
559
Repo updated
First seen
Licence
MIT

At a glance

Soft- or hard-clips PCR primer footprints from aligned amplicon BAMs so primer bases stop masquerading as confirmed reference sequence.

  • Processing SARS-CoV-2 ARTIC amplicon sequencing data
  • SKILL.md covers Version Compatibility, Why Primer Trimming After…, Tool Selection and Soft-Clip vs Hard-Clip, plus 8 more sections
  • Runs Shell scripts from its folder; calls pip
  • Trimming primers from hereditary cancer or ctDNA hot-spot panel BAMs

What it does

Primer-derived bases at a read's 5' end reflect the PCR primer, not the biological sample, so leaving them in causes false reference confirmation at primer sites, suppressed variant allele frequency under primers, and strand-bias artifacts. The skill also warns that standard amplicon BAMs should never go through markdup, because every read anchored at a primer site looks like a coordinate duplicate by design.

A tool-selection table compares options: samtools ampliconclip as the default since version 1.11, which clips from a primer BED file and invalidates MD and NM tags in the process, iVar trim for the Illumina SARS-CoV-2 PrimalSeq route, BAMClipper for capture or hybrid panels with primer overlap, fgbio ClipBam when mate-aware end adjustment matters, and cutadapt for trimming before alignment. Soft-clipping is the safe default, kept reversible in the BAM, with hard-clipping reserved for archiving under real storage constraints.

When your agent uses it

  • Processing SARS-CoV-2 ARTIC amplicon sequencing data
  • Trimming primers from hereditary cancer or ctDNA hot-spot panel BAMs
  • Choosing between soft-clip and hard-clip for an amplicon assay

Example prompts

  • “Trim the ARTIC primers from this aligned BAM with samtools ampliconclip.”
  • “Which primer-clipping tool fits a hybrid capture panel with primer overlap?”
  • “Should I soft-clip or hard-clip before archiving this amplicon BAM?”

Requirements

  • samtools 1.19 or newer (ampliconclip itself needs 1.11+)
  • A primer BED file matching the amplicon panel

What it can do on your machine

Read from SKILL.md and the folder at commit d91ed3d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Amplicon Primer Clipping loads about 2.2k tokens when it runs. Until then it costs about 77 tokens; SKILL.md has 959 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~77
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from GPTomics/bioSkills at commit d91ed3d, republished under its MIT licence (© GPTomics). 959 words, ~2,249 tokens.

Download SKILL.mdSave it as .claude/skills/bio-alignment-amplicon-clipping/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
bio-alignment-amplicon-clipping
description
Trim PCR primers from aligned reads in amplicon-panel BAMs using samtools ampliconclip. Use when processing SARS-CoV-2 ARTIC, hereditary cancer panels, ctDNA hot-spot panels, or any amplicon assay where primer-derived bases would falsely confirm reference at primer footprints.
tool_type
cli
primary_tool
samtools

Version Compatibility

Reference examples tested with: samtools 1.19+, pysam 0.22+

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show <package> then help(module.function) to check signatures
  • 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.

Alignment Amplicon Clipping

"Trim primer-derived bases from amplicon BAM" -> Soft- or hard-clip the 5' primer footprint after alignment using a primer BED, then repair fixmate/MD/NM tags.

  • CLI: samtools ampliconclip -b primers.bed input.bam -o clipped.bam (since samtools 1.11)
  • Alternative: iVar trim, BAMClipper, fgbio ClipBam

Why Primer Trimming After Alignment

Amplicon panels (SARS-CoV-2 ARTIC, hereditary cancer panels, ctDNA hot-spot panels, fusion panels, 16S rRNA) use designed PCR primers for enrichment. Primer-derived bases at read 5' ends do NOT reflect biological sequence -- they reflect the primer template. Without trimming:

  • False reference confirmation at primer footprint positions.
  • Variant allele frequency suppressed at variants under primers (the primer sequence cannot capture the variant base).
  • Strand bias artifacts (primers are typically one-strand).

Standard amplicon BAMs should NEVER be processed by samtools markdup -- by design every read at a primer location is a "duplicate" by coordinate. See duplicate-handling for the assay-aware decision.

Tool Selection

ToolWhenNotes
samtools ampliconclipDefault for amplicon panels (since 1.11)Soft- or hard-clip from BED; modifies CIGAR; invalidates MD/NM
iVar trimIllumina SARS-CoV-2 / PrimalSeq route (Andersen lab)Coordinates by primer name/position; soft-clips only + quality sliding-window
BAMClipperCapture / hybrid panels with primer overlap5'-end clipping with overlap handling
fgbio ClipBamWhen read-pair coordination mattersSoft/hard-clip with mate-aware end adjustment
cutadapt (pre-alignment)Legacy / when alignment is downstreamTrims at FASTQ stage; less precise for amplicon

Soft-Clip vs Hard-Clip

Goal: Decide whether trimmed bases are kept in the BAM (reversible) or discarded (irreversible).

Approach: Soft-clip is the safe default; hard-clip only when archiving and disk is constrained.

ModeFlagWhat it doesReversible?
Soft-clip(default) / --soft-clipBases kept in SEQ; CIGAR uses S; bases not alignedYes (CIGAR can be re-extended)
Hard-clip--hard-clipBases removed from SEQ; CIGAR uses HNo (bases lost)

Soft-clip is the recommended default. Hard-clip is irreversible -- once applied, the trimmed bases cannot be recovered for re-analysis with different primer coordinates.

Basic ampliconclip Workflow

Goal: Trim primers from a coordinate-sorted, indexed amplicon BAM and produce a downstream-ready BAM.

Approach: Run ampliconclip with primer BED, choosing either --strand (5' strand-aware) or --both-ends (read-through amplicons; note --both-ends overrides --strand), then re-fixmate (CIGAR changed) and re-calmd (MD/NM tags invalidated by clip).

bash
# 1. Soft-clip primers (default; reversible). --strand clips only the designed strand.
samtools ampliconclip --strand --soft-clip \
    -b primers.bed input.bam -o clipped.bam

# 2. Re-pair tags (CIGARs changed -- mate info needs refresh)
samtools sort -n clipped.bam | \
    samtools fixmate -m - - | \
    samtools sort -o sorted.bam -

# 3. Repair MD/NM tags (invalidated by clip; required by mpileup BAQ and IGV)
samtools calmd -b sorted.bam reference.fa > clipped_final.bam
samtools index clipped_final.bam
Strand-Aware Clipping

--strand clips primer bases only on the strand the primer is designed for. Without --strand, both strands are clipped at the primer site, removing valid biological sequence on the off-strand.

Both-End Clipping

--both-ends allows clipping at both 5' and 3' positions of the read (some primers can appear at either end after alignment). Necessary for amplicon designs where reads can read through the entire amplicon. When --both-ends is set, --strand is ignored -- primer sites at both ends are clipped regardless of the BED strand column:

bash
samtools ampliconclip --both-ends --soft-clip -b primers.bed input.bam -o clipped.bam

Primer BED Format

# tab-separated, 0-based half-open like all BED
chr1   100   125   primer_1_F    +
chr1   500   525   primer_1_R    -
chr1   600   625   primer_2_F    +
chr1   1000  1025  primer_2_R    -

Tools that consume the BED: column 1-3 (region), column 6 (strand) is required for --strand. ARTIC primer schemes ship pre-built BEDs (e.g., primer.bed from artic-network/primer-schemes).

Show full SKILL.md (425 more words)Show less

SARS-CoV-2 ARTIC Comparison

ToolApproachWhen
samtools ampliconclipSoft-clip from BED, post-alignmentGeneral amplicon panels; modern ARTIC workflows
iVar trimSoft-clip with primer-position parsing + quality trimnf-core/viralrecon; Illumina PrimalSeq route (Andersen lab)

Note: the ARTIC network's own nanopore field-bioinformatics pipeline (artic minion) trims primers with its align_trim tool, not iVar; iVar (Grubaugh et al. 2019, Genome Biol 20:8) is the Illumina/PrimalSeq route. Modern viral consensus pipelines tend to use ampliconclip then samtools consensus --config hiseq --ambig (Illumina preset) for IUPAC heterozygote handling. See reference-operations for consensus generation.

After Clipping: Required Re-Processing

Clipping invalidates several tags and CIGAR-derived fields:

FieldImpactRepair
CIGARNew S or H operations addedAutomatic from ampliconclip
MD:ZMismatch positions now wrongsamtools calmd -b in.bam ref.fa
NM:iEdit distance recomputedsamtools calmd
TLENTemplate length changes when both mates clippedsamtools fixmate -m
ms, MC:ZMate score (lowercase per SAMtags) / mate CIGARsamtools fixmate -m

A clipped BAM that bypasses fixmate + calmd causes silent failures in bcftools mpileup BAQ (which depends on MD), IGV mismatch coloring, and any tool using NM for filtering.

Why Not Markdup

Amplicon reads at primer locations are by design coordinate-degenerate -- every read mapped to the same amplicon shares the same start/end coordinates because they all come from the same primer pair. samtools markdup would mark essentially every read as a duplicate and erase the dataset. For amplicon panels:

  • WITHOUT UMIs: skip dedup entirely; rely on coverage uniformity from amplicon design.
  • WITH UMIs (deep panels): use fgbio GroupReadsByUmi -> CallMolecularConsensusReads instead of markdup. See duplicate-handling.

Common Errors

ErrorCauseSolution
MD tag mismatch after clippingcalmd not runRun samtools calmd -b clipped.bam ref.fa
Variant calls with strand bias at every amplicon endForgot --strandRe-run with strand-aware clipping
Markdup output shows ~100% duplicatesAmplicon BAM was processed with markdupRestart from raw alignment; use ampliconclip; skip markdup
Unexpected reference confirmation at primer-overlapping variantsampliconclip not runRun before variant calling

Quick Reference

TaskCommand
Soft-clip primers (strand-aware)samtools ampliconclip --strand -b primers.bed in.bam -o clipped.bam
Soft-clip primers (read-through amplicons)samtools ampliconclip --both-ends -b primers.bed in.bam -o clipped.bam
Hard-clip (irreversible)samtools ampliconclip --strand --hard-clip -b primers.bed in.bam -o clipped.bam
Repair MD/NM after clipsamtools calmd -b clipped.bam ref.fa > final.bam
Repair mate infosamtools sort -n - | samtools fixmate -m - - | samtools sort -o out.bam -
  • duplicate-handling - Why amplicon BAMs should not be markdup'd; UMI-aware alternatives
  • alignment-filtering - Post-clip filtering for amplicon variant calling
  • alignment-sorting - Re-sort after fixmate
  • pileup-generation - mpileup flags for amplicon (-aa -A -d 600000 -B)
  • reference-operations - Consensus generation from amplicon BAMs (samtools consensus)
  • read-qc/quality-reports - Pre-alignment adapter/quality trimming

© GPTomics, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files in alignment-files/alignment-amplicon-clipping of GPTomics/bioSkills.

  • SKILL.md
  • examples/ampliconclip_workflow.sh
  • usage-guide.md

Open the folder on GitHubat commit d91ed3d

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in GPTomics/bioSkills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Amplicon Primer Clipping next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Amplicon Primer Clipping compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Amplicon Primer Clipping this skillGPTomics/bioSkills1.2k2 repos~2.2kAutomated safety check: PassMIT
Pysamdavila7/claude-code-templates33k10 repos~2.5kAutomated safety check: PassMIT
PysamK-Dense-AI/scientific-agent-skills48k1 repos~3.4kAutomated safety check: NotesMIT
Omics ToolsDrugClaw/DrugClaw126—~1.1kAutomated safety check: PassApache-2.0
Tooluniverse Epigenomicswu-yc/LabClaw1.1k2 repos~14kAutomated safety check: PassNone
Biopython Sequence Analysisjaechang-hits/SciAgent-Skills3741 repos~8.5kAutomated safety check: PassBSD-3-Clause

Similar skills

  • Pysam

    davila7/claude-code-templates

    Genomic file toolkit. An agent skill from davila7/claude-code-templates.

    33k GitHub starsUsed in 10 repos~2.5k tokens
    Research & ScienceAuto-check passed
  • Pysam

    K-Dense-AI/scientific-agent-skills

    Provides Python/HTSlib workflows for genomic files. An agent skill from K-Dense-AI/scientific-agent-skills.

    48k GitHub starsUsed in 1 repo~3.4k tokens
    Research & ScienceAuto-check: notes
  • Omics Tools

    DrugClaw/DrugClaw

    Omics and single-cell workflow guide for AnnData, Scanpy-style dataset profiling, PyDESeq2-oriented count checks, pysam alignment inspection, and pyOpenMS mass-spectrometry summaries.

    126 GitHub stars~1.1k tokensUpdated 6 mo ago
    Research & ScienceAuto-check passed
  • Production-ready genomics and epigenomics data processing for BixBench questions.

    1.1k GitHub starsUsed in 2 repos~14k tokens
    Research & ScienceAuto-check passed
  • Biopython Sequence Analysis

    jaechang-hits/SciAgent-Skills

    Biopython sequence analysis: parse FASTA/FASTQ/GenBank/GFF (SeqIO), NCBI Entrez (esearch/efetch/elink), remote/local BLAST, pairwise/MSA alignment (PairwiseAligner, MUSCLE/ClustalW), phylogenetic…

    374 GitHub starsUsed in 1 repo~8.5k tokens
    Research & ScienceAuto-check passed
  • Samtools Bam Processing

    jaechang-hits/SciAgent-Skills

    CLI toolkit for SAM/BAM/CRAM: sort, index, convert, filter, QC alignments.

    374 GitHub starsUsed in 1 repo~4.1k tokens
    Research & ScienceAuto-check passed

More from GPTomics/bioSkills

All 559 skills in this repo
  • Bio Alignment Io

    GPTomics/bioSkills

    Read, write, and convert multiple sequence alignment files using Biopython Bio.AlignIO.

    1.2k GitHub starsUsed in 3 repos~4.9k tokens
    Auto-check passed
  • bioSkills Installer

    GPTomics/bioSkills

    Installs the bioSkills collection of 425 bioinformatics skills in one step, or only chosen categories, so sequencing, RNA-seq, single-cell and variant tasks get specialized help.

    1.2k GitHub starsUsed in 1 repo~789 tokens
    Auto-check passed
  • Bio Write Sequences

    GPTomics/bioSkills

    Write biological sequences to files (FASTA, FASTQ, GenBank, EMBL) using Biopython Bio.SeqIO.

    1.2k GitHub starsUsed in 3 repos~2.1k tokens
    Auto-check passed
  • Filters BAM alignments by FLAG bits, mapping quality and regions with samtools view or pysam, with recipes for common keep and drop cases.

    1.2k GitHub starsUsed in 2 repos~3.6k tokens
    Auto-check passed
  • Bio Alignment Indexing

    GPTomics/bioSkills

    Create and use BAI/CSI indices for BAM/CRAM files using samtools and pysam.

    1.2k GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • Bio Alignment Sorting

    GPTomics/bioSkills

    Sort alignment files by coordinate or read name using samtools and pysam.

    1.2k GitHub starsUsed in 2 repos~2.6k tokens
    Auto-check passed

Works with

Questions about Amplicon Primer Clipping

What does Amplicon Primer Clipping do?

Soft- or hard-clips PCR primer footprints from aligned amplicon BAMs so primer bases stop masquerading as confirmed reference sequence. Primer-derived bases at a read's 5' end reflect the PCR primer, not the biological sample, so leaving them in causes false reference confirmation at primer sites, suppressed variant allele frequency under primers, and strand-bias artifacts. The skill also warns that standard amplicon BAMs should never go through markdup, because every read anchored at a primer site looks like a coordinate duplicate by design.

When should I use Amplicon Primer Clipping?

Amplicon Primer Clipping fits situations like: processing SARS-CoV-2 ARTIC amplicon sequencing data; trimming primers from hereditary cancer or ctDNA hot-spot panel BAMs; choosing between soft-clip and hard-clip for an amplicon assay.

How do I install Amplicon Primer Clipping in Claude Code?

Run `npx skills add GPTomics/bioSkills --skill bio-alignment-amplicon-clipping -a claude-code`. Or copy the skill folder (alignment-files/alignment-amplicon-clipping in GPTomics/bioSkills) into .claude/skills/bio-alignment-amplicon-clipping in your project. Claude Code loads it when a task matches its description.

How do I install Amplicon Primer Clipping in Codex?

Run `npx skills add GPTomics/bioSkills --skill bio-alignment-amplicon-clipping -a codex`. Or copy the skill folder (alignment-files/alignment-amplicon-clipping in GPTomics/bioSkills) into .agents/skills/bio-alignment-amplicon-clipping in your project. Codex loads it when a task matches its description.

Can I use Amplicon Primer Clipping in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add GPTomics/bioSkills --skill bio-alignment-amplicon-clipping -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bio-alignment-amplicon-clipping, .gemini/skills/bio-alignment-amplicon-clipping, .github/skills/bio-alignment-amplicon-clipping and .opencode/skills/bio-alignment-amplicon-clipping in your project.

What does Amplicon Primer Clipping need to run?

Going by SKILL.md and its folder, Amplicon Primer Clipping needs a shell for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: samtools 1.19 or newer (ampliconclip itself needs 1.11+); A primer BED file matching the amplicon panel.

Does Amplicon Primer Clipping access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Amplicon Primer Clipping safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Amplicon Primer Clipping use?

Amplicon Primer Clipping is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Amplicon Primer Clipping use?

About 2.2k tokens (SKILL.md is roughly 9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Amplicon Primer Clipping?

Skills that share tags, products or a category with Amplicon Primer Clipping: Pysam (davila7/claude-code-templates, 33k stars), Pysam (K-Dense-AI/scientific-agent-skills, 48k stars), Omics Tools (DrugClaw/DrugClaw, 126 stars) and Tooluniverse Epigenomics (wu-yc/LabClaw, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Amplicon Primer Clipping?

GPTomics (a GitHub organization) maintains it in GPTomics/bioSkills, which has 1,218 GitHub stars. The repository holds 559 skills in this directory. The repository was last updated on August 15, 2026.

Source: GPTomics/bioSkills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.