Giter Site home page Giter Site logo

patrickfuller / imolecule Goto Github PK

View Code? Open in Web Editor NEW
85.0 85.0 18.0 2.93 MB

An embeddable webGL molecule viewer and file format converter.

Home Page: http://patrickfuller.github.io/imolecule/

License: MIT License

JavaScript 66.32% Python 17.47% CSS 14.95% Batchfile 0.07% Shell 1.19%

imolecule's People

Contributors

bjonnh avatar ctk3b avatar dcyang avatar patrickfuller avatar sallai avatar zuranski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

imolecule's Issues

Multiprocessing on windows

When run on windows, the process fails and spits out a looped error.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
    prepare(preparation_data)
  File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
Traceback (most recent call last):
  File "<string>", line 1, in <module>
      File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
assert main_name not in sys.modules, main_name
AssertionError: __main__
    prepare(preparation_data)
  File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
    assert main_name not in sys.modules, main_name

From this stackoverflow, it looks like multiprocessing on windows fails when you use relative imports. A weird bug, but an easy fix.

[FR] conda package

I'm happy to create the skeleton for a travis/conda build system if you can turn on travis for this repo and generate a binstar key.

Issue with json_formatter.py

Screen Shot 2019-05-07 at 11 30 03 AM
I installed python2.7 from conda. I used conda to install openbabel (conda install openbabel) and pip2 to install imolecule (pip2 install imolecule). When I go to /anaconda2/lib/python2.7/site-packages/imolecule/ the json_formatter.py file is there. Any other suggestions?

Displaying many structures in one notebook

It seems that only ten visualizations will display at once. e.g. when I display 15 structures, the screen is blank for the first 5. How do I overcome this limitation?

Merged geometry rendering

The merged-geometry branch is a huge performance boost on larger molecules (ref). I ended up not implementing it because I wasn't concerned with performance at the time. Might be worth dusting off.

Not working on jupyter lab

Recently I switched from jupyter notebook to jupyter lab and I found imolecule not working.
In a jupyter lab notebook, imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C") yields no error nor output. However, in the bowser (chrome) inspection console, the browser reports that JupyterLab does not execute inline JavaScript in HTML output.
If I use jupyter notebook, everything is fine.

Changing bonding rules

If I visualize a .xyz file, the bonds are inferred from distances between atoms. Is there a way I can modify the bonding rules?

i.e. change the cutoff distance between atom x and y beyond which a bond is declared to be present.

Some of the atoms that should be bonded are not.

How to generate the .min.js files?

I'd like to make changes to imolecule.js (trying to correct the other issue I raised), but couldn't find a way to regenerate the imolecule.min.js correctly…

404 on local nbextensions

I'm getting a 404 when running the imolecule nbextension:

[W 10:47:15.960 NotebookApp] 404 GET /nbextensionsimolecule.min.js?v=20150729104512 (127.0.0.1) 
0.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb?kernel_name=python2

I believe this has to do with the following line in the notebook.py file:

local_path = os.path.join("nbextensions", filename)

While running it on windows, the local_path is joined using \\ instead of / and that might be causing the message and actually never loading the local imolecule.min.js library.

Changing camera view

In my attempt to replicate the examples/mof.html, my MOF is rotated at a very awkward angle when I first open it. Is it easy to change the default view, through an up vector and view vector? First, for the example in examples/mof.html. Second, in the IPython Notebook, this would be nice too. Such as:

imolecule.draw("IRMOF-1.cif", show_save=True, up_vector=[1, 0, 0], view_vector=[0, 1, 0])

WebGL fallbacks

For users that don't have webGL, we should have a functional fallback (even if its slower). three.js supports a couple of backends, so falling back to CSS3 or SVG should be simple enough.

I tried this a while back in the svg branch - may be worth looking in to.

Failed to initialize WebGL context

I've noticed that in a notebook with many imolecule output cells, both Safari and Chrome fail to render all the cells, some of them throw the following error:

screen shot 2015-09-28 at 16 03 04

I've also noticed that when I develop a notebook and create a lot of imolecule output cells, the browser eventually starts throwing

WARNING: Too many active WebGL contexts. Oldest context will be lost.

I've found that this may be solved by keeping only a single renderer for different scene, but I don't know whether it would be possible to keep a single shared rendered for all imolecule outputs.

Save snapshot

This is an excellent and much needed tool, thank you!

Is there a way to save a snapshot of the molecule as e.g. a .png file, such as:

molecule = imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
molecule.savefig("mymolecule.png", format="png")

Further, a way to host this interactive viewer on a website? e.g. some .html code to copy and paste into Jekyll?

Add installers

Make this usable through pip and conda.

Biggest issue here is that this requires making open babel installable through pip and conda. imolecule install should be dead simple after that.

Why is the package stored in `python` instead of `imolecule`?

Hey Pat, I'm trying to use imolecule in another project and would need to make some small tweaks. I'll file a PR for them later but was curious about the choice to name the folder containing the package python instead of the more standard imolecule?

This prevents me from running python setup.py develop which is how I normally install packages I want to fiddle with. How do you do this locally?

For the record, just changing the name of the folder and adjusting the entry in setup.py fixes this issue for me but I may just not be using it the same way that you are.

This is the relatively obvious output in case you're curious:

$ python setup.py develop
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from python import __version__
  File "/Users/ctk3b/imolecule/python/__init__.py", line 1, in <module>
    from imolecule.notebook import draw, generate, to_json
ImportError: No module named 'imolecule'

ttributeError: 'module' object has no attribute 'json_formatter'

Hi, i'm trying to use see how imolecules works in jupyter but i keep getting the following error when trying to follow you example:

import imolecule
imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-c19f0d58009f> in <module>()
----> 1 import imolecule
      2 imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")

/usr/local/lib/python2.7/site-packages/imolecule/__init__.py in <module>()
----> 1 from imolecule.notebook import draw, generate, to_json  # noqa
      2 
      3 __title__ = 'imolecule'
      4 __version__ = '0.1.13'
      5 __author__ = 'Patrick Fuller'

/usr/local/lib/python2.7/site-packages/imolecule/notebook.py in <module>()
      5 from IPython.display import HTML, display
      6 
----> 7 import imolecule.json_formatter as json
      8 from imolecule import format_converter
      9 

AttributeError: 'module' object has no attribute 'json_formatter'

Python2.7 has been installed using home brew along with Swig and jupyter. Python dependences; ipython, pybel and openbabel have all been installed using pip2.

I have uninstalled and re-installed but that doesn't appear to work - any ideas?

Cheers,
Ollie

'pybel' has no attribute 'ob'

While attempting to draw() a smile, I get this error message:

`AttributeError Traceback (most recent call last)
in ()
----> 1 import imolecule as i
2 i.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")

~/anaconda2/envs/python35/lib/python3.5/site-packages/imolecule/init.py in ()
----> 1 from imolecule.notebook import draw, generate, to_json # noqa
2
3 title = 'imolecule'
4 version = '0.1.13'
5 author = 'Patrick Fuller'

~/anaconda2/envs/python35/lib/python3.5/site-packages/imolecule/notebook.py in ()
6
7 from . import json_formatter as json
----> 8 from . import format_converter
9
10 file_path = os.path.normpath(os.path.dirname(file))

~/anaconda2/envs/python35/lib/python3.5/site-packages/imolecule/format_converter.py in ()
10 try:
11 import pybel
---> 12 ob = pybel.ob
13 table = ob.OBElementTable()
14 has_ob = True

AttributeError: module 'pybel' has no attribute 'ob'`

I can't seem to find a reference to pybel.ob... Is this a mistake?

Color/size change for unknown elements

@patrickfuller would you be opposed to slightly modifying the parameters of "unknown" elements?

This is somewhat specific to our application but we sometimes want to look at particles that are not chemical elements and when these are completely black, they have no shading so are very hard to distinguish in 3D. Additionally, they are currently bigger than common atoms like carbon and oxygen.

Would you be opposed to tweaking the aesthetics to something that is smaller (~0.3-0.5) and a color that distinguishes particles nicely in 3D (perhaps a grey tone or perhaps even something more obnoxious to show "hey this is unknown"?)

Jupyter notebook compatibility warning

Importing imolecule in IPython 4 (Jupyter) generates following warning:

ShimWarning: The IPython.html package has been deprecated. You should import from notebook instead. IPython.html.widgets has moved to ipywidgets.
"IPython.html.widgets has moved to ipywidgets.", ShimWarning)

P.S. Great project, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.