data-visualization/genome-browser-tracks/SKILL.md
Generate genome browser visualizations using pyGenomeTracks or IGV batch scripting for publication figures. Use when creating publication figures of genomic regions with multiple data tracks.
npx skillsauth add GPTomics/bioSkills bio-data-visualization-genome-browser-tracksInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reference examples tested with: GenomicRanges 1.54+
Before using code patterns, verify installed versions match. If versions differ:
pip show <package> then help(module.function) to check signaturespackageVersion('<pkg>') then ?function_name to verify parameters<tool> --version then <tool> --help to confirm flagsIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
"Create genome browser track visualizations" → Generate publication-quality track plots or automate IGV screenshots showing aligned reads, coverage, and annotations at specific loci.
pyGenomeTracks for static multi-track figures[x-axis]
where = top
[bigwig_coverage]
file = sample.bw
title = Coverage
height = 3
color = #4DBBD5
min_value = 0
max_value = auto
[spacer]
height = 0.5
[peaks]
file = peaks.bed
title = Peaks
color = #E64B35
height = 1
display = collapsed
[genes]
file = genes.gtf
title = Genes
height = 5
fontsize = 10
style = UCSC
color = navy
# Generate track plot
pyGenomeTracks --tracks tracks.ini --region chr1:1000000-2000000 \
--outFileName region.png --dpi 300
# Multiple regions
for region in chr1:1000000-2000000 chr2:5000000-6000000; do
pyGenomeTracks --tracks tracks.ini --region $region \
--outFileName "${region//:/_}.png" --dpi 300
done
import pygenometracks.tracks as pygtk
from pygenometracks import plotTracks
# Programmatic track configuration
tracks = '''
[x-axis]
where = top
[bigwig]
file = coverage.bw
title = ChIP-seq
height = 4
color = #4DBBD5
[bed]
file = peaks.narrowPeak
title = Peaks
height = 1
color = #E64B35
'''
# Write config and plot
with open('tracks.ini', 'w') as f:
f.write(tracks)
# Using command line via subprocess
import subprocess
subprocess.run([
'pyGenomeTracks',
'--tracks', 'tracks.ini',
'--region', 'chr1:1000000-2000000',
'--outFileName', 'output.png',
'--dpi', '300'
])
[bigwig]
file = signal.bw
title = Coverage
height = 4
color = #4DBBD5
min_value = 0
max_value = auto
number_of_bins = 700
nans_to_zeros = true
summary_method = mean
# overlay_previous = share-y # For overlaying multiple tracks
[bed]
file = peaks.narrowPeak
title = Peaks
height = 2
color = #E64B35
display = collapsed # or stacked, interleaved, triangles
labels = false
# file_type = bed # auto-detected usually
[bed_links]
file = interactions.bedpe
title = Loops
height = 3
file_type = links
links_type = arcs
color = purple
line_width = 1
[genes]
file = genes.gtf
title = Genes
height = 6
fontsize = 10
style = UCSC # or flybase
prefered_name = gene_name
merge_transcripts = false
color = navy
border_color = black
# arrow_interval = 2 # Arrow frequency
[genes_bed12]
file = genes.bed12
title = Transcripts
height = 5
fontsize = 8
color = darkblue
[hic_matrix]
file = matrix.cool
title = Hi-C
height = 10
depth = 1000000
min_value = 0
max_value = 100
transform = log1p
colormap = RdYlBu_r
show_masked_bins = false
# Create batch script
cat > igv_batch.txt << 'EOF'
new
genome hg38
load sample1.bam
load peaks.bed
snapshotDirectory ./snapshots
goto chr1:1000000-2000000
snapshot region1.png
goto chr2:5000000-6000000
snapshot region2.png
exit
EOF
# Run IGV in batch mode
igv -b igv_batch.txt
# Common IGV batch commands
new # New session
genome hg38 # Load genome
load file.bam # Load track
snapshotDirectory ./out # Set output dir
goto chr1:1000000-2000000 # Navigate to region
sort base # Sort reads
collapse # Collapse tracks
expand # Expand tracks
squish # Squish display
maxPanelHeight 500 # Set panel height
snapshot file.png # Take screenshot
exit # Exit IGV
Goal: Create a multi-track genome browser figure combining coverage, peaks, and gene models at a specific locus.
Approach: Build individual Gviz track objects (axis, gene model from TxDb, BigWig data track, BED annotation track), then compose and render with plotTracks.
library(Gviz)
library(GenomicRanges)
# Axis track
axTrack <- GenomeAxisTrack()
# Gene track from TxDb
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
grTrack <- GeneRegionTrack(txdb, chromosome = 'chr1', name = 'Genes')
# Data track from BigWig
dTrack <- DataTrack(range = 'coverage.bw', type = 'h',
chromosome = 'chr1', name = 'Coverage',
col = '#4DBBD5')
# Annotation track from BED
aTrack <- AnnotationTrack(range = 'peaks.bed', name = 'Peaks',
chromosome = 'chr1', fill = '#E64B35')
# Plot tracks
plotTracks(list(axTrack, dTrack, aTrack, grTrack),
from = 1000000, to = 2000000,
chromosome = 'chr1')
# Save to PDF
pdf('tracks.pdf', width = 10, height = 6)
plotTracks(list(axTrack, dTrack, aTrack, grTrack),
from = 1000000, to = 2000000)
dev.off()
# tracks.ini for multiple samples
[x-axis]
[sample1_bw]
file = sample1.bw
title = Sample 1
height = 3
color = #4DBBD5
min_value = 0
max_value = 100
[sample2_bw]
file = sample2.bw
title = Sample 2
height = 3
color = #E64B35
min_value = 0
max_value = 100
overlay_previous = share-y
[spacer]
height = 0.3
[sample1_peaks]
file = sample1_peaks.bed
title = S1 Peaks
height = 1
color = #4DBBD5
[sample2_peaks]
file = sample2_peaks.bed
title = S2 Peaks
height = 1
color = #E64B35
# High resolution PNG
pyGenomeTracks --tracks tracks.ini --region chr1:1-1000000 \
--outFileName figure.png --dpi 300 --width 40
# PDF for vector graphics
pyGenomeTracks --tracks tracks.ini --region chr1:1-1000000 \
--outFileName figure.pdf --width 40
# SVG for editing
pyGenomeTracks --tracks tracks.ini --region chr1:1-1000000 \
--outFileName figure.svg --width 40
tools
End-to-end CLIP-seq pipeline from FASTQ to ENCODE-compliant binding sites, single-nucleotide crosslink maps, annotation, motifs, and (optionally) differential binding. Use when running the full Yeo lab eCLIP / iCLIP / iCLIP2 / iCLIP3 / irCLIP / PAR-CLIP analysis with SMInput control, protocol-specific UMI extraction, ENCODE STAR parameters, CLIPper or Skipper peak calling with stringent log2 FC and -log10 p thresholds, IDR rescue and self-consistency QC, and downstream motif registration with mCross or PEKA.
development
Detect, date, and contextualize whole-genome duplication (WGD / paleopolyploidy) events using wgd v2 (Chen et al 2024), KsRates (Sensalari 2022 substitution-rate-corrected Ks dating), DupGen_finder (Qiao 2019), MAPS (Li 2018 phylogenomic), POInT (Conant 2008 ordered-block), SLEDGe (2024 ML-based), Whale.jl (Bayesian DL+WGD), and synteny-anchored paranome construction. Use when identifying ancient polyploidy from Ks distributions and synteny block analysis, positioning WGD events relative to speciation, distinguishing tandem from segmental from WGD duplications, dating the 2R/3R vertebrate / fish / salmonid WGDs, building paranome and Ks-age mixture models, applying KsRates substitution-rate correction across lineages, or testing alternative biased-fractionation / dosage-balance models post-WGD.
tools
Build whole-genome alignments using Progressive Cactus (Armstrong 2020 reference-free clade-level WGA), Minigraph-Cactus (Hickey 2024 pangenome-aware), LASTZ chain/net (UCSC pipeline), MUMmer4 (Marçais 2018 pairwise), minimap2 -x asm5/10/20 (Li 2018 fast pairwise), AnchorWave (Song 2022 WGD-aware), and Mauve / progressiveMauve (bacterial). Operates the HAL toolkit (Hickey 2013) for downstream extraction including halSynteny, halLiftover, halBranchMutations, and hal2maf. Use when constructing multi-species alignments for comparative-annotation projection (TOGA), synteny detection, conservation analyses (phyloP / PhastCons), or pangenome graph construction; selecting between reference-free (Cactus) and reference-anchored (LASTZ chains/nets) approaches; tuning sensitivity for closely vs distantly related genomes; or producing HAL files for genome-wide downstream tools.
development
Detect syntenic blocks and structural rearrangements between genomes using MCScanX (Wang 2012), JCVI/MCScan (Tang 2008 Python), GENESPACE (Lovell 2022) for orthology-anchored riparian visualization, SyRI for structural variation, AnchorWave for sequence-level synteny, i-ADHoRe 3.0 for highly diverged species, SynNet for synteny networks, and ntSynt for multi-genome macrosynteny. Use when identifying collinear gene blocks across species, distinguishing macrosynteny from microsynteny, detecting inversions/translocations/duplications, anchoring orthology in WGD lineages, producing publication riparian plots, computing synteny block age via Ks (cross-references whole-genome-duplication), or running synteny-aware ortholog inference in polyploids.