IGV Report Module

IGV.js integration for genomic visualization

IGV report generation for VariantCentrifuge.

variantcentrifuge.generate_igv_report.parse_bam_mapping(bam_mapping_file)[source]

Parse a BAM mapping file (TSV or CSV) that maps sample_id to BAM file paths.

Parameters:

bam_mapping_file (str) – Path to the BAM mapping file.

Returns:

Dictionary mapping sample IDs to BAM file paths.

Return type:

dict

variantcentrifuge.generate_igv_report.generate_igv_report(variants_tsv, output_dir, bam_mapping_file, igv_reference=None, integrate_into_main=False, igv_fasta=None, igv_ideogram=None, igv_max_allele_len_filename=10, igv_hash_len_filename=6, igv_max_variant_part_filename=50, igv_flanking=50)[source]

Generate per-variant per-sample IGV reports using igv-reports ‘create_report’.

For each variant present in one or more samples (genotype not 0/0 or ./.), we: - Create a one-line TSV describing that variant with columns: CHROM, POS, REF, ALT. - For each sample carrying that variant, run create_report:

create_report single_variant.tsv

–genome igv_reference (if using an online genome reference) OR –fasta local_fasta_file (if using a local FASTA file) –sequence 1 –begin 2 –end 2 –flanking 50 –info-columns CHROM POS REF ALT –tracks corresponding_sample.bam –output sample_report.html

  • Produce an HTML report named {sample_id}_{CHROM}_{POS}_{REF}_{ALT}_igv_report.html.

Changes: 1. Place IGV reports into a subfolder report/igv/ within output_dir. 2. Create a JSON mapping file (igv_reports_map.json) that maps each generated IGV report

back to its sample and variant for integration in the interactive HTML report.

  1. Support for local FASTA files to avoid network access requirements.

  2. Implement filename shortening for long REF/ALT alleles to prevent “File name too long” errors.

  3. Support for configurable flanking region size for IGV reports.

Parameters:
  • variants_tsv (str) – Path to the final variants TSV file.

  • output_dir (str) – Output directory where the main reports are stored. IGV reports will be placed in output_dir/report/igv/.

  • bam_mapping_file (str) – Path to BAM mapping file.

  • igv_reference (str, optional) – Genome reference (e.g., hg19 or hg38) for IGV. Not used if igv_fasta is provided.

  • integrate_into_main (bool) – If True, integrate into main report (placeholder).

  • igv_fasta (str, optional) – Path to a local FASTA file for IGV reports. The index file (.fai) must exist in the same directory with the same name + ‘.fai’ extension following the standard convention (e.g., genome.fa.fai).

  • igv_ideogram (str, optional) – Path to an ideogram file for IGV visualization.

  • igv_max_allele_len_filename (int, optional) – Maximum length for REF/ALT alleles in filenames. Default is 10.

  • igv_hash_len_filename (int, optional) – Length of hash to append when truncating alleles. Default is 6.

  • igv_max_variant_part_filename (int, optional) – Maximum length for the variant part of filenames. Default is 50.

  • igv_flanking (int, optional) – Flanking region size in base pairs for IGV reports. Default is 50.

Return type:

None