本文整理汇总了Python中pymol.finish_launching函数的典型用法代码示例。如果您正苦于以下问题:Python finish_launching函数的具体用法?Python finish_launching怎么用?Python finish_launching使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了finish_launching函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,debug=0):
#look for PYMOL_PATH
import os
import sys
if sys.platform == "win32" :
os.environ['PYMOL_PATH'] = "C:\Python26\lib\site-packages\pymol"
import pymol
print("ok launch pymol")
pymol.pymol_argv[1] = '-qcGi'
import __main__
# __main__.pymol = pymol
print(dir(__main__))
print(__name__)
pymol.finish_launching()
import sys
print("done")
self.cmd = pymol.cmd
self.Mols = {}
self.pymol = pymol
self.debug = debug
self.viewmat = None#numpy.array(self.cmd.get_view(quiet=1))
self.fragments = {'formamide':(3,1),
'acetylene':(2,0),
'formamide':(3,1),
'cyclobutane':(4,0),
'cyclopentane':(5,0),
'cyclopentadiene':(5,0),
'cyclohexane':(7,0),
'cycloheptane':(8,0),
'methane':(1,0),
'benzene':(6,0),
'sulfone':(6,0)
}
示例2: main
def main():
parser=argparse.ArgumentParser()
parser.add_argument('-p', action='store', required=True, dest='pdbfile',
help='pathfile is a textfile of name of pdb')
parser.add_argument('-l', action='store', required=True, dest='loop',
help='loop is an int number')
inputs=parser.parse_args()
pdbfile=inputs.pdbfile
loop=int(inputs.loop)
print "loop is %s "% loop
dirname=os.getcwd()+'/interface_analyzer/pdbdata/'+pdbfile
pdbfileselect=pdbfile.split('.')
savefile=os.getcwd()+'/interface_analyzer/pdbdata/'+pdbfileselect[0]+'_antigen.pdb'
print "remove antibody of complex,so can caculate the value of antigen sasa "
pymol.finish_launching()
if loop!=0:
pymol.cmd.reinitialize()
cmd.load(dirname)
cmd.remove('hetatm')
cmd.select('target1',pdbfileselect[0])
cmd.save(dirname,(('target1')))
cmd.delete('target1')
cmd.remove('solvent')
cmd.remove('hydrogens')
cmd.remove('chain L+H')
cmd.select('target',pdbfileselect[0])
cmd.save(savefile,(('target')))
cmd.delete(all)
cmd.sync()
cmd.quit()
print "remove the antibody of complex have done"
示例3: open_gui
def open_gui(self):
"""Open the PyMOL GUI."""
# Use the PyMOL python modules.
if self.exec_mode == 'module':
# Open the GUI.
pymol.finish_launching()
self.open = True
# Otherwise execute PyMOL on the command line.
if self.exec_mode == 'external':
# Test that the PyMOL binary exists.
test_binary('pymol')
# Python 2.3 and earlier.
if Popen == None:
raise RelaxError("The subprocess module is not available in this version of Python.")
# Open PyMOL as a pipe.
self.pymol = Popen(['pymol', '-qpK'], stdin=PIPE).stdin
# Execute the command history.
if len(self.command_history) > 0:
self.exec_cmd(self.command_history, store_command=0)
return
# Test if the PDB file has been loaded.
if hasattr(cdp, 'structure'):
self.open_pdb()
示例4: main
def main():
parser=argparse.ArgumentParser()
parser.add_argument('-f', action='store', required=True, dest='pdbfile',
help='PDB file of protein-antibody complex')
parser.add_argument('-d', action='store', required=True, dest='distance',
help='distance is more than 0')
parser.add_argument('-c1', action='store', required=True, dest='chain_a',
help='distance is more than 0')
parser.add_argument('-c2', action='store', required=True, dest='chain_b',
help='distance is more than 0')
inputs=parser.parse_args()
from os import path,access,R_OK
chain_a='chain '+inputs.chain_a
chain_b='chain '+inputs.chain_b
pdbfile=os.getcwd()+'/interface_analyzer/pdbdata/'+inputs.pdbfile
distance=inputs.distance
if path.exists(pdbfile) and path.isfile(pdbfile) and access(pdbfile,R_OK):
pass
else:
print "Your PDB file does not exist. Please check the path of your PDB file."
sys.exit(1)
print "Extracting out the residues with cut off with 4"
pymol.finish_launching()
pymol.cmd.load(pdbfile)
pymol.cmd.remove('hydrogens')
pymol.cmd.remove('solvent')
pairwise_dist(inputs.pdbfile,chain_a,chain_b,float(distance),'P')
pymol.cmd.delete(all)
pymol.cmd.quit()
示例5: cartoon
def cartoon( filename, name ):
pymol.finish_launching()
pymol.cmd.read_pdbstr( *name_check( filename, name ) )
pymol.cmd.hide( "everything" )
pymol.cmd.show( "cartoon" )
pymol.cmd.spectrum()
示例6: calc_rmsd_pymol
def calc_rmsd_pymol(pdb1, pdb2, method):
"""Calculate rmsd using PyMOL. Two methods are available: align and fit
See:
- Align: http://www.pymolwiki.org/index.php/Align
- Fit: http://www.pymolwiki.org/index.php/Fit
Align can return a list with 7 items:
RMSD after refinement
Number of aligned atoms after refinement
Number of refinement cycles
RMSD before refinement
Number of aligned atoms before refinement
Raw alignment score
Number of residues aligned
in this version of function, the function returns `RMSD before refinement`.
Install on OSX: ``brew install homebrew/science/pymol`` and set ``PYTHONPATH`` to
your PyMOL packages, .e.g ::
PYTHONPATH=$PYTHONPATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
If problem::
Match-Error: unable to open matrix file '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/data/pymol/matrices/BLOSUM62'.
then define ``PYMOL_PATH`` in your .bashrc, e.g.::
export PYMOL_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymol/
"""
try:
import __main__
__main__.pymol_argv = ['pymol', '-qc']
import pymol # import cmd, finish_launching
pymol.finish_launching()
except ImportError:
print('calc_rmsd_pymol: you need to have installed PyMOL')
sys.exit(0) # no error
pymol.cmd.reinitialize()
pymol.cmd.delete('all')
pymol.cmd.load(pdb1, 's1')
pymol.cmd.load(pdb2, 's2')
if method == 'align':
# experiments with align <https://pymolwiki.org/index.php/Align>
# quiet = 0/1: suppress output {default: 0 in command mode, 1 in API}
return (pymol.cmd.align('s1', 's2',quiet=1, object='aln')[3],0) #, pymol.cmd.align('s1','s2')[4])
#raw_aln = pymol.cmd.get_raw_alignment('aln')
#print raw_aln
#for idx1, idx2 in raw_aln:
# print '%s`%d -> %s`%d' % tuple(idx1 + idx2)
#pymol.cmd.save('aln.aln', 'aln')
if method == 'fit':
return (pymol.cmd.fit('s1', 's2'), 'fit')
示例7: main
def main(sys_argv=sys.argv):
#pdbCode = '1XFH'.lower()
pdbCode = '2NWL'.lower()
pymol.finish_launching()
cmd.fetch(pdbCode)
xml = get_pdbtm_xml(pdbCode)
chains_dict = get_pdbtm_annotation(pdbCode, xml)
highlight_molecule(chains_dict, pdbCode.lower())
示例8: export_png
def export_png(self, rel_path, pdb_id, infos):
"""Uses pymol to export a png representing a PDB structure. The image
displays the chains that contains the domains (cartoon) and the
interacting residues (surface). THE CHOICE HAS BEEN MADE TO NOT
HIGHLIGHT THE DOMAINS. """
# extracts informations for the chain and the residues
domain_1 = self._extract_info(infos, '1')
domain_2 = self._extract_info(infos, '2')
# gets informations
chain_1 = domain_1['chain']
chain_2 = domain_2['chain']
residues_1 = '+'.join(domain_1['ids'])
residues_2 = '+'.join(domain_2['ids'])
# build the select command for pymol
chain_1_obj = 'chain '+chain_1+' and (not resi '+residues_1+')'
chain_2_obj = 'chain '+chain_2+' and (not resi '+residues_2+')'
residues_1_obj = 'chain '+chain_1+' and resi '+residues_1
residues_2_obj = 'chain '+chain_1+' and resi '+residues_2
# run pymol without its gui
pymol.pymol_argv = ['pymol','-qc']
pymol.finish_launching()
# the file
pymol.cmd.load(rel_path, pdb_id)
pymol.cmd.disable('all')
pymol.cmd.enable(pdb_id)
# background
pymol.cmd.bg_color(color='white')
pymol.cmd.hide('all')
pymol.cmd.deselect()
# objects
pymol.cmd.create('chain_1', chain_1_obj)
pymol.cmd.create('chain_2', chain_2_obj)
pymol.cmd.create('res_1', residues_1_obj)
pymol.cmd.create('res_2', residues_2_obj)
# colors
pymol.cmd.color('lightblue', 'chain_1')
pymol.cmd.color('nitrogen', 'res_1')
pymol.cmd.color('yelloworange', 'chain_2')
pymol.cmd.color('red', 'res_2')
# representation type
pymol.cmd.show('cartoon', 'chain_1')
pymol.cmd.show('cartoon', 'chain_2')
pymol.cmd.show('surface', 'res_1')
pymol.cmd.show('surface', 'res_2')
# zoom
pymol.cmd.create('final', 'chain_1 or chain_2 or res_1 or res_2')
pymol.cmd.zoom('final')
# export
pymol.cmd.png(re.sub('.ent$', '.png', rel_path))
# quit
pymol.cmd.quit()
示例9: loadPymol
def loadPymol():
sys.path.append('/share/apps/pymol/1.6.0.0/lib/python')
import __main__
__main__.pymol_argv = [ 'pymol', '-c'] # Quiet and no GUI
import pymol
pymol.finish_launching()
cmd = pymol.cmd
util = pymol.util
return cmd, util
示例10: launchPyMol
def launchPyMol(self, pdbfile):
"""Open pdb in PyMOL"""
import pymol
# Call the function below before using any PyMOL modules.
pymol.finish_launching()
from pymol import cmd
cmd.load(pdbfile)
cmd.show_as('sticks')
return
示例11: renamechain
def renamechain(pdbfile,chainbefore,chainafter):
dirname=os.getcwd()+'/interface_analyzer/'+pdbfile
pdbfileselect=pdbfile.split('.')
print "rename the chain name of pdb i order to make antibody'chain is H ro L"
pymol.finish_launching()
pymol.cmd.load(dirname)
pymol.cmd.alter((chainbefore),chain=chainafter)
pymol.cmd.save(dirname,((pdbfileselect[0])))
pymol.cmd.delete('all')
pymol.cmd.quit()
print "rename name of chain has been done"
示例12: startPyMOL
def startPyMOL(pdb):
'''starts PyMOL for us. Only for testing. PyMOL should already be opened
by InteractiveROSETTA'''
import __main__
__main__.pymol_argv = ["pymol", "-qhxi"]
import pymol
pymol.finish_launching()
pymol.cmd.load(pdb)
pymol.cmd.show_as('cartoon')
pymol.cmd.color('purple')
return pymol
示例13: setup_pymol
def setup_pymol():
"""Sets up PyMOL for making animations."""
pymol.finish_launching() # Prevent threading errors
# Configure global settings
cmd.set('scene_buttons', 1)
cmd.set('matrix_mode', 1)
cmd.set('movie_panel', 1)
# Configure quality settings
cmd.mset("1 x500")
cmd.set('ray_trace_frames', 1)
cmd.viewport(800, 800)
示例14: removesolvent
def removesolvent(pdbfile):
dirname=os.getcwd()+'/interface_analyzer/pdbdata/'+pdbfile
pdbfileselect=pdbfile.split('.')
print "remove solvent for pdb"
pymol.finish_launching()
pymol.cmd.load(dirname)
pymol.cmd.remove('solvent')
pymol.cmd.select('target',pdbfileselect[0])
pymol.cmd.save(dirname,(('target')))
pymol.cmd.delete('all')
pymol.cmd.quit()
print "remove solvent done"
示例15: InitPymol
def InitPymol():
'''
setup pymol so that it works right and plays nice with this program
'''
import pymol
pymol.pymol_argv = ['pymol', '-q'] #c=command line (no gui), q=quiet (no messages)
pymol.finish_launching()
from pymol import cmd
for switchon in ['retain_order','pdb_no_end_record','cartoon_cylindrical_helices']: #'pdb_retain_ids',
cmd.set(switchon, 1)
for switchoff in ['pdb_use_ter_records']:
cmd.set(switchoff, 0)
cmd.show_as('cartoon')