Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_svg() not working #10

Closed
KalinNonchev opened this issue Jul 7, 2022 · 13 comments
Closed

to_svg() not working #10

KalinNonchev opened this issue Jul 7, 2022 · 13 comments

Comments

@KalinNonchev
Copy link

Hello,

Thank you for the fast reaction here #8
I just tested the implementation in Jupyter Notebook and unfortunatly it is not working as desired.

I tried your example notebook BamFiles_Notebook. Run all the cells and exported it as html. Then I opened the html file and in the igv browser the error was "Error accessing resource: data/gstt1_sample.bam.bai Status: 0"

So I guess the visualization was not converted into SVG? I also tried doing it manullay from the browser with "to SVG". It didn't work.

Could you look into this?

Best,

@KalinNonchev
Copy link
Author

pull request history #9

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

That example is confusing, if you run all the cells you are going to have orphaned "browser" objects in all but the last one, the "to_svg()" function is only going to convert the last one as there is no reference to the previous ones.

@KalinNonchev
Copy link
Author

I confirm this logic, but the last cell has the same error for me.
Were you able to reproduce "Error accessing resource: data/gstt1_sample.bam.bai Status: 0"?

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

Try, for example, just running the last 2 cells, that is the one after this note "Load BAM file by file path (Jupyter Notebook only)", the b.to_svg(). If you run them all you'll have 1 svg converted browser and 3 "live" igvs exported to your html.

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

The example works for me, see the attached HTML. I ran this from the "binder" container linked from the top of the README. If you can't get it to work (1) confirm you are using the latest release of igv-notebook, and (2) zip and attach the html you are getting here.

BamFiles_Notebook (7).html.zip

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

Also, if you have output saved from previous runs that was saved or check-pointed its still there of course, clear all your output before trying again.

@KalinNonchev
Copy link
Author

It is not working. I do confirm that I use the latest version (to_svg would not work otherwise, but it would be nice to have igv_notebook.version option). Here it is minimal example https://easyupload.io/otjj7u (link valid for 7 days)

@KalinNonchev
Copy link
Author

KalinNonchev commented Jul 7, 2022

Terminal output after trying to transform the visualization to SVG

Traceback (most recent call last):
File ".../lib/python3.6/site-packages/ipykernel/comm/manager.py", line 110, in comm_msg
comm.handle_msg(msg)
File "../lib/python3.6/site-packages/ipykernel/comm/comm.py", line 161, in handle_msg
self._msg_callback(msg)
File ".../lib/python3.6/site-packages/igv_notebook/svg.py", line 20, in _recv
update_display(markup, display_id = display_id, clear=True)
File ".../lib/python3.6/site-packages/IPython/core/display.py", line 343, in update_display
display(obj, display_id=display_id, **kwargs)
File ".../lib/python3.6/site-packages/IPython/core/display.py", line 320, in display
publish_display_data(data=format_dict, metadata=md_dict, **kwargs)
File ".../lib/python3.6/site-packages/IPython/core/display.py", line 122, in publish_display_data
**kwargs
TypeError: publish() got an unexpected keyword argument 'clear'

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

Yes I can see that, there's still a "live" igv instance in the last cell not svg. From the traceback it looks like there might be a difference in your notebook server, it doesn't like the "clear" keyword. Could you try running from the "binder" link at the top of the README? One frustration with developing anything for Jupyter is they change the API regularly with no notice, I implemented this following the documentation but perhaps its not available in older versions. In any event the first step would be to confirm this is a Jupyter or Python version issue, running the examples from the "binder" link would help confirm that.

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

I'm on python version 3.9.1

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

It looks like the offending "clear" keyword is not needed, I removed it. If you want to test to see if this solves the issue you should be able to install from github as follows, or pull and build yourself

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

If that works I will push a pypi release, if not I will need to walk backwards through python versions to find the minimum required. So far we know it works with 3.9.1, does not work with 3.6.

Its quite late here in California and I'm quitting for the evening.

@KalinNonchev
Copy link
Author

KalinNonchev commented Jul 7, 2022

  1. I was running jupyter notebook 6.4.8, updated to 6.4.12, but the problem remained. I confirm that the "binder" example works.

  2. I switched to python 3.9, this solved the issue.

  3. I went back to python 3.6 and install the new build (pip install git+https://github.com/igvteam/igv-notebook.git) - this solved the issue. (I think you can push the new pypi release)

  4. Have a nice evening :-) In Zurich we are just starting ;)

@jrobinso
Copy link
Contributor

jrobinso commented Jul 7, 2022

This is now released as 0.3.1

@jrobinso jrobinso closed this as completed Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants