gosling-lang / gos

A declarative interactive genomics visualization library for Python.
https://gosling-lang.github.io/gos
MIT License
218 stars 14 forks source link

Blank canvas plotting local BED file #135

Open cademirch opened 1 year ago

cademirch commented 1 year ago

Hi, I am trying to use gos to visualize a local bed file exactly like the OP in #120 and am also having trouble. I am working on a python notebook and the visualization is just a blank canvas.

My code:

import gosling as gos

data = gos.csv(
    url="./jw18_NC_002978.6_cov.bed",
    headerNames=['chrom', 'position', 'value'],
    chromosomeField="chrom",
    genomicFields=["position"],

    separator="\t",
)
gos.Track(data).mark_bar().encode(
    x=gos.X("position:G"),
    y=gos.Y("value:Q", axis="left"),
).view(
    assembly=[
        ("NC_002978.6", 1267782),
    ]
)

Head of the bed file:

NC_002978.6  0     0
NC_002978.6  3428  1
NC_002978.6  3439  2
NC_002978.6  3441  6
NC_002978.6  3446  8
NC_002978.6  3451  12
NC_002978.6  3454  16
NC_002978.6  3462  17
NC_002978.6  3463  21
NC_002978.6  3468  22

The bed file is only ~2 Mb (~100,000 lines) so I don't think file size is the issue here.

Screenshot for clarity on blank canvas:

Screenshot 2023-05-12 at 11 59 47 AM

Would appreciate any advice! Thank you.

cademirch commented 1 year ago

Interestingly, the same code works on a Google Colab notebook, though it took a while to load the visualization (Chrome warned that the tab was unresponsive a couple times). So perhaps the issue is with Vscode, which is what I used above.

Screenshot 2023-05-12 at 1 08 15 PM
manzt commented 1 year ago

Apologies for the delay in my response. Thanks for the detailed issue. Gos should run inside VSCode, so this could be a bug (the file size also isn't too large).

Are you able to share the file? BED files are tab-delimited, and the sample text you posted is not.

cademirch commented 1 year ago

@manzt thanks your response. Sorry the BED I pasted was not tab separated. The original file indeed is and I've attached it here. jw18_NC_002978.6_cov.bed.gz

Thanks for you help!

manzt commented 1 year ago

This is really perplexing and definitely a bug. I'm able to reproduce locally. Thanks for sharing the data! Hoping to push out a fix soon @sehilyi