Skip to content
CleanCham-labPublic

About

SMN1/SMN2 copy number and haplotypes from PacBio HiFi WGS — SMA and carrier calls on T2T-CHM13

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

SMA-LRS

SMN1/SMN2 copy number and haplotypes from PacBio HiFi WGS, with SMA and SMA-carrier calls on T2T-CHM13 (hg38 as cross-check).

한국어 README · Example report (synthetic data) (download and open in a browser) · Changelog

Overview page of the SMA-LRS report

Research use only. Carrier and SMA calls must be confirmed with an orthogonal test (MLPA, ddPCR or similar).

SMN1/SMN2 phasing and copy numbers come from Paraphase (PacBio). SMA-LRS handles what comes before and after it:

  • ALT-contig rescue. In BAMs aligned to hg38 with ALT contigs, 50–80 % of SMN reads sit on the two chr5 ALT contigs that carry the SMA region (GL339449v2, KI270897v1), so Paraphase run on them sees few or no SMN1 reads. SMA-LRS collects the SMN-window and ALT reads and realigns them to the whole no-ALT hg38 and T2T-CHM13.
  • T2T-CHM13 calls. With --chm13, copy numbers, haplotype PSV maps and markers come from CHM13 (CHM13 coordinates); hg38 is the cross-check. Disagreement → no call. Neighbour genes (SERF1A, GTF2H2, OCLN) come from hg38, where Paraphase supports them.
  • Second copy estimate at c.840. C (SMN1) and T (SMN2) reads at c.840 are counted in the realigned BAMs and calibrated on the cohort (negative-binomial). They settle SMN1 when Paraphase sees a single haplotype and cannot choose 1 vs 2 copies, and a confident disagreement with a carrier/SMA call turns it into a no call.
  • Support level and confirmation list. Every carrier/SMA call is "well supported" or "confirm"; no-calls where a carrier genotype remains possible are marked. The report opens with the list of samples for confirmation testing.
  • Haplotype PSV map. Each copy is typed SMN1/SMN2 at 41 paralogous sites (derived at run time from the installed Paraphase population haplotypes) to show hybrid copies and SMN1→SMN2 conversion traces.
  • Markers. 2+0 (silent carrier) markers c.*3+80T>G and c.*211_*212del on SMN1; SMN2 modifiers c.859G>C and c.835-44 G; SMN2Δ7–8.
  • Cohort checks. Samples with identical SMN haplotype variant sets are flagged as the same person and counted once; total SMN vs total SERF1 copies (same duplicated block) is checked per sample.
  • Bilingual HTML report (KR/EN), TSV and JSON. The report carries no BAM paths or original sample names.

Pipeline

Step What it does
recruit Primary reads from the SMN window (hg38 chr5:69.2–71.8 Mb) and the two SMA-region chr5 ALT contigs → FASTQ, keeping MM/ML/rq tags. Genome depth is measured on the input BAM at Paraphase's own sites. --all-chr5-alts reads every chr5 ALT.
realign minimap2 (map-hifi) against the whole no-ALT hg38 and, with --chm13, the whole CHM13. Only reads that land in the SMN window are kept (paralog look-alikes go home), split into per-sample BAMs. The index is loaded once per batch.
paraphase hg38: smn1,SERF1A,GTF2H2,OCLN; CHM13: smn1. Genome depth is passed with -d.
report Calls, support levels, PSV maps, markers, cohort statistics → HTML, TSV, JSON.

Input BAMs can be aligned to hg38 (with or without ALT contigs) or CHM13. A finished hg38 run can be extended with --chm13 later: reads already placed in the SMN window are realigned to CHM13 without reading the input BAMs again. Every step resumes where it stopped.

Install

Python ≥ 3.8, samtools, minimap2 (≥ 2.19 for the map-hifi preset). Paraphase, pysam and openpyxl are installed with the package.

conda create -n smalrs python=3.10 -y
conda activate smalrs
python -m pip install sma_lrs-1.0.1-py3-none-any.whl     # or, from the source folder: python -m pip install .
sma-lrs --version

References: hg38 without ALT contigs (e.g. GRCh38_no_alt_analysis_set) and T2T-CHM13v2.0, each with .fai. SMA-LRS refuses a FASTA with ALT contigs. A HiFi minimap2 index makes realignment about twice as fast (SMA-LRS warns if the .mmi is not k=19/w=19):

minimap2 -x map-hifi -t 8 -d chm13v2.0.hifi.mmi chm13v2.0.fa

Quick start

# 1) manifest draft from a folder with one sub-folder per project (HiPhase_QC/*.bam or *.pbmm2.bam / *.aligned.bam)
sma-lrs cohort --root /data/Revio/WGS --out manifest.tsv --exclude "old_runs,assembly"

# 2) pilot: first sample of each project
sma-lrs run --manifest manifest.tsv --out pilot --first 1 --hg38 GRCh38_no_alt.fa --threads 8

# 3) full run on CHM13 + hg38 (rerun the same command to resume)
nohup sma-lrs run --manifest manifest.tsv --out run1 \
  --hg38 GRCh38_no_alt.fa --chm13 chm13v2.0.fa --chm13-index chm13v2.0.hifi.mmi \
  --threads 8 --jobs 4 > run1.log 2>&1 &

# 4) rebuild the report (e.g. in English) without realigning
sma-lrs report --out run1 --lang en

# 5) optional: compare with Paraphase JSONs made earlier on the same samples
sma-lrs compare --out run1 --paraphase-dir /path/to/old_paraphase

cohort names samples <PROJECT>_<NNN> and writes the original names and paths only to private/id_map.tsv (keep it local). The same specimen (@RG SM) found in a second project is listed once. To add new samples later, rerun cohort with the same --out: earlier IDs are kept (read from private/id_map.tsv) and new BAMs get the next numbers; then rerun run with the same --out and only the new samples are processed. run refuses a manifest that maps an existing sample_id to a different BAM.

A manifest can be TSV, CSV or XLSX. Required columns: sample_id, bam. Optional: group, sex, smn1_known, smn2_known (e.g. MLPA results, shown next to the calls), note.

Use samtools/minimap2/paraphase from another environment with --samtools, --minimap2, --paraphase.

Console

sma-lrs -h and sma-lrs <command> -h explain every command and option with examples. A run prints a plan (including what is already on disk), each step with progress and ETA, and a result summary that lists the samples for confirmation testing. Help and console text are in English, or in Korean with SMA_LRS_LANG=ko (or a Korean locale). Colours are used in terminals only, so nohup … > run1.log stays plain; SMA_LRS_COLOR=always|never or NO_COLOR override.

Console output of a run on synthetic data

Calls

Call Rule
SMA genotype 0 functional SMN1 (c.840C) copies
Carrier 1 SMN1 copy (1+0)
Possible 2+0 carrier 2 SMN1 copies and c.*3+80T>G or c.*211_*212del on an SMN1 haplotype
No carrier evidence ≥ 2 SMN1 copies, no 2+0 marker (a 2+0 genotype without markers cannot be excluded)
No call genome depth < 12×; CHM13 and hg38 disagree; Paraphase and the c.840 read count put SMN1 in different categories (0 / 1 / 2+); SMN1 copy number undecided; ≤ 1 copy on one reference only and not confirmed by read count

Support (carrier / SMA calls): well supported — Paraphase on CHM13 and hg38 and the c.840 read count agree (category posterior ≥ 0.95); confirm — the two Paraphase results agree, the read count does not settle it. Possible carrier marks no-calls (depth ≥ 12×) where SMN1 ≤ 1 on either reference, or the read count gives P(1 copy) ≥ 0.5 or P(0 copies) ≥ 0.5.

Hybrid copies are called only from the 9 exon 7-area PSVs that are almost never seen on the other gene (≥ 90 % of SMN2 and ≤ 5 % of SMN1 population haplotypes), so common SMN1 haplotypes are not mistaken for hybrids.

Flags

Flag Meaning
low_depth genome depth < 12×
discordant SMN1 copy number differs between CHM13 and hg38
smn1_undecided Paraphase left SMN1 open and the read count did not settle it
smn1_from_dosage, smn2_from_dosage copy number taken from the c.840 read count
dosage_disagrees the read count confidently puts SMN1 in another category than Paraphase
dosage_differs the read count prefers another copy number in the same category
one_reference_only ≤ 1 SMN1 copy on one reference only
possible_carrier no call, carrier genotype still possible — candidate for confirmation testing
hybrid a copy mixing SMN1- and SMN2-type exon 7-area PSVs
smn2_down_smn1 SMN2 copy with SMN1-type downstream PSVs (conversion-marker pattern)
smn2_modifier c.859G>C or c.835-44 G on SMN2
del78 SMN2Δ7–8 copy present
smn_serf1_diff total SMN ≠ total SERF1 copies
smn1_two_copy_hap Paraphase reports one SMN1 haplotype present in two copies

Outputs

File Content
report.html KR/EN report: overview with confirmation list, summary table, per-sample page (copy numbers, PSV map, markers, interpretation), cohort statistics, run information, method
sma_lrs.tsv one row per sample: call, support, confirm_test, SMN1/SMN2/Δ7–8 (calling reference, hg38, CHM13), agreement, neighbour genes, markers, flags, depth, c.840 counts and estimates, duplicates, known values, interpretation (KR/EN)
haplotypes.tsv one row per haplotype: reference, gene, haplogroup, PSV string, exon 7 area / downstream type, markers
sma_lrs.json everything above
bam/hg38/, bam/chm13/ realigned SMN-window BAMs
paraphase/hg38/, paraphase/chm13/ Paraphase output (*.paraphase.bam can be viewed in IGV grouped by HP)
logs/ per-step logs

Runtime

On a 6–8-thread workstation reading BAMs from a network share, per sample: recruit ≈ 45 s (divided by --jobs), hg38 realignment ≈ 40–50 s, CHM13 realignment ≈ 80 s with a HiFi index, Paraphase ≈ 30 s. Adding CHM13 to a finished 337-sample hg38 run took about 7 h.

Limitations

  • HiFi reads do not span the ~2 Mb SMN region, so a 2+0 allele cannot be seen directly; markers only raise suspicion. Family data or a dedicated assay is needed.
  • Paraphase uses reads with rq ≥ 0.99; fail reads are not used.
  • The 5′ half of SMN1 and SMN2 is practically identical, so conversion breakpoints there are invisible.
  • Deletion vs conversion is only inferred from copy numbers of SMN and neighbour genes against the cohort mode.
  • The c.840 calibration needs ≥ 10 samples with Paraphase calls; smaller runs use default values.

Tests

python tests/test_synthetic.py /tmp/sma_lrs_test    # needs samtools, minimap2, Paraphase; ~5 min

Five synthetic samples (2+2, 1+2, 0+3 conversion-like, 2+0 marker, low depth) with most SMN reads on ALT contigs and paralog decoys run through every step: calls, markers, ALT handling, resume, report, compare, manifest formats, cohort scan and stable IDs, c.840 estimates, support levels and duplicate detection (67 checks).

Citation · license

© 2026 Seung Won Chae · MIT License (see LICENSE). Seoul National University Cancer Research Institute · Molecular Diagnostics Laboratory, Department of Laboratory Medicine, Seoul National University Hospital.

  • Paraphase: Chen X et al. Am J Hum Genet 2023;110:240–250 · Chen X et al. Nat Commun 2025;16:2340. Paraphase is distributed under the PacBio Software License Agreement, which limits its use to data generated on a PacBio instrument. SMA-LRS does not include Paraphase; it calls the installed one (see NOTICE).
  • Background: Gommers D et al. Trends Genet 2026;42:846–860 · Zwartkruis MM et al. Genome Med 2025;17:26.

Cite: Chae SW. SMA-LRS: SMN1/SMN2 copy number and haplotypes from PacBio HiFi WGS for SMA and SMA-carrier calls. https://github.com/CleanCham-lab/SMA-LRS (see CITATION.cff).

About

SMN1/SMN2 copy number and haplotypes from PacBio HiFi WGS — SMA and carrier calls on T2T-CHM13

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages