Is VR useful for drug discovery?

I read the article about the VR application in drug discovery. I felt it is very interesting approach because it allows chemists to see molecules directly.

Also there are many tools and services to use same approach. Now chemists can dive in to a protein pocket and look deeply around the site.

Some articles said that VR makes drug design process more intuitively. Hmm… is it true? Of course the approach provides new opportunity to view the binding site or any other thing. It will be exciting and will be easy to understand 3D structure. Just like “Don’t think feel”…. It is opposite to AI( Machine Learning ) driven drug discovery. I think most of drug design process is not intuitive. And current VR system lacks the sense of touch the feel. User can not feel the repulsion or attraction between ligand – protein interaction directly.
If VR drug design works very well, it indicates there are many elements which are not still defined as descriptors or energy I think. (It just my opinion…)

From AI side, I found very interesting article about making “SAKE” with AI.
The article describes a Toji’s challenge to making “SAKE” with AI. Toji is the chief brewer at a sake brewery.
They collected many data from their brewing process and trained AI with the data.

These technologies are progressing rapidly, so I might be necessary to change my opinion soon.
VR and AI is very attractive and interesting area for me. I would like to follow the fashion.


Compile LeapPython and Manipulate protein structure with Leap Motion.

I was interested in Kinect as input device, because Kinect can detect motion as input it feels feature. ;-)
And some days ago, I got new input device “Leap Motion”.
The Leap Motion controller is a small USB peripheral device which is designed to be placed on a physical desktop, facing upward. ( from wiki )
I want to use this device with PyMol!
Let’s try it.
At first to use Leap Motion from python, user need to get Leapmotion SDK. My environment is OSX, so I got SDK v2.3 from developer site.
Installation is little bit complicated for me, because I want to use LeapPython library from virtual environment but the library is linked with native python.
So, I build or change dynamic link following procedure.

In Python2.7, I changed link with following command.

iwatobipen$ cd /somepath/LeapSDK/lib
iwatobipen$ otool -L
	/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
	@loader_path/libLeap.dylib (compatibility version 0.7.0, current version 2.3.1)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
# change Python link from native to anaconda
iwatobipen$ install_name_tool -change /Library/Frameworks/Python.framework/Versions/2.7/Python /Users/iwatobipen/.pyenv/versions/anaconda-2.4.0/lib/libpython2.7.dylib

In Python3.5, I compiled using swig.
Newest swig will cause error, so I used swig version 3.0.3
I referred following url to do that.
OK Let’s go

# Copy Leap.h, LeapMath.h, Leap.i, and libLeap.dylib into one folder. And type following command.
# Generate LeapPython.cpp withswig -c++ -python -o LeapPython.cpp -interface LeapPython Leap.i
iwatobipen$ swig -c++ -python -o LeapPython.cpp -interface LeapPython Leap.i
# Compile and link 
clang++ -arch x86_64 -I/Users/iwatobipen/.pyenv/versions/anaconda-2.4.0/include/python2.7 LeapPython.cpp libLeap.dylib /Users/iwatobipen/.pyenv/versions/anaconda-2.4.0/lib/libpython2.7.dylib -shared -o

Now I got linked each python version in anaconda.

Unfortunately, I could not install pymol in python3.5. Following code was run in python2.7. I installed pymol by using conda install command.
Pymol Wiki provided sample code to use Leap Motion from pymol. I used the example. I added “path” which placed

import sys
import math
from pymol import cmd
sys.path.insert( 0, '/Users/iwatobipen/develop/py2env/LeapSDK/build/')

import Leap
from Leap import Matrix, Vector

class PymolListener(Leap.Listener):
    def __init__(self, *args, **kwargs):
        super(PymolListener, self).__init__(*args, **kwargs)

        self.prev_frame = None

        self.controller = Leap.Controller()

    def __del__(self):

        super(PymolListener, self).__del__()

    def update_view(self, frame):
        if not self.prev_frame:

        view = list(cmd.get_view())

        if frame.rotation_probability(self.prev_frame) > 0.1:
            m = frame.rotation_matrix(self.prev_frame)
            m *= Matrix(Vector(*view[0:3]),
            view[:9] = m.to_array_3x3()

        if frame.scale_probability(self.prev_frame) > 0.1:
            s = frame.scale_factor(self.prev_frame)
            delta_z = math.log(s) * 100.0
            view[11] += delta_z
            view[15] -= delta_z
            view[16] -= delta_z


    def on_frame(self, controller):
        frame = controller.frame()


        self.prev_frame = frame

listener = PymolListener()

Then run pymol and fetched sample pdb.

iwatobipen$ pymol
# from pymolconsole.
pymol> fetch 1atp
pymol> run

Result is …. It seems work well. Now, I am reading API reference to write code.