SKILL.md
Version Compatibility
Reference examples tested with: CNVkit 0.9+, ichorCNA 0.5+, pandas 2.2+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures - R:
packageVersion('<pkg>')then?function_nameto verify parameters
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Tumor Fraction Estimation
"Estimate tumor fraction from my cfDNA data" → Calculate the proportion of tumor-derived DNA in a liquid biopsy sample using copy number aberrations from shallow whole-genome sequencing.
- R:
ichorCNAfor tumor fraction and CNA estimation from sWGS
Estimate ctDNA tumor fraction from shallow whole-genome sequencing.
ichorCNA Overview
ichorCNA (GavinHaLab fork, v0.5.1+) detects copy number alterations and estimates tumor fraction from sWGS (0.1-1x coverage).
Sensitivity: 97-100% detection at >= 3% tumor fraction (2024 validation)
Input Requirements
| Requirement | Specification |
|---|---|
| Data type | sWGS (NOT targeted panel) |
| Coverage | 0.1-1x (0.5x recommended) |
| Input | BAM files |
| Output | Tumor fraction, ploidy, CNA segments |
Running ichorCNA
library(ichorCNA)
# Step 1: Generate read counts in bins
# Run from command line or use HMMcopy
# readCounter --window 1000000 --quality 20 sample.bam > sample.wig
# Step 2: Run ichorCNA
runIchorCNA(
WIG = 'sample.wig',
gcWig = 'gc_hg38_1mb.wig',
mapWig = 'mappability_hg38_1mb.wig',
normalPanel = 'pon_median_1mb.rds',
centromere = 'centromeres_hg38.txt',
outDir = 'ichor_results/',
id = 'sample_id',
# Tumor fraction estimation parameters
normal = c(0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99),
ploidy = c(2, 3),
maxCN = 5,
# Subclonality
estimateScPrevalence = TRUE,
scStates = c(1, 3),
# Segmentation
txnE = 0.9999,
txnStrength = 10000,
# Chromosomes
chrs = paste0('chr', c(1:22, 'X'))
)
