In [1]:
import sys
sys.path.append('/usr/lib/modeller9v7/modlib/')
sys.path.append('/usr/lib/modeller9.12/lib/x86_64-intel8/python2.5/')
In [2]:
#управляющий скрипт
from modeller.automodel import *
class mymodel(automodel):
    def special_restraints(self, aln):
        rsr = self.restraints
        for ids in (('OE2:32', 'O6C:121'),
                    ('O:102', 'N2B:121'),
                    ('OH:60', 'O6B:121')):
                    atoms = [self.atoms[i] for i in ids]
                    rsr.add(forms.upper_bound(group=physical.upper_distance,
                      feature=features.distance(*atoms), mean=3.5, stdev=0.1)) 
env = environ()
env.io.hetatm = True
a = mymodel(env, alnfile='al_mod.pir', knowns=('1lmp'), sequence='seq')
a.starting_model = 1
a.ending_model = 5
a.make()
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-d09228fc5e4d> in <module>()
      1 #управляющий скрипт
----> 2 from modeller.automodel import *
      3 class mymodel(automodel):
      4     def special_restraints(self, aln):
      5         rsr = self.restraints

/usr/lib/modeller9v7/modlib/modeller/__init__.py in <module>()
     67 
     68 # Set Modeller install location and license
---> 69 import _modeller
     70 if hasattr(config, 'license'):
     71     _modeller.mod_license_key_set(config.license)

ImportError: No module named _modeller
In [8]:
%%bash
echo "from modeller.automodel import *
class mymodel(automodel):
    def special_restraints(self, aln):
        rsr = self.restraints
        for ids in (('OE2:32', 'O6C:121'),
                    ('O:102', 'N2B:121'),
                    ('OH:60', 'O6B:121')):
                    atoms = [self.atoms[i] for i in ids]
                    rsr.add(forms.upper_bound(group=physical.upper_distance,
                      feature=features.distance(*atoms), mean=3.5, stdev=0.1)) 
env = environ()
env.io.hetatm = True
a = mymodel(env, alnfile='al_mod.pir', knowns=('1lmp'), sequence='seq')
a.starting_model = 1
a.ending_model = 5
a.make()
" > lys.py
In [7]:
%%bash
mod9v7 lys.py
In [88]:
from xmlrpclib import ServerProxy
from IPython.display import Image
import os, sys, time

# pymol launching
import __main__
__main__.pymol_argv = [ 'pymol', '-cp' ]
# __main__.pymol_argv = [ 'pymol', '-x' ]  # for GUI

import pymol
from pymol import cmd
pymol.finish_launching()

defaultImage = 'pymolimg.png'
def prepareImage(width=300, height=300, sleep=5, filename=defaultImage):
    ## To save the rendered image
    cmd.ray(width, height)
    cmd.png('pymolimg.png')
    time.sleep(sleep)
    
# Define some shortcuts
def focus(x):
    cmd.center(x)
    cmd.zoom(x)
In [89]:
cmd.do('''
delete all
bg white
show cartoon
load seq.B99990001.pdb
load seq.B99990002.pdb
load seq.B99990003.pdb
load seq.B99990004.pdb
load seq.B99990005.pdb
load 1lmp_now.ent
super 1lmp, seq.B99990001
center 1lmp
ray 
png pic1.png
''')
In [90]:
Image(filename='pic1.png')
Out[90]:
In []:
#4 модель работает лучше всего