Plot haplotype-specific barcode coverage around structural variants (deletions or inversions) from linked-read BAM/CRAM data.
- Computes unique barcode counts per window for HP1 and HP2.
- Supports deletion spanning-barcode mode and inversion breakpoint-linking mode.
- Accepts one or two samples for comparison.
- Optionally draws a gene annotation track from GFF3 (
.gff3,.gz, or.tar.gz).
- Python 3
pysam,numpy,pandas,matplotlib
python haploplot.py -p chr1:100000-200000 -s1 sample1.bam -r chr1:110000-190000 -t delTwo-sample inversion example:
python haploplot.py -p chr1:100000-200000 -s1 sample1.bam -s2 sample2.bam -r chr1:120000-180000 -t inv -f 500For CRAM input, provide a reference:
python haploplot.py -p chr1:100000-200000 -s1 sample1.cram -r chr1:110000-190000 -t del -ref ref.fa-p chr:start-end: plot region (required)-s1,-s2: sample BAM/CRAM files (at least one required)-r chr:start-end: SV region/breakpoints (optional; enables SV barcode selection)-t del|inv: SV mode (deldefault)-w: window size (default2000)-f: flank size for SV barcode detection (default20000)-n T|F: normalize per haplotype-gff3: optional gene annotation file-ref: optional reference FASTA for CRAM-o: output image name (defaultbarcode_hp1_hp2_plot.png)