g2nb / igv-jupyter

Extension for Jupyter which integrates igv.js
MIT License
154 stars 13 forks source link

Solution for notebook sharing with embed IGV widget #12

Closed a-slide closed 5 years ago

a-slide commented 6 years ago

When sharing a notebook or exporting to HTML the IGV widget does not display, which is normal since the link with the data is broken. Is there any way to save the data for the selected window inside the notebook, similar to the the offline plotly mode ? I understand that it would require quite a lot of work, so an alternative could be a functionality to display a snapshot of the selected locus in svg/png format instead.

a-slide commented 6 years ago

OK I forgot to read the other issues first This is definitely similar to #1

jrobinso commented 6 years ago

This is a great idea! I am working on a command line tool to do something very similar in python (igv.js-reports). It also requires some changes to igv.js. When that is functional this should be doable as well. It requires the package "pysam".

a-slide commented 6 years ago

Awesome. Pysam is a robust dependency, I don't think anyone will complain. I am happy to beta test the functionality when you have a working prototype.

jrobinso commented 5 years ago

@a-slide I have a couple of solutions for this. First SVG output, see issued #15.

The second solution is loading tracks using dataURIs. There is another project, igv.js-reports, for doing this that will be released sometime next month. I pushed an example notebook, snippet below.

The SVG output option will be pushed to pypi soon.


b.load_track(
{
    "name": "Annotations",
    "url": "data:application/gzip;base64,H4sIAL2B61oC/6VVy24UQQw8N79CJ2q/bSFOCUK5cAEk/v9LKM+S7AxiQhZW2larH+Vyudzz8PRwd/f4/YcOd61RIT6eHj8+PC/ff/ry9dvqn4Wl1D1/uO5h1vuft/0VpcL30vtjjfc7wDV4MPEklrEml+u7F5BBuDooXeo0MHvSDYF3iIhMw3JyLp1kCC42SdaklEnuk5dMZp/U+ywYMjEBVw8wpSmMA4pLhjW5/JHUaAgsp5PMTM1Z5NiRjFneZ1d0GFq4T+SFOa/o4Lowl2LEUVKcVCXCmAujaXOwSJzxRTjvqt5U3feiYbUGRZmcqiaidU9vV20HuYYNbvqdSKuDpDkDSYvQNOhWFdih2HNCwowRYpxyoiVyC6cd5GaiAJfk5nHwUKAMr3oIWoauC/KbIu8QEXiNaCX+zz/2u382zIJhIDVNNsBw9JX0mtp20uSaxqTTTWrGAmhw0gwDF3BeM1HomTAfDGg6y9Jm5bKDWVA64XylLKV8S4O9AHZRCP2lumWE6SGulbSj4jyywVY3mfQK2SZNvwrrUI740phTUYJk3drw2DcFk6dEnFJyW3aTGFfIpkTdus3pV98EUT96kdO6SBr9HOz7Jm15W03XuUpiegOlHeJmXojwL+ZVmNf/YF7dSt2Y0s+XWzclTAmfOq5AdTEKOLjrYPCyJbC8S+IuPvEYQhYuDP0KJgfBxqtgYxgaVl47dRjeRBKiRmfymHIeK/Z84KIP48OV/eXaAFugPehmYYYitXlHqQ7RfTvIduoXvIZsBwv/PfoVFMWBgwiTm3L27XN8Y9RjzhqxS/knGgV00ggIAAA=",
    "displayMode": "SQUISHED",
    "indexed": False,
    "type": "annotation",
    "format": "bed"
})