gos icon indicating copy to clipboard operation
gos copied to clipboard

empty track

Open EnrichettaMileti opened this issue 11 months ago • 4 comments

Hi! I'm running this simple script to visualise bigwig file:

import gosling as gos
data = gos.bigwig(
    url=‘https://s3.amazonaws.com/gosling-lang.org/data/ExcitatoryNeurons-insertions_bin100_RIPnorm.bw’,
    column= ‘position’,
    value=‘peak’
)
track = gos.Track(data).mark_area().encode(
    x=gos.X(‘position:G’),
    y=gos.Y(“peak:Q”, axis=“right”),
    color=gos.value(“royalblue”),
).properties(title=“bigwig”,height=180,width=725)
vis = track.view(title=‘test’)
vis.save(‘test.html’)

if instead of your url I saved the file on my Amazon aws and run the same script using this url: https://enrmil.s3.eu-north-1.amazonaws.com/ExcitatoryNeurons-insertions_bin100_RIPnorm.bw I obtain an empty track. This is also happening if I use a localhost.

EnrichettaMileti avatar Mar 14 '24 14:03 EnrichettaMileti

Hi there, this looks like a CORS configuration issue on your s3 bucket. You need to enable CORS to allow the web-browser to make requests to s3, and ensure the bucket is public.

manzt avatar Mar 14 '24 16:03 manzt

Thanks it works. I have a similar issue if I try to use the localhost as in this example: https://gosling-lang.github.io/gos/user_guide/local_data.html If I download the data and I run the same script I get an empty track. Should I also do some configuration for the localhost? If so, how? thanks again

EnrichettaMileti avatar Mar 21 '24 09:03 EnrichettaMileti

Hi, the local data capabilities only work while there is a Python session running (i.e., in an active Jupyter notebook). You can't export to standalone HTML, because the web-server on localhost is no longer running. Perhaps we should make this note larger, but it's at the very bottom of the local data docs.

May I ask what your goal is with the generated HTML? Is it to view locally, or would you like to publish a website for others? You can certainly host your own data locally, but this requires setting up your own web server.

Alternatively, I have been considering a simple CLI to run a Python script and view the outputs in a web brwoser (without needing to start Jupyter, etc).

manzt avatar Mar 26 '24 16:03 manzt