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
Install / Use
npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysisInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Customer SupportSupported Platforms
Our assessment of bio-copy-number-cnvkit-analysis
bio-copy-number-cnvkit-analysis scores 89/100 on our quality scale, 164th of 319 Customer Support skills we index.
Its SKILL.md is 9.3 KB long, well organised into 55 sections with 12 code examples: a thorough specification that gives an agent plenty to work with.
With 3,034 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- Our last check on 2026-10-31 found the source still online.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 86/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-29. Automated pattern scan on 2026-09-29. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
bio-copy-number-cnvkit-analysis compared with similar skills
All 4 of these similar skills score higher than bio-copy-number-cnvkit-analysis; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| bio-copy-number-cnvkit-analysis (this skill)by FreedomIntelligence | 89 | 3.0k | 4mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 103.6k | 2d ago | MCP Server |
| crawl4aiby unclecode | 100 | 87.4k | 3d ago | MCP Server |
Frequently asked questions
- How do I install bio-copy-number-cnvkit-analysis?
- Run
npx skills add FreedomIntelligence/OpenClaw-Medical-Skills --skill bio-copy-number-cnvkit-analysis. The install tabs above show the steps for each supported agent. - Which AI agents does bio-copy-number-cnvkit-analysis work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is bio-copy-number-cnvkit-analysis safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 86/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is bio-copy-number-cnvkit-analysis still maintained?
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHubname: 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>thenhelp(module.function)to check signatures - CLI:
<tool> --versionthen<tool> --helpto 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.cns
Segmentation 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.cns
Export Results
Goal: Convert CNVkit output to standard formats for downstream tools or databases.
Approach: Export called segments to BED, VCF, SEG (for GISTIC2), or Nexus format.
# Export to BED format
cnvkit.py export bed sample.call.cns -o sample.cnv.bed
# Export to VCF
cnvkit.py export vcf sample.call.cns -o sample.cnv.vcf
# Export segments for GISTIC2
cnvkit.py export seg *.cns -o samples.seg
# Markers file for GISTIC2 (pairs with 'export seg' above: segments + markers)
cnvkit.py export gistic *.cnr -o samples.markers
# Export for Nexus
cnvkit.py export nexus-basic sample.cnr -o sample.nexus.txt
Visualization
Goal: Generate CNV profile plots for visual inspection and publication.
Approach: Use CNVkit built-in commands for scatter, diagram, and heatmap views.
# Scatter plot with segments
cnvkit.py scatter sample.cnr -s sample.cns -o sample_scatter.png
# Single chromosome
cnvkit.py scatter sample.cnr -s sample.cns -c chr17 -o sample_chr17.png
# Diagram (ideogram style)
cnvkit.py diagram sample.cnr -s sample.cns -o sample_diagram.pdf
# Heatmap across samples
cnvkit.py heatmap *.cns -o heatmap.pdf
Key Output Files
| Extension | Description | |-----------|-------------| | .cnn | Reference or coverage file | | .cnr | Copy ratios (log2) per bin | | .cns | Segmented copy ratios | | .call.cns | Called copy number states |
Python API
Goal: Programmatically load and filter CNVkit results for custom downstream analysis.
Approach: Use cnvlib to read .cnr/.cns files as DataFrames, filter by chromosome or log2 ratio, and export.
import cnvlib
# Load data
cnr = cnvlib.read('sample.cnr')
cns = cnvlib.read('sample.cns')
# Filter by chromosome
chr17 = cnr[cnr.chromosome == 'chr17']
# log2 > 0.5 (~3+ copies): moderate amplification filter
amps = cns[cns['log2'] > 0.5]
# log2 < -0.5 (~1 copy): moderate deletion filter
dels = cns[cns['log2'] < -0.5]
# Export
cnr.to_csv('sample.cnr.tsv', sep='\t', index=False)
Quality Control
Goal: Assess CNVkit run quality, check for sex mismatches, and compute per-segment confidence intervals.
Approach: Run metrics, sex, segmetrics, and genemetrics commands on output files.
# Check reference quality
cnvkit.py metrics *.cnr -s *.cns
# Check for gender mismatches
cnvkit.py sex *.cnr *.cnn
# Median absolute deviation (lower is better)
# Biweight midvariance (sample heterogeneity)
# Per-segment confidence intervals
cnvkit.py segmetrics sample.cnr -s sample.cns --ci --pi -o sample.segmetrics.cns
# Gene-level CNV detection with confidence intervals
# 10 bootstrap iterations (default 100); reduce for speed, increase for publication CIs
cnvkit.py genemetrics sample.cnr -s sample.cns --threshold 0.2 --ci --bootstrap 10 -o sample.genemetrics.tsv
Key Parameters
| Parameter | Default | Description | |-----------|---------|-------------| | --method | hybrid | hybrid, wgs, amplicon | | --segment-method | cbs | cbs, hmm, hmm-tumor, hmm-germline, haar, flasso, none | | --drop-low-coverage | off | Drop low-coverage bins | | --purity | 1.0 | Tumor purity (0-1) | | --ploidy | 2 | Sample ploidy | | --center | none | Log2 centering for call: mean, median, mode, biweight | | --thresholds | -1.1,-0.25,0.2,0.7 | CN state thresholds |
Related Skills
- alignment-files/bam-statistics - QC of input BAMs
- copy-number/cnv-visualization - Advanced plotting
- copy-number/cnv-annotation - Gene-level annotation
- copy-number/gatk-cnv - GATK alternative CNV caller
- long-read-sequencing/structural-variants - Complementary SV calling
Related Skills
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
103.6k🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
crawl4ai
87.4kOfficial Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
