Ngs Quality Control 标志

Ngs Quality Control

组织
awslabs
ngs-quality-control

NGS quality control pipeline for short-read sequencing data. Triggers on FastQC, QC, quality control, adapter trimming, coverage, mosdepth, Picard metrics, fastp, MultiQC, sequencing QC, BAM QC, WGS/WES coverage analysis.

概览

发布者awslabs
代码仓库hcls-agent-skills
技能名称ngs-quality-control
星标数
71
复刻数
14
附带文件
1
许可协议MIT-0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 awslabs 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Ngs Quality Control AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/awslabs/hcls-agent-skills/tree/main/skills/ngs-quality-control
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/awslabs/hcls-agent-skills.git /tmp/hcls-agent-skills
mkdir -p .claude/skills
cp -r /tmp/hcls-agent-skills/skills/ngs-quality-control .claude/skills/ngs-quality-control
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Ngs Quality Control,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Ngs Quality Control。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Ngs Quality Control 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

NGS Quality Control

Overview

This skill encodes a reproducible QC workflow for Illumina short-read sequencing data across the full lifecycle: raw reads → trimmed reads → aligned BAMs. It produces deterministic metrics suitable for QC gating in WGS, WES, and targeted panel projects.

Pipeline stages:

  1. Raw-read QC — FastQC per FASTQ, aggregated with MultiQC.
  2. Adapter/quality trimming — fastp with paired-end adapter detection.
  3. Post-trim QC — FastQC + MultiQC on trimmed reads.
  4. Alignment QC — samtools stats/flagstat, Picard metric suites.
  5. Coverage QC — mosdepth (genome windows or target BED).
  6. Aggregation — MultiQC over all tool outputs for a single-HTML summary.

Usage

Assume THREADS=8, OUT=qc_out, paired FASTQs sample_R1.fastq.gz / sample_R2.fastq.gz, coordinate-sorted sample.bam with index, reference ref.fasta, and (for WES/panel) target intervals.

1. Raw FASTQ QC — FastQC

bash
mkdir -p $OUT/fastqc_raw
fastqc -t $THREADS -o $OUT/fastqc_raw *.fastq.gz

Key FastQC modules to inspect:

  • Per base sequence quality — Q30 drop-off toward 3′ end indicates trimming need.
  • Per sequence quality scores — bimodal distribution flags a failing tile/lane.
  • Per base sequence content — first ~12 bp bias is normal (random-hexamer priming); large bias elsewhere flags adapter/contamination.
  • Per sequence GC content — deviation from expected species GC → contamination or bias.
  • Sequence Duplication Levels — high duplication in non-amplicon libraries → library complexity issue.
  • Overrepresented sequences — adapter readthrough, rRNA, PhiX carryover.
  • Adapter Content — confirms which adapter set to trim.

2. Adapter & Quality Trimming — fastp

bash
mkdir -p $OUT/fastp
fastp \
  -i sample_R1.fastq.gz -I sample_R2.fastq.gz \
  -o $OUT/fastp/sample_R1.trim.fastq.gz -O $OUT/fastp/sample_R2.trim.fastq.gz \
  --detect_adapter_for_pe \
  --thread $THREADS \
  --html $OUT/fastp/sample.fastp.html \
  --json $OUT/fastp/sample.fastp.json

Useful additional flags:

  • --qualified_quality_phred 20 — base quality threshold (default 15).
  • --length_required 50 — drop reads shorter than 50 bp post-trim.
  • --cut_tail --cut_tail_window_size 4 --cut_tail_mean_quality 20 — sliding window 3′ quality trim.
  • --dedup — in-memory PCR duplicate removal (read-pair identity; prefer Picard/MarkDuplicates post-alignment for most workflows).

3. Post-trim QC + MultiQC

bash
mkdir -p $OUT/fastqc_trim
fastqc -t $THREADS -o $OUT/fastqc_trim $OUT/fastp/*.trim.fastq.gz

multiqc $OUT -o $OUT/multiqc

MultiQC auto-detects FastQC, fastp, Picard, samtools, and mosdepth outputs in the scanned directory.

4. Alignment QC — samtools

bash
samtools flagstat -@ $THREADS sample.bam > $OUT/samtools/sample.flagstat.txt
samtools stats    -@ $THREADS sample.bam > $OUT/samtools/sample.stats.txt
samtools idxstats sample.bam               > $OUT/samtools/sample.idxstats.txt

Pull from samtools stats: raw total sequences, reads mapped, error rate, insert size average, insert size standard deviation.

5. Picard Metric Suites

Picard requires a sequence dictionary (ref.dict) next to ref.fasta (picard CreateSequenceDictionary R=ref.fasta) and a Picard-format interval list for hybrid-capture metrics (.interval_list, header = BAM @SQ lines; not a plain BED).

bash
# Convert BED → interval_list (required for CollectHsMetrics)
picard BedToIntervalList \
  I=targets.bed O=targets.interval_list SD=ref.dict

# General alignment metrics (all library types)
picard CollectAlignmentSummaryMetrics \
  R=ref.fasta I=sample.bam O=$OUT/picard/sample.alignment_metrics.txt

# Insert size distribution (paired-end)
picard CollectInsertSizeMetrics \
  I=sample.bam O=$OUT/picard/sample.insert_size.txt \
  H=$OUT/picard/sample.insert_size.pdf

# WGS coverage metrics
picard CollectWgsMetrics \
  R=ref.fasta I=sample.bam O=$OUT/picard/sample.wgs_metrics.txt

# WES / targeted panel hybrid-selection metrics
picard CollectHsMetrics \
  R=ref.fasta I=sample.bam O=$OUT/picard/sample.hs_metrics.txt \
  BAIT_INTERVALS=baits.interval_list \
  TARGET_INTERVALS=targets.interval_list

6. Coverage — mosdepth

bash
# WGS: 500 bp fixed windows
mosdepth --by 500 --threads $THREADS --fast-mode --no-per-base \
  $OUT/mosdepth/sample_wgs sample.bam

# WES / panel: per-target coverage
mosdepth --by targets.bed --threads $THREADS --no-per-base \
  $OUT/mosdepth/sample_wes sample.bam

Outputs of interest:

  • *.mosdepth.summary.txt — mean depth per chromosome and total.
  • *.mosdepth.region.dist.txt — cumulative fraction of regions at ≥X coverage (use for % targets ≥20x).
  • *.regions.bed.gz — per-window/per-target mean depth.

Add --quantize 0:1:10:30: for stratified coverage bins, or --thresholds 10,20,30,50 to emit per-region pass counts at those depths.

Response Format

  • Lead with the command or code the user needs — explain after
  • Structure as: confirm inputs → working code → key parameters explained → gotchas
  • One complete working example per task; do not show every alternative
  • Keep code comments minimal and functional (what, not why-it-exists)
  • Target: 50-100 lines of code with brief surrounding explanation

Core Concepts

QC Tool Selection by Sequencing Type

Sequencing typeCoverage toolCoverage metricPicard suiteKey threshold
WGSmosdepth --by 500CollectWgsMetricsPCT_20X ≥ 95%Mean ≥ 30×
WESmosdepth --by targets.bedCollectHsMetricsPCT_TARGET_BASES_20X ≥ 80%On-target ≥ 60%
Targeted panelmosdepth --by targets.bedCollectHsMetricsPCT_TARGET_BASES_20X ≥ 95%Mean ≥ 500× (somatic)
RNA-seq— (use featureCounts/STAR logs)CollectRnaSeqMetricsPCT_CODING_BASESrRNA < 10%

All types: FastQC (raw + trimmed) → fastp (trim) → samtools flagstat → MultiQC (aggregate).

Quality encoding detection

Modern Illumina (CASAVA ≥1.8, 2011+) emits Phred+33 (Sanger). Legacy data (Illumina 1.3–1.7, Solexa) used Phred+64. Aligners expect Phred+33.

  • FastQC reports encoding in Basic Statistics → Encoding. Look for Sanger / Illumina 1.9.

  • Quick CLI check — inspect the quality-line ASCII range:

    bash
    zcat sample_R1.fastq.gz | head -4000 \
      | awk 'NR%4==0' \
      | od -An -c | tr -s ' \n' '\n' \
      | awk 'length==1' | sort -u

    Characters in the !–I range → Phred+33; characters @–h → Phred+64.

  • Convert legacy data: seqtk seq -Q64 -V in.fq > out.fq (shifts +64 → +33).

Trim parameter intent

  • Adapter trimming is for read-through into the adapter (insert < read length). --detect_adapter_for_pe uses read overlap, which is more reliable than sequence-based detection for paired-end.
  • Quality trimming is for 3′ quality decay on 2-channel chemistry (NextSeq/NovaSeq emit poly-G at dark cycles; use --trim_poly_g for those platforms — fastp auto-enables it by platform detection).
  • Do not hard-clip fixed lengths unless you know the library design (UMIs, inline barcodes).

Duplication: optical vs PCR

  • samtools flagstat "duplicates" reflects whatever flag is set in the BAM (usually by Picard MarkDuplicates or samtools markdup). Run MarkDuplicates after alignment, not on trimmed FASTQs.
  • CollectWgsMetrics / CollectHsMetrics report PCT_EXC_DUPE — fraction of bases excluded due to duplication. This is the canonical dup rate for coverage-based QC.

Coverage: mean vs uniformity

Mean depth alone is insufficient. Report both:

  • Mean target coverage (MEAN_TARGET_COVERAGE from HsMetrics; MEAN_COVERAGE from WgsMetrics).
  • Coverage breadth — % targets ≥20x / % genome ≥20x (PCT_TARGET_BASES_20X, PCT_20X in Picard; mosdepth region.dist.txt).

A panel with mean 200x but only 70% of targets at 20x has a coverage-uniformity problem (capture efficiency, GC bias).

Quick Reference

Quality thresholds (typical gating)

MetricWGSWESTargeted panelSource
Mean coverage≥ 30×≥ 50× on-target≥ 500× (somatic), ≥ 100× (germline)WgsMetrics / HsMetrics
Breadth at 20×≥ 95% genome≥ 80% of targets≥ 95% of targetsPicard PCT_20X / mosdepth
Breadth at 10× (germline)≥ 90%≥ 90% of targets≥ 98% of targetsPicard PCT_10X
Duplicate rate< 30%< 40%< 50% (UMI recommended)MarkDuplicates / Picard PCT_EXC_DUPE
Mapping rate> 95%> 95%> 95%samtools flagstat / AlignmentSummaryMetrics
Mean base quality≥ Q30 across ≥ 80% of basessamesameFastQC / fastp
Insert size (PE150)300–500 bp, SD < 20% of mean150–300 bplibrary-specificCollectInsertSizeMetrics
On-target (capture)n/a≥ 60% (PCT_SELECTED_BASES)≥ 70%CollectHsMetrics
Contamination< 1%< 1%< 1%VerifyBamID (outside this skill)

One-liners

bash
# Full raw → trimmed → FastQC → MultiQC
fastqc -t 8 -o qc/raw *.fastq.gz && \
fastp -i R1.fq.gz -I R2.fq.gz -o R1.trim.fq.gz -O R2.trim.fq.gz \
      --detect_adapter_for_pe --thread 8 --html fastp.html --json fastp.json && \
fastqc -t 8 -o qc/trim *.trim.fq.gz && \
multiqc qc -o qc/multiqc

# BAM QC bundle
samtools flagstat sample.bam > qc/sample.flagstat.txt
picard CollectAlignmentSummaryMetrics R=ref.fasta I=sample.bam O=qc/aln.txt
picard CollectInsertSizeMetrics I=sample.bam O=qc/ins.txt H=qc/ins.pdf
mosdepth --by 500 --threads 8 --fast-mode --no-per-base qc/sample sample.bam

Tool roles at a glance

ToolInputPrimary outputUse for
FastQCFASTQper-file HTML/zipraw & post-trim read quality
fastpFASTQ pairtrimmed FASTQ + JSON/HTMLadapter + quality trimming
samtools stats/flagstatBAMtextmapping counts, error rate
Picard AlignmentSummaryBAMtextstrand balance, PF reads, Q20/Q30 aligned bases
Picard InsertSizeBAMtext + PDFPE insert distribution
Picard WgsMetricsBAMtextWGS coverage + breadth
Picard HsMetricsBAMtextWES/panel on-target & coverage
mosdepthBAMBED + distfast windowed / per-target depth
MultiQCdirectorysingle HTMLcohort aggregation

Common Mistakes

  • Wrong: Running FastQC only after trimming Right: Run FastQC on both raw and trimmed reads Why: Pre-trim QC diagnoses the library; post-trim QC confirms trimming worked without over-clipping

  • Wrong: Passing a raw BED file to Picard CollectHsMetrics Right: Convert to Picard-format .interval_list via picard BedToIntervalList I=x.bed O=x.interval_list SD=ref.dict Why: BAIT_INTERVALS/TARGET_INTERVALS require .interval_list with a full @SQ header; a raw BED will fail or silently produce wrong metrics

  • Wrong: Using interval-list files with mismatched contig names or sort order Right: Ensure contig names (chr1 vs 1) and @SQ ordering match the BAM header exactly Why: Mismatches cause silent metric errors or tool failures

  • Wrong: Running MarkDuplicates on trimmed FASTQs or name-sorted BAMs Right: Run MarkDuplicates only on coordinate-sorted, aligned BAMs Why: MarkDuplicates requires coordinate-sorted aligned reads to identify optical and PCR duplicates

  • Wrong: Reporting only mean coverage as the QC metric Right: Always pair mean depth with breadth (% ≥20x) and duplicate rate Why: A high mean with poor uniformity hides failing targets

  • Wrong: Trusting auto-encoding detection on pre-2012 FASTQ data Right: Verify Phred encoding explicitly before alignment for ancient data Why: Phred+64 data passed to a modern aligner produces silently wrong base qualities

  • Wrong: Merging lanes/samples before running per-lane QC Right: Run FastQC per lane/FASTQ first; merge only after per-lane QC passes Why: A single bad lane becomes unidentifiable once merged

  • Wrong: Using --dedup in fastp as the primary deduplication step Right: Use Picard MarkDuplicates or samtools markdup post-alignment for deduplication Why: fastp --dedup only catches exact-sequence duplicates pre-alignment, missing alignment-based duplicates

  • Wrong: Running mosdepth on large genomes without --no-per-base Right: Always use --no-per-base for QC on large genomes Why: Per-base output is enormous and rarely needed; windowed/region output is sufficient for QC

References

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Ngs Quality Control AI 技能有什么作用?

NGS quality control pipeline for short-read sequencing data. Triggers on FastQC, QC, quality control, adapter trimming, coverage, mosdepth, Picard metrics, fastp, MultiQC, sequencing QC, BAM QC, WGS/WES coverage analysis.

为什么在 TypingMind 中使用 Ngs Quality Control?

因为您只需安装一次,就能搭配任何模型使用。Ngs Quality Control 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Ngs Quality Control?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/awslabs/hcls-agent-skills/tree/main/skills/ngs-quality-control。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Ngs Quality Control?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Ngs Quality Control 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Ngs Quality Control 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Ngs Quality Control AI 技能免费吗?

是的。awslabs 已在 GitHub 上根据 MIT-0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇