/bio-copy-number-cnvkit-analysis
Detect copy number variants from targeted/exome sequencing using CNVkit. Supports tumor-normal pairs, tumor-only, and germline CNV calling. Use when detecting CNVs from WES or targeted panel sequencing data.
Claude Code
$ npx -y skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis --agent claude-code
Codex
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis -a codex -y
Cursor
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis -a cursor -y
Gemini CLI
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis -a gemini-cli -y
GitHub Copilot
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis -a github-copilot -y
OpenCode
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis -a opencode -y
Windsurf
$ npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis -a windsurf -y
SKILL.md
bio-copy-number-cnvkit-analysis.SKILL.mdname: bio-copy-number-cnvkit-analysis
description: Detect copy number variants from targeted/exome sequencing using CNVkit. Supports tumor-normal pairs, tumor-only, and germline CNV calling. Use when detecting CNVs from WES or targeted panel sequencing data.
tool_type: cli
primary_tool: cnvkit
Version Compatibility
Reference examples tested with: GATK 4.5+, bedtools 2.31+
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.
CNVkit CNV Analysis
**"Detect copy number variants from my exome data"** → Run a read-depth-based pipeline that normalizes on/off-target coverage against a reference, segments the log2 ratio profile, and calls gains/losses.
- CLI: `cnvkit.py batch tumor.bam --normal normal.bam`
Basic Workflow
**Goal:** Run the complete CNVkit pipeline on a tumor-normal pair to detect copy number variants.
**Approach:** Execute the batch command which wraps target/antitarget generation, coverage calculation, reference building, and segmentation into one step.
# Complete pipeline for tumor-normal pair
cnvkit.py batch tumor.bam \
--normal normal.bam \
--targets targets.bed \
--fasta reference.fa \
--output-reference my_reference.cnn \
--output-dir results/Build Reference from Normal Samples
**Goal:** Create a robust reference from pooled normal samples, then run tumor samples against it.
**Approach:** Build a panel-of-normals reference first, then batch-process tumors using the pre-built reference.
# Step 1: Build reference from multiple normals (recommended)
cnvkit.py batch \
--normal normal1.bam normal2.bam normal3.bam \
--targets targets.bed \
--fasta reference.fa \
--output-reference pooled_reference.cnn
# Step 2: Run on tumor samples using pre-built reference
cnvkit.py batch tumor1.bam tumor2.bam \
--reference pooled_reference.cnn \
--output-dir results/Flat Reference (No Matched Normal)
**Goal:** Call CNVs when no matched normal sample is available.
**Approach:** Generate a flat reference from target regions and the reference genome, assuming diploid baseline.
# When no matched normal is available
cnvkit.py batch tumor.bam \
--targets targets.bed \
--fasta reference.fa \
--output-reference flat_reference.cnn \
--output-dir results/WGS Mode
**Goal:** Detect CNVs from whole genome sequencing data without a targets file.
**Approach:** Run CNVkit batch with `--method wgs` to use genome-wide binning instead of target/antitarget regions.
# For whole genome sequencing (no targets file)
cnvkit.py batch tumor.bam \
--normal normal.bam \
--fasta reference.fa \
--method wgs \
--output-dir results/bedGraph Input (Privacy-Preserving)
**Goal:** Run CNVkit from bedGraph coverage files instead of BAM files for privacy-sensitive data sharing.
**Approach:** Pre-compute coverage from BAM, then feed compressed bedGraph to the coverage step.
# Generate bedGraph: bedtools genomecov -ibam sample.bam -bg | bgzip > sample.bed.gz && tabix -p bed sample.bed.gz
cnvkit.py coverage sample.bed.gz targets.target.bed -o sample.targetcoverage.cnn
Step-by-Step Pipeline
**Goal:** Execute CNVkit as individual steps for fine-grained control over each stage.
**Approach:** Run target/antitarget generation, coverage, reference building, fix, segment, and call sequentially.
# 1. Generate target and antitarget regions
cnvkit.py target targets.bed --annotate refFlat.txt -o targets.target.bed
cnvkit.py antitarget targets.bed -o targets.antitarget.bed
# 2. Calculate coverage
cnvkit.py coverage tumor.bam targets.target.bed -o tumor.targetcoverage.cnn
cnvkit.py coverage tumor.bam targets.antitarget.bed -o tumor.antitargetcoverage.cnn
cnvkit.py coverage normal.bam targets.target.bed -o normal.targetcoverage.cnn
cnvkit.py coverage normal.bam targets.antitarget.bed -o normal.antitargetcoverage.cnn
# 3. Build reference
cnvkit.py reference normal.targetcoverage.cnn normal.antitargetcoverage.cnn \
--fasta reference.fa -o reference.cnn
# 4. Fix and call
cnvkit.py fix tumor.targetcoverage.cnn tumor.antitargetcoverage.cnn reference.cnn -o tumor.cnr
cnvkit.py segment tumor.cnr -o tumor.cns
cnvkit.py call tumor.cns -o tumor.call.cnsSegmentation Options
**Goal:** Choose the optimal segmentation algorithm for the sample type.
**Approach:** Select from CBS, HMM, or HMM variants tuned for tumor heterogeneity or germline tightness.
# Default CBS (Circular Binary Segmentation)
cnvkit.py segment sample.cnr -o sample.cns
# Use HMM for better performance
cnvkit.py segment sample.cnr --method hmm -o sample.cns
# HMM for tumor samples (broader state transitions for heterogeneity)
cnvkit.py segment sample.cnr --method hmm-tumor -o sample.cns
# HMM for germline (tighter priors around diploid)
cnvkit.py segment sample.cnr --method hmm-germline -o sample.cns
# Adjust smoothing
cnvkit.py segment sample.cnr --smooth-cbs -o sample.cns
CNV Calling with Ploidy/Purity
**Goal:** Convert segmented log2 ratios into integer copy number states accounting for tumor composition.
**Approach:** Supply tumor purity and ploidy estimates (and optionally B-allele frequencies from a VCF) to the call step.
# Specify tumor purity and ploidy
cnvkit.py call sample.cns \
--purity 0.7 \
--ploidy 2 \
-o sample.call.cns
# With B-allele frequencies (from VCF)
cnvkit.py call sample.cns \
--vcf sample.vcf \
--purity 0.7 \
-o sample.call.cnsExport Results
**Goal:** Convert CNVkit output to standard formats for downstream tools or databases.
**Approach:** Export called se
Read more
name: bio-copy-number-cnvkit-analysis description: Detect copy number variants from targeted/exome sequencing using CNVkit. Supports tumor-normal pairs, tumor-only, and germline CNV calling. Use when detecting CNVs from WES or targeted panel sequencing data. tool_type: cli primary_tool: cnvkit
Version Compatibility
Reference examples tested with: GATK 4.5+, bedtools 2.31+
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.
CNVkit CNV Analysis
**"Detect copy number variants from my exome data"** → Run a read-depth-based pipeline that normalizes on/off-target coverage against a reference, segments the log2 ratio profile, and calls gains/losses.
- CLI: `cnvkit.py batch tumor.bam --normal normal.bam`
Basic Workflow
**Goal:** Run the complete CNVkit pipeline on a tumor-normal pair to detect copy number variants.
**Approach:** Execute the batch command which wraps target/antitarget generation, coverage calculation, reference building, and segmentation into one step.
# Complete pipeline for tumor-normal pair
cnvkit.py batch tumor.bam \
--normal normal.bam \
--targets targets.bed \
--fasta reference.fa \
--output-reference my_reference.cnn \
--output-dir results/Build Reference from Normal Samples
**Goal:** Create a robust reference from pooled normal samples, then run tumor samples against it.
**Approach:** Build a panel-of-normals reference first, then batch-process tumors using the pre-built reference.
# Step 1: Build reference from multiple normals (recommended)
cnvkit.py batch \
--normal normal1.bam normal2.bam normal3.bam \
--targets targets.bed \
--fasta reference.fa \
--output-reference pooled_reference.cnn
# Step 2: Run on tumor samples using pre-built reference
cnvkit.py batch tumor1.bam tumor2.bam \
--reference pooled_reference.cnn \
--output-dir results/Flat Reference (No Matched Normal)
**Goal:** Call CNVs when no matched normal sample is available.
**Approach:** Generate a flat reference from target regions and the reference genome, assuming diploid baseline.
# When no matched normal is available
cnvkit.py batch tumor.bam \
--targets targets.bed \
--fasta reference.fa \
--output-reference flat_reference.cnn \
--output-dir results/WGS Mode
**Goal:** Detect CNVs from whole genome sequencing data without a targets file.
**Approach:** Run CNVkit batch with `--method wgs` to use genome-wide binning instead of target/antitarget regions.
# For whole genome sequencing (no targets file)
cnvkit.py batch tumor.bam \
--normal normal.bam \
--fasta reference.fa \
--method wgs \
--output-dir results/bedGraph Input (Privacy-Preserving)
**Goal:** Run CNVkit from bedGraph coverage files instead of BAM files for privacy-sensitive data sharing.
**Approach:** Pre-compute coverage from BAM, then feed compressed bedGraph to the coverage step.
# Generate bedGraph: bedtools genomecov -ibam sample.bam -bg | bgzip > sample.bed.gz && tabix -p bed sample.bed.gz cnvkit.py coverage sample.bed.gz targets.target.bed -o sample.targetcoverage.cnn
Step-by-Step Pipeline
**Goal:** Execute CNVkit as individual steps for fine-grained control over each stage.
**Approach:** Run target/antitarget generation, coverage, reference building, fix, segment, and call sequentially.
# 1. Generate target and antitarget regions
cnvkit.py target targets.bed --annotate refFlat.txt -o targets.target.bed
cnvkit.py antitarget targets.bed -o targets.antitarget.bed
# 2. Calculate coverage
cnvkit.py coverage tumor.bam targets.target.bed -o tumor.targetcoverage.cnn
cnvkit.py coverage tumor.bam targets.antitarget.bed -o tumor.antitargetcoverage.cnn
cnvkit.py coverage normal.bam targets.target.bed -o normal.targetcoverage.cnn
cnvkit.py coverage normal.bam targets.antitarget.bed -o normal.antitargetcoverage.cnn
# 3. Build reference
cnvkit.py reference normal.targetcoverage.cnn normal.antitargetcoverage.cnn \
--fasta reference.fa -o reference.cnn
# 4. Fix and call
cnvkit.py fix tumor.targetcoverage.cnn tumor.antitargetcoverage.cnn reference.cnn -o tumor.cnr
cnvkit.py segment tumor.cnr -o tumor.cns
cnvkit.py call tumor.cns -o tumor.call.cnsSegmentation Options
**Goal:** Choose the optimal segmentation algorithm for the sample type.
**Approach:** Select from CBS, HMM, or HMM variants tuned for tumor heterogeneity or germline tightness.
# Default CBS (Circular Binary Segmentation) cnvkit.py segment sample.cnr -o sample.cns # Use HMM for better performance cnvkit.py segment sample.cnr --method hmm -o sample.cns # HMM for tumor samples (broader state transitions for heterogeneity) cnvkit.py segment sample.cnr --method hmm-tumor -o sample.cns # HMM for germline (tighter priors around diploid) cnvkit.py segment sample.cnr --method hmm-germline -o sample.cns # Adjust smoothing cnvkit.py segment sample.cnr --smooth-cbs -o sample.cns
CNV Calling with Ploidy/Purity
**Goal:** Convert segmented log2 ratios into integer copy number states accounting for tumor composition.
**Approach:** Supply tumor purity and ploidy estimates (and optionally B-allele frequencies from a VCF) to the call step.
# Specify tumor purity and ploidy
cnvkit.py call sample.cns \
--purity 0.7 \
--ploidy 2 \
-o sample.call.cns
# With B-allele frequencies (from VCF)
cnvkit.py call sample.cns \
--vcf sample.vcf \
--purity 0.7 \
-o sample.call.cnsExport Results
**Goal:** Convert CNVkit output to standard formats for downstream tools or databases.
**Approach:** Export called se
Other skills on openclaw-medical-skills.
adaptyv
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental…
adhd-daily-planner
Time-blind friendly planning, executive function support, and daily structure for ADHD brains. Specializes in realistic time…
aeon
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting,…
agent-browser
Browse the web for any task — research topics, read articles, interact with web apps, fill forms, take screenshots, extract data,…
More skills from other plugins.
paddleocr-doc-parsing
Use this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as…
13c-metabolic-flux
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps,…
Questions about bio-copy-number-cnvkit-analysis.
- Which coding agents can use bio-copy-number-cnvkit-analysis?
- bio-copy-number-cnvkit-analysis installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

