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

RFC: Jupyter/IPython Notebook Features #125

Open
biasmv opened this issue Oct 31, 2015 · 11 comments
Open

RFC: Jupyter/IPython Notebook Features #125

biasmv opened this issue Oct 31, 2015 · 11 comments

Comments

@biasmv
Copy link
Owner

biasmv commented Oct 31, 2015

Hi All,

I've pushed an initial version of an alternative Jupiter/IPython notebook module for PV to master. It's a little more powerful than the previous version and allows to load structures from local files. In theory everything that can be converted to a PDB string can be loaded in the viewer. Later one, one could think of using a richer serialisation format.

The module only supports the basics: creating the viewer, adding molecules to it. For example:

from pvviewer.viewer import *
from pvviewer.mol import Mol
structure = Mol.from_pdb_id('2por')
viewer = Viewer()
viewer.cartoon('porin', structure)
viewer.auto_zoom()
viewer

This will load the PDB 2por from PDB.org and display it in the viewer using the cartoon render mode.

@aebrahim, @hainm: Since you seem to be using Jupyter/IPython Notebooks, I thought I might ping you regarding the recent changes.

What would the most important features to you?

@biasmv
Copy link
Owner Author

biasmv commented Oct 31, 2015

Here is the new API, the above sample probably doesn't work anymore :).

import pvviewer as pv

structure = pv.mol.from_pdb_id('2por')
viewer = pv.Viewer()
viewer.cartoon('porin', structure, color=pv.color.ss_succession())
viewer.auto_zoom()
viewer.show()

@hainm
Copy link
Contributor

hainm commented Oct 31, 2015

@biasmv great, thanks for the ping.

What would the most important features to you?

how's about rendering a trajectory from simulation? like chemview package here

We have an engine, pytraj/cpptraj, can parse different types of format from different simulation packages, it would be really great if there is an way to plug our to your.

@biasmv
Copy link
Owner Author

biasmv commented Nov 1, 2015

That sounds like a plan. I'll look into it to see what is required to making that happen.

@satary
Copy link

satary commented Jun 16, 2016

Hello @biasmv!
Thank you for your work, looks amazing!
Are there any prerequisites for installation?
I've used setup.py to install pv, there were no errors, it imports and executes fine (no errors in Jupyter server). The problem is - it creates an empty canvas and that's it. Am I doing something conceptually wrong?
image

@hainm
Copy link
Contributor

hainm commented Jun 16, 2016

may be you can right click then choose "Inspect", then choose Console to see error message from Javascript?

@ajfarkas
Copy link
Contributor

I suspect that you're getting an error for calling viewer.show() without
an argument. If you're trying to show the whole model, you shouldn't need
to call show.

On Thu, Jun 16, 2016 at 8:03 AM, Hai Nguyen notifications@github.com
wrote:

may be you can right click then choose "Inspect", then choose Console to
see error message from Javascript?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#125 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AHenfRIzWLSVNeArJFYqe9heHF83NsdVks5qMWXegaJpZM4GZd8I
.

@biasmv
Copy link
Owner Author

biasmv commented Jun 16, 2016

@satary: It's hard to say what's going on. As @hainm pointed out, you might see what's wrong by taking a look at the JavaScript console of your browser.

@ajfarkas: The viewer.show() above is part of the Python API. It's doesn't work the same way as the JS show you are thinking of. The show call above essentially spits out a bunch of html and JS code that then gets inserted into the DOM :).

@satary
Copy link

satary commented Jun 16, 2016

Thanks @hainm!
It sure is a Javascript issue.

Refused to execute script from 'http://raw.githubusercontent.com/biasmv/pv/master/bio-pv.min.js?v=20160616195731' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
Uncaught Error: Script error for "pv"
http://requirejs.org/docs/errors.html#scripterror

I don't know if it is google chrome issue or something else

UPD.
@biasmv thanks for your response!
I found that changing
13 paths: {
14 pv: '//raw.githubusercontent.com/biasmv/pv/master/bio-pv.min'
15 }
to
13 paths: {
14 pv: '//rawgit.com/biasmv/pv/master/bio-pv.min'
15 }
in viewer.py
does the trick.
I have no clue why =)
image

@biasmv
Copy link
Owner Author

biasmv commented Jun 16, 2016

@satary: I've update the python module to use rawgit. Can you try if the latest version is working for you?

Best,
Marco

@hainm
Copy link
Contributor

hainm commented Jun 16, 2016

@biasmv may be let pv to use local js file?

@biasmv
Copy link
Owner Author

biasmv commented Jun 16, 2016

@hainm: yes, that's certainly the better solution. I'll look into it. Won't happen before the weekend, though.

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

4 participants