Die Erklärung wird in der folgenden Umgebung gegeben. Linux: 3.13.0-37-generic #64-Ubuntu
Python 2.7.6
<module name>.path
>>> import pymol
>>> pymol.__path__
['/usr/lib/python2.7/dist-packages/pymol']
[hnishi@hn python_pymol]$ sudo apt-get install python-biopython
help(<module name>)
>>> import Bio
>>> help(Bio)
** Pymol -c **: Pymol nur mit CUI öffnen
cui_pymol.py
import pymol
pymol.pymol_argv = ['pymol','-c']
pymol.finish_launching()
pymol.cmd.fetch("4m61")
Ausgabeergebnis
[hnishi@hn python_pymol]$ python cui_pymol.py
PyMOL(TM) Molecular Graphics System, Version 1.7.0.0.
Copyright (c) Schrodinger, LLC.
All Rights Reserved.
Created by Warren L. DeLano, Ph.D.
PyMOL is user-supported open-source software. Although some versions
are freely available, PyMOL is not in the public domain.
If PyMOL is helpful in your work or study, then please volunteer
support for our ongoing efforts to create open and affordable scientific
software by purchasing a PyMOL Maintenance and/or Support subscription.
More information can be found at "http://www.pymol.org".
Enter "help" for a list of commands.
Enter "help <command-name>" for information on a specific command.
Hit ESC anytime to toggle between text and graphics.
Command mode. No graphics front end.
PyMOL: normal program termination.
Mit der Option pymol -q
können Sie die Versionsinformationen usw. ausblenden, die am Anfang des Protokolls angezeigt werden (Leise).
Für Optionen beim Starten von Pymol http://pymolwiki.org/index.php/Command_Line_Options Referenz
** pymol.cmd.iterate_state (\ <state >, \ <selection >, \ <expression >) **: Pymol-Funktion, Objektinformationen
iterate_state.py
#!/usr/bin/python2.7 -i
import sys, os
### pymol launching
import pymol
pymol.pymol_argv = ['pymol','-qc'] + sys.argv[1:]
pymol.finish_launching()
cmd = pymol.cmd
### read pdb
r = cmd.fetch("4m61","obj1")
print r
cmd.iterate_state(1, "obj1 and name CA and resi 3 and chai A", "print x,y,z") #print coordinates
Ausgabeergebnis
[hnishi@hn python_pymol]$ python iterate_state.py
obj1
9.97799968719 35.7999992371 20.9699993134
Das Rätsel, dass es 4 Stellen oder weniger gibt, obwohl der Wert in der PDB-Datei bis zu 3 Stellen beträgt.
Quelle cui_pymol.py https://gist.github.com/hnishi/3b9a3247a4bc356e17c7.js
gui_pymol.py
#!/usr/bin/env python
# Tell PyMOL we don't want any GUI features.
# It runs PyMol fullscreen stereo, and disables the internal gui.
import __main__
__main__.pymol_argv = [ 'pymol', '-qei' ] #$ pymol -qei
# Importing the PyMOL module will create the window.
import pymol
# Call the function below before using any PyMOL modules.
pymol.finish_launching()
[hnishi@hn python_pymol]$ python gui_pymol.py
Das Pymol-Fenster wird im Vollbildmodus gestartet.
Die interne GUI-Funktion ist ausgeschaltet. Stattdessen ist es leicht genug, um über das x-Fenster schleimig vom Server zu laufen.
dir(<something>)
python2.7
>>> import Bio
>>> print dir(Bio)
['BiopythonDeprecationWarning', 'BiopythonExperimentalWarning', 'BiopythonParserWarning', 'BiopythonWarning', 'MissingExternalDependencyError', 'MissingPythonDependencyError', '__builtins__', '__doc__', '__docformat__', '__file__', '__name__', '__package__', '__path__', '__version__']
from multiprocessing import Pool a = range(100) a p = Pool()
Wie schreibe ich ein Pymol-Skript? http://qiita.com/hnishi/items/e77b270ad1a6d574d6cc
Verwenden Sie Pymol aus Python http://pymolwiki.org/index.php/Launching_From_a_Script Objektinformationen in Pymol extrahieren http://www.pymolwiki.org/index.php/Simple_Scripting