gao-lab / GLUE

Graph-linked unified embedding for single-cell multi-omics data integration
MIT License
382 stars 56 forks source link

Issue with IntervalTree ValueError in pyGenomeTracks Visualization #99

Closed aqlkzf closed 1 year ago

aqlkzf commented 1 year ago

Hello,

I've encountered a ValueError when using pyGenomeTracks for visualizing genomic intervals as part of the SCGLUE regulatory inference tutorial. The specific error is:

ValueError: IntervalTree: Null Interval objects not allowed in IntervalTree: Interval(127522206.5, 127522093.5, [127521981, 127522432, 127522093, 127522094, 0.9112896919250488])

This error seems to arise during the generation of visualization tracks for genomic regions with very short intervals. Here is the context of the tutorial code where the error occurs:

loc = rna.var.loc["Gad2"]
chrom = loc["chrom"]
chromLen = loc["chromEnd"] - loc["chromStart"]
chromStart = loc["chromStart"] - chromLen
chromEnd = loc["chromEnd"] + chromLen
!pyGenomeTracks --tracks tracks.ini \
    --region {chrom}:{chromStart}-{chromEnd} \
    --outFileName tracks.png 2> /dev/null
display.Image("tracks.png")

The related entry in the gene2peak.links file is as follows:

The above data represents a very short interval (from 127522093 to 127522094) and a corresponding larger interval (from 127521981 to 127522432). It appears that the midpoint calculation for this interval pair is leading to an inverted interval, where the start is greater than the end, causing the ValueError.

Has anyone been able to successfully run the tutorial without encountering this error? It seems like there could be an issue with how pyGenomeTracks handles the midpoint calculation for very short intervals.

I would appreciate any insights or solutions to this problem. Thank you!

Jeff1995 commented 1 year ago

I suppose this is a duplicate of #52, which should have been fixed in latest versions of pygenometracks. Could you check what version you are using and try upgrading?

aqlkzf commented 1 year ago

Thank you for your prompt attention to this matter. I have submitted a pull request that updates the env.yaml file to include the latest version of pyGenomeTracks. This should facilitate a smoother experience for others when running the tutorial by circumventing the ValueError related to interval handling. I hope this update will be beneficial for all users working through the tutorial.

Jeff1995 commented 1 year ago

Thanks! Just merged it.