igvteam / igv-notebook

Module for embedding igv.js in an IPython notebook
MIT License
66 stars 14 forks source link

Exporting a session to json #22

Closed argschwind closed 3 weeks ago

argschwind commented 1 year ago

Hi,

We are using the IGV notebook implementation to explore our data interactively and easily create IGV sessions programmatically. To share generated IGV sessions with other team members, it would be great to be able to export them to json files. Is there the possibility to do that from within the colab framework?

Alternatively, a function creating a link to an igv.org web session that could then be share would be awesome as well. But that might be a bit more complicated.

Best, Andreas

jrobinso commented 1 year ago

Hi, thanks for the interesting suggestions. I will investigate when I can find time, please leave the issue open.

Are the resources (tracks, reference fasta) loaded by URL ('url" properties) or by file path ("path" properties) in your notebooks? It will be difficult, if even possible, to use the sessions in igv.org/app if "path" is used.

argschwind commented 1 year ago

Thanks for the quick reply. All tracks are loaded from publicly available URLs, e.g. the ENCODE portal.

jrobinso commented 1 year ago

I've implemented these suggestions from the javascript (web) ui, see the new buttons above the IGV component. It would be much more difficult to implement either from python. You can try it by installing from github

pip install git+https://github.com/igvteam/igv-notebook

There's an example notebook here https://colab.research.google.com/drive/1kr8_-JdMx1fed4lIe68bxmkhbXrKTXkr?usp=sharing

jrobinso commented 1 year ago

The session and igv web link buttons only work properly if you use URLs. The session created if "path" properties are used is currently not loadable.

BTW I had an "open in igv web" link which works, but I found it distracting to open igv-web even in another tab. Anyway that's also an option, rather than showing the link. One advantage to the link is you can right-click and copy it.

argschwind commented 1 year ago

Thank you so much for the rapid implementation! This is exactly what we need and seems to work great.

argschwind commented 3 weeks ago

Hi,

I noticed that this feature seems to have disappeared in the current version when installing via !pip install git+https://github.com/igvteam/igv-notebook. Is there any way to get this back @jrobinso?

jrobinso commented 3 weeks ago

Yep, this is an unintended side-effect of inserting igv.js into a shadow dom. Apparently a shadow dom element cannot have a sibling (the extra button panel).

I'll have a fix for this soon.

jrobinso commented 2 weeks ago

The fix is released in versino 0.6.1