From BAM to copy-number profile in one command.
Install
A single self-contained binary for x86_64 Linux (glibc ≥ 2.31). On other systems, build from source.
curl -fsSL https://raw.githubusercontent.com/EBD-Sweden/CNATrace/main/install.sh | sh cnatrace --version # cnatrace 0.9.3
Or build from source:
git clone https://github.com/EBD-Sweden/CNATrace cd CNATrace cargo build --release # binary: target/release/cnatrace
Quickstart
cnatrace run \ --bam sample.bam \ --fasta hg38.fa \ --sample-id MySample \ --assay ChIP \ --reference hg38 \ --bin-size 50000 \ --min-mapq 30 \ --min-bin-depth-fraction 0.2 \ --output-dir results/MySample
Then render the interactive report:
cnatrace report --profile results/MySample/MySample.cn_profile.tsv
Outputs, one shared stem per sample:
results/MySample/ MySample.cn_profile.tsv segments: chrom start end log2_ratio cn_state MySample.cn_bins.tsv per-bin GC-corrected log2 ratios MySample.run_manifest.tsv MySample.run_summary.json version, literal command line, chromosome lengths, stats MySample.report.html
Input formats
| Flag | Accepts |
|---|---|
--bam | Coordinate-sorted BAM with index: WGS, ATAC-seq, ChIP-seq, RADICL-seq DNA tags, GPSeq. |
--cool | Hi-C .cool or multi-resolution .mcool. |
--hic | Juicer .hic. |
--fasta | Reference FASTA (with .fai), required for GC correction. Must be the build the BAM was aligned to; the run records the chromosome lengths it saw. |
CLI reference
cnatrace run executes all four steps; count, correct, segment and call run them individually; summarize-runs aggregates a results tree; report renders HTML.
| Flag | Default | Meaning |
|---|---|---|
--bin-size | 50000 | Bin width in bp. This site uses 50000. |
--min-mapq | 0 | Drop reads below this mapping quality. This site uses 30. |
--assay | — | Metadata label that also selects the GC method: loess for WGS/ATAC/HiC/ChIP/RADICL/GPSeq, modal for CUTTAG, none for CUTRUN/RNAseq. |
--gc-method | auto | none | loess | modal | quantile | markov. Pin it explicitly for a tranche. |
--gc-bias-threshold | 0.3 | WGS only: skip correction when GC–log(count) r² is below this. |
--t-threshold | 3.0 | CBS t-statistic to split a segment. |
--min-bins | 5 | Minimum bins per segment. |
--segmenter | cbs | cbs | hmm. |
--peaks | — | BED of enrichment peaks to exclude from the GC fit (IP assays). Off by default; unmeasured for ChIP. |
--blacklist | — | BED of regions to leave out of GC correction, normalisation and segmentation; they are drawn blank. This site uses the control-depleted mask (masks/hg38.control_depleted.v3.bed in the repository). |
--min-bin-depth-fraction | 0.0 | Zero bins below this fraction of the genome-wide median depth (centromeric and satellite noise). This site uses 0.2. |
--no-output-bins | — | Skip the per-bin file (on by default since 0.7.1). |
--reference | — | Label only (hg38, mm10). The genome identity comes from the recorded chromosome lengths. |
The HTML report
cnatrace report --profile X.cn_profile.tsv reads the profile, the bins and the summary sitting beside it and writes one offline HTML file: interactive Plotly genome-wide scatter (grey bins, coloured CBS segments), CN-distribution bar, run metadata and the exact command. --plotlyjs directory shares one plotly.min.js across a cohort (34 kB per report instead of ~4.7 MB). Needs only python3 ≥ 3.9 on PATH; Plotly ships inside the binary.
Three files must sit together or the report is silently poorer: missing bins ⇒ segments only (it says so); missing summary ⇒ it stops rather than guess the genome.
Per-assay caveats
- CUT&RUN / CUT&Tag / CAGE are excluded: their signal-to-noise is too high for read density to track copy number reliably. ChIP-seq’s lower signal-to-noise gives better CN accuracy than those assays.
- GPSeq: use ≥ 20 min timepoints.
- ChIP-seq: input / IgG controls are cleanest. For antibody-enriched samples
--peaksexists but has not been benchmarked; measure before relying on it. - Genome build: a name does not determine lengths (hg19 vs hg38 differ by up to 2.8 Mb on chr9). The run records the actual chromosome lengths; the report checks a declared
--genomeagainst them.
Use from an AI assistant
The database has a Model Context Protocol ↗ server, so an assistant such as Claude or ChatGPT can look up cell lines, samples and regions for you, and write correct cnatrace commands for your own data. It is read-only and needs no account.
https://cnatrace.ebdsweden.com/mcp
In Claude Code:
claude mcp add --transport http cnatrace https://cnatrace.ebdsweden.com/mcp
In Claude or ChatGPT, add it as a custom connector with the address above. Then ask, for example, “how many HEK293 stocks does CNATrace find?” or “is 9p lost in all HeLa samples?”. A plain-text description of the site for language models is at /llms.txt.
FAQ
Do I need a matched normal? No. The genome-wide median is the reference; whole-genome ploidy shifts are not resolved, relative gains and losses are.
Why are ENCODE samples processed from unfiltered alignments? So that the MAPQ filter is ours and identical across all sources; ENCODE’s own filtering has varied across pipeline versions. The file accession we used is recorded on every result page.
Why are there mouse samples under the source “CaseStudy”? They are the paper’s own Oli-neu, mESC and primary OPC libraries (Supplementary Table 1), processed on mm10 with the same parameter set as the public human samples so the case study can show them beside the database; a single-resolution Hi-C .cool is read at its native bin size. Their mask is the ENCODE mm10 blacklist: the human mask is derived from diploid control profiles, and no such panel exists for mouse yet. The home page, the cell-line index and the trees describe the human atlas; these samples are reached from the case study, from explore (organism facet) and from their own pages.
Is x86_64 output identical to aarch64? Byte-identical cn_profile.tsv and reports; per-bin values can differ in the last unit-in-last-place when LOESS runs.
What is the licence? The source is open under the PolyForm Noncommercial License 1.0.0 ↗: free for any non-commercial use, including academic and public research. Commercial use needs a licence from EBD Sweden.
Where do I report an issue? GitHub issues ↗.