plot-roh-py
Python plotting script for ROH visualization. It scans a directory of *.txt.gz files, reads both GT and RG records, and renders per-sample ROH tracks to plot.png or a user-specified output file.
Quick Start
- Command:
plot-roh.py <dir> - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/plot-roh.py - Default output:
plot.png
When To Use This Tool
- Visualizing ROH calls that have already been converted into the
GT/RGtext format expected by the script - Rendering static PNG ROH track plots without writing custom matplotlib code
- Filtering ROH calls by minimum length, marker count, quality, or genomic region
- Comparing grouped samples with
--highlight +group1,-group2
Common Patterns
# Basic non-interactive plot
plot-roh.py roh_dir -o roh.png
# Restrict plotted calls by region and quality/length filters
plot-roh.py roh_dir -r chr1:1-5000000 -l 100000 -n 20 -q 30 -o chr1.png
# Use a sample/group file and highlight calls enriched in one group
plot-roh.py roh_dir -s samples.tsv -H +cases,-controls -o grouped.png
Recommended Workflow
- Feed the script a directory containing gzipped text files with both
GTgenotype rows andRGregion rows. - Use
-ofor batch output or-ifor interactive plotting, but not both. - Add
-swhen you need renaming or grouping, then layer-Hon top for between-group highlighting. - Tighten
-l,-n,-q, and-rbefore plotting large cohorts so the rendered track view stays readable.
Guardrails
- The script does not accept raw
bcftools rohoutput by itself; the source explicitly says it expects extraGTlines such as those produced byrun-roh.pl. - A directory with only
RGrows failed in live testing withIndexError: list index out of rangebecauseRGrows must include at least eight columns, including quality. - A minimal gzipped file containing two
GTrows plus oneRGrow successfully produced a PNG (3000 x 150) in local testing. --versionis not a real metadata path; running it without a valid data directory falls through toNo data files found in "--version".-i/--interactiveand-o/--outfileare mutually exclusive, and the script will exit with a usage error if both are provided.