← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-alignment-files-alignment-amplicon-clipping / references / usage-guide.md

Alignment Amplicon Clipping

Trim PCR primers from aligned reads in amplicon-panel BAMs.

Overview

Amplicon panels (SARS-CoV-2 ARTIC, hereditary cancer panels, ctDNA hot-spot panels, fusion panels, 16S rRNA) use designed PCR primers for enrichment. The primer footprint at read 5' ends does not represent biological sequence; without trimming, downstream variant calls suppress true variants under primers and falsely confirm reference at primer locations.

This skill covers post-alignment primer clipping with samtools ampliconclip, the required tag-repair steps (fixmate, calmd), and the relationship to duplicate marking (do not run markdup on amplicon BAMs without UMIs).

Prerequisites

conda install -c bioconda samtools
# Verify ampliconclip is available
samtools ampliconclip --help

Quick Start

Tell your AI agent what you want to do: - "Trim ARTIC SARS-CoV-2 primers from my amplicon BAM" - "Soft-clip primers using my primer BED" - "Why is markdup marking everything as duplicate on my amplicon panel?" - "Repair the MD/NM tags after primer clipping" - "Hard-clip primers for archival storage"

Example Prompts

SARS-CoV-2 / ARTIC

"I have a SARS-CoV-2 ARTIC BAM aligned with bwa-mem. Soft-clip primers using artic_v3 primer BED, then prepare for consensus calling."

"Compare samtools ampliconclip vs iVar trim for the ARTIC SARS-CoV-2 pipeline."

Cancer Panels

"ctDNA hot-spot panel with TruSeq UMIs. Trim primers, then run UMI consensus rather than markdup."

"Hereditary cancer panel from a Roche AVENIO design. Why is my variant caller missing variants at primer-overlapping positions?"

General Amplicon Workflows

"My amplicon BAM ran through markdup and now flagstat shows 99% duplicates. What went wrong?"

"After ampliconclip, my downstream mpileup is reporting wrong reference bases. What tag did clipping invalidate?"

What the Agent Will Do

  1. Inspect the BAM to confirm it is amplicon-style (read coordinates clustered at amplicon start/end positions; check samtools view -H for @PG indicating an amplicon panel kit).
  2. Locate or generate the primer BED file matching the kit.
  3. Run samtools ampliconclip --strand --soft-clip -b primers.bed (or --both-ends instead of --strand for read-through amplicons).
  4. Re-fixmate and re-calmd to repair invalidated tags.
  5. Confirm with a region inspection (samtools view -h clipped.bam chr1:start-end) that primer footprint has soft-clip CIGAR ops.

Decision Points

Tips