GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
199 stars 61 forks source link

Unpredictable JBrowse2 visualization #4316

Closed gihannagalindez closed 3 months ago

gihannagalindez commented 4 months ago

chrX.zip

Hi! Thanks for this nice tool! I am using JBrowse2 to visualize nucleotide dependencies in the genome at 1-bp resolution in the region around a tRNA in yeast. This is not the typical resolution for hic files, but it seems that there is a bug, because the visualization changes when I zoom or try to move the track around (i.e. the red dots move around to unpredictable, seemingly random locations). I encounter this for both the web tool and the desktop version (I'm on Windows). I am attaching a hic file that contains the data for chromosome X; this file was generated using Juicer pre tool. I checked/visualized the same .hic file using another tool and it works fine. However, it would really be a great help for us if this can be solved and nicely visualized in JBrowse2.

To Reproduce

  1. Open JBrowse2 desktop and load the yeast fasta file.
  2. Load the attached .hic file.
  3. Go to chromosome and location X:353,208..356,165
  4. Try to move the track around. You will notice that the visualization changes if you move the track or try to zoom.

Screenshots

Please look at the two screenshots below. The location is the same but the visualization changes after moving the track horizontally. screenshot1 screenshot2

Version: 2.10.3

Additional context

cmdcolin commented 4 months ago

thanks for reporting this. I think I can confirm some weirdness here, there are error messages in the dev console that say something to the effect of "RangeError: offset is outside the bounds of the DataView"

this could mean the parser has a bug

cmdcolin commented 4 months ago

just a random observation:

it appears that the resolution on this track you sent is "1" which means every cell in the file is a single basepair-pair (e.g. an interaction between exactly two base pairs). that is sort of abnormal from what i've seen. i have never used juicer though to generate .hic files, so i'm not sure if you have any control over this setting? if you do, you might try adjusting it

your file

Screenshot 2024-03-25 at 4 03 08 PM

a file from our sample data

Screenshot 2024-03-25 at 4 03 26 PM

https://jbrowse.org/code/jb2/v2.10.3/?config=test_data%2Fconfig_demo.json&session=share-Mjgz2vW2HQ&password=4bxx7

gihannagalindez commented 4 months ago

Thanks a lot for your quick response! We are indeed generating the .hic files using the 1-bp resolution on purpose because this is for a new application case. Using the Juicer pre tool we were able to set/adjust the resolution to examine dependences in the single base pair level in the genome. It would be a great help if JBrowse2 can also handle the visualization in this granularity. Thank you very much!

cmdcolin commented 4 months ago

@gihannagalindez i tried to create a potential fix here https://github.com/GMOD/jbrowse-components/pull/4319

you can run jbrowse create --branch hic_fix newinstance to try this out in a new instance (or run jbrowse upgrade --branch hic_fix in your current instance)

I am pretty inexperienced with hic data so I am not sure if what I'm seeing is correct but let me know if it looks right to you!

cmdcolin commented 4 months ago

went ahead and merged the fix to it...feel free still to test it out.

the particular thing that i am still not sure about is that there is a 'horizontal' lines not at y=0...that is visible in your screenshots. is that expected?

cmdcolin commented 3 months ago

I believe this is now fixed. Instead of offsetting according to the first hi-c contact bin, it offsets according to region.start divided by the current bin size. Improved coloring added too :)

cmdcolin commented 3 months ago

the fix should be in the now released latest version v2.11.0 along with some fun hi-c coloring schemes https://jbrowse.org/jb2/blog/2024/04/16/v2.11.0-release/