igvteam / igv-reports

Python application to generate self-contained pages embedding IGV visualizations, with no dependency on original input files.
MIT License
349 stars 52 forks source link

Error running with BED file #102

Closed andyjslee closed 9 months ago

andyjslee commented 9 months ago

Running the following example produces an error:

run_examples.sh (lines 33-39)

echo bed
python igv_reports/report.py test/data/variants/variants.bed \
--genome hg38 \
--flanking 1000 \
--info-columns GENE TISSUE TUMOR COSMIC_ID GENE SOMATIC \
--tracks test/data/variants/variants.bed test/data/variants/recalibrated.bam \
--output docs/examples/example_bed.html

Error:

Traceback (most recent call last):
  File "/path/igv-reports/igv_reports/report.py", line 510, in <module>
    main()
  File "/path/igv-reports/igv_reports/report.py", line 506, in main
    create_report(args)
  File "/path/igv-reports/igv_reports/report.py", line 66, in create_report
    config["type"] = get_track_type(config["format"])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/python3.11/site-packages/igv_reports/tracks.py", line 60, in get_track_type
    return dict[format]
           ~~~~^^^^^^^^
KeyError: 'bigbed'
phillip-richmond-umoja commented 9 months ago

I'm getting this error with bed files and VCF files.

+1 on this being an odd issue

phillip-richmond-umoja commented 9 months ago

I've gotten this bigbed issue on every instance of using the --genome hg38. I think there may have been a push somewhere else that relies on this hg38 and that is what is creating havoc. If you try changing to --fasta then the issues go away!!!!

andyjslee commented 9 months ago

@phillip-richmond-umoja thank you!

I found out that the bigbed error occurs when parsing the genome from https://igv.org/genomes/genomes.json in genome.py. It seems that new parameters got added to the JSON. So I just commented out lines 61 to 67 in report.py. This is a temporary workaround, though.

jrobinso commented 9 months ago

Thanks @andyjslee and @phillip-richmond-umoja , the problem was indeed the introduction of a "bigbed" file to the hg38.json. I have fixed this by adding a check and skipping tracks with unsupported formats. This is released as version 1.12.0.

andyjslee commented 9 months ago

@jrobinso thank you!

phillip-richmond-umoja commented 9 months ago

Look forward to seeing it on conda! Thanks @jrobinso for the quick fix!

jrobinso commented 9 months ago

@phillip-richmond-umoja Its on pypi, I'm not sure how it gets on conda. Python's not really my speciality.

phillip-richmond-umoja commented 9 months ago

It was pushed to conda 5 minutes ago.