Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with IntervalTree ValueError in pyGenomeTracks Visualization #99

Closed
aqlkzf opened this issue Nov 10, 2023 · 3 comments
Closed

Issue with IntervalTree ValueError in pyGenomeTracks Visualization #99

aqlkzf opened this issue Nov 10, 2023 · 3 comments

Comments

@aqlkzf
Copy link

aqlkzf commented Nov 10, 2023

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:

  • Chromosome: chr2
  • Start1: 127522093
  • End1: 127522094
  • Chromosome: chr2
  • Start2: 127521981
  • End2: 127522432
  • Score: 0.91129

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
Copy link
Collaborator

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
Copy link
Author

aqlkzf commented Nov 10, 2023

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
Copy link
Collaborator

Thanks! Just merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants