Re: [PyMOL] Python script with iterate_state and selection command
Hi Pedro It does not work, the pymol crashes if I use this selection Stéphane -- Stéphane Abel, Ph.D. CEA Centre de Saclay DRF/JOLIOT/I2BC-S/SB2SM/LBMS Bat 528, Office 138C Gif-sur-Yvette, F-91191 FRANCE Phone (portable) : +33 6 49 37 70 60 De : Pedro Lacerda [pslace...@gmail.com] Envoyé : lundi 22 juin 2020 16:26 À : ABEL Stephane Cc : pymol-users Objet : Re: [PyMOL] Python script with iterate_state and selection command Hi, Not sure if I understood your code but maybe you want change Myselection to: Myselection="resname SOL within 3.5 of resname CHO" -- Pedro Lacerda Em seg, 22 de jun de 2020 10:44, ABEL Stephane mailto:stephane.a...@cea.fr>> escreveu: Hello all, I would like to write a basic python script to select residues for each state using the iterate_state and output the results first in pymol console window with the following format frame 1 : resid ... frame 2 : resid ... ... ### my script ## from pymol import cmd, stored mytraj="" mytraj2="" ## Load PDB cmd.load("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0ns.pdb"), mytraj ## Load XTC cmd.load_traj("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0_50ns_Every_0.5ns_TRANSLATED.xtc"), mytraj2 stored.resid = [] Myselection="select water_channel, resname SOL within 3.5 of resname CHO" nb_states=cmd.count_states(mytraj2)---> Contains 102 states print(mytraj2, nb_states) state=1 for i in range (nb_states) : print(i) cmd.iterate_state (i, (Myselection), 'resid.append(resv)') > Should to ireate for all the states print("frame " + str(i) + ":" + str(stored.residues)) ---> Print the results of the Myselection command in the console ### But the first problem I have is the syntax of the iterate_state. I obtain the following error "Selector-Error: Invalid selection name "select". ( select water_channel, resname SOL within 3.5 of resname CHO )<--" When I put this selection command directly in Pymol, it works and i can obtain the desired waters that was near 3.5 A of the CHO over all the states . So What is the correct syntax for the selection with "iterate_state" ? And how to output the results again for each state in the screen . Thanks in advance for your help Stéphane ___ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe ___ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
Re: [PyMOL] Python script with iterate_state and selection command
Hi, Not sure if I understood your code but maybe you want change Myselection to: Myselection="resname SOL within 3.5 of resname CHO" -- Pedro Lacerda Em seg, 22 de jun de 2020 10:44, ABEL Stephane escreveu: > Hello all, > > I would like to write a basic python script to select residues for each > state using the iterate_state and output the results first in pymol console > window with the following format > > frame 1 : resid ... > frame 2 : resid ... > ... > > ### my script ## > > from pymol import cmd, stored > > mytraj="" > mytraj2="" > > ## Load PDB > cmd.load("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0ns.pdb"), > mytraj > > ## Load XTC > cmd.load_traj("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0_50ns_Every_0.5ns_TRANSLATED.xtc"), > mytraj2 > > stored.resid = [] > > Myselection="select water_channel, resname SOL within 3.5 of resname CHO" > > nb_states=cmd.count_states(mytraj2)---> Contains 102 states > print(mytraj2, nb_states) > > state=1 > for i in range (nb_states) : > print(i) > cmd.iterate_state (i, (Myselection), 'resid.append(resv)') > > Should to ireate for all the states > print("frame " + str(i) + ":" + str(stored.residues)) ---> Print > the results of the Myselection command in the console > > ### > > But the first problem I have is the syntax of the iterate_state. I obtain > the following error > "Selector-Error: Invalid selection name "select". > ( select water_channel, resname SOL within 3.5 of resname CHO )<--" > > When I put this selection command directly in Pymol, it works and i can > obtain the desired waters that was near 3.5 A of the CHO over all the > states . So What is the correct syntax for the selection with > "iterate_state" ? And how to output the results again for each state in the > screen . > > Thanks in advance for your help > > Stéphane > > > ___ > PyMOL-users mailing list > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net > Unsubscribe: > https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe > ___ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
[PyMOL] Python script with iterate_state and selection command
Hello all, I would like to write a basic python script to select residues for each state using the iterate_state and output the results first in pymol console window with the following format frame 1 : resid ... frame 2 : resid ... ... ### my script ## from pymol import cmd, stored mytraj="" mytraj2="" ## Load PDB cmd.load("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0ns.pdb"), mytraj ## Load XTC cmd.load_traj("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0_50ns_Every_0.5ns_TRANSLATED.xtc"), mytraj2 stored.resid = [] Myselection="select water_channel, resname SOL within 3.5 of resname CHO" nb_states=cmd.count_states(mytraj2)---> Contains 102 states print(mytraj2, nb_states) state=1 for i in range (nb_states) : print(i) cmd.iterate_state (i, (Myselection), 'resid.append(resv)') > Should to ireate for all the states print("frame " + str(i) + ":" + str(stored.residues)) ---> Print the results of the Myselection command in the console ### But the first problem I have is the syntax of the iterate_state. I obtain the following error "Selector-Error: Invalid selection name "select". ( select water_channel, resname SOL within 3.5 of resname CHO )<--" When I put this selection command directly in Pymol, it works and i can obtain the desired waters that was near 3.5 A of the CHO over all the states . So What is the correct syntax for the selection with "iterate_state" ? And how to output the results again for each state in the screen . Thanks in advance for your help Stéphane ___ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
Re: [PyMOL] Install license file from CLI
Hi Antonio, Thanks for the diagnostics data. > I'm working with a virtual environment. Ah, that's the crux. I assume you've used something like `python3 -m venv --system-site-packages`. That happens to be not compatible with how PyMOL finds $PYMOL_PATH, it uses `sys.prefix` for that which now points to your virtual environment. Here some options which should all solve the issue: 1) Place the license file at $HOME/.pymol/license.lic 2) Export PYMOL_PATH=/home/my_user/pymol/share/pymol before importing the `pymol` module (can be done with `os.environ['PYMOL_PATH'] = ...` from your Python script). This option I would avoid if possible, better not to hard-code any paths in your script. 3) Use conda environments instead of venv. That's my preferred solution. . $HOME/pymol/bin/activate conda create -p $HOME/envs/dqn_pymol2 schrodinger::pymol conda activate $HOME/envs/dqn_pymol2 Cheers, Thomas -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. ___ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe
Re: [PyMOL] Install license file from CLI
This is the diagnostics log. Please keep reading at the end of the log: PyMOL(TM) 2.3.4 - Incentive Product Copyright (C) Schrodinger, LLC This Executable Build integrates and extends Open-Source PyMOL. Detected 40 CPU cores. Enabled multithreaded rendering. PyMOL>diagnostics PyMOL 2.3.4 build date: Wed Nov 6 20:04:05 2019 -0100 git sha: b5302154d05cd6c9f0ed78394d1ca2dcf91ebf8f conda build: py37h75f9260_0 file:///tmp/miniconda/conda-bld/linux-64 License Information: No License File - For Evaluation Only (0 days remaining) License Files: (no license file found) Operating System: Linux-4.4.0-178-generic-x86_64-with-debian-stretch-sid #208-Ubuntu SMP Sun Apr 5 23:45:10 UTC 2020 OpenGL Driver: (none) (none) (none) PyQt5 5.6 (Qt 5.6.2) Python: 3.7.5 (default, Oct 25 2019, 15:51:11) [GCC 7.3.0] prefix=/home/my_user/pymol executable=/home/my_user/pymol/bin/python filesystemencoding=utf-8 Startup Scripts: (no pymolrc file found) Qt, Python and PyMOL Environment Variables: LANG=es_ES.UTF-8 PYMOL_DATA=/home/my_user/pymol/share/pymol/data PYMOL_LICENSE_FILE= PYMOL_PATH=/home/my_user/pymol/share/pymol PYTHONEXECUTABLE=/home/my_user/pymol/bin/python PYTHONPATH=/home/my_user/envs/dqn_docking/RDKit:/home/my_user/envs/dqn_docking/lib:/home/my_user/envs/dqn_docking/local/lib:/home/my_user/envs/dqn_docking/bin/python:/home/my_user/miniconda3/bin/python PYTHONSTARTUP=/home/my_user/.startup.py QT_API=PyQt5 QT_QPA_PLATFORMTHEME=appmenu-qt5 QT_XKB_CONFIG_ROOT=/home/my_user/pymol/lib PATH: /home/my_user/pymol/bin:/home/my_user/envs/dqn_pymol/bin:/usr/local/MGLTools -1.5.6/bin:/home/my_user/miniconda3/bin:/home/my_user/projects/baselines/bas elines/deepq/mgltools/bin:/home/my_user/bin:/home/my_user/.local/bin:/usr/lo cal/MGLTools-1.5.6/bin:/home/my_user/miniconda3/bin/conda:/home/my_user/proj ects/baselines/baselines/deepq/mgltools/bin:/usr/local/sbin:/usr/local/bin:/us r/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk-11.0.5 /bin:/snap/bin:/usr/local/cuda/bin:/usr/local/cuda/bin Diagnostics collected on Fri Jun 19 18:33:16 2020 -0100 So, no license file was found. My PyMol is installed in $HOME/pymol/. So, I moved the license file to $HOME/pymol/share/pymol/license.lic . Then I ran the diagnostics again: PyMOL(TM) 2.3.4 - Incentive Product Copyright (C) Schrodinger, LLC This Executable Build integrates and extends Open-Source PyMOL. Detected 40 CPU cores. Enabled multithreaded rendering. PyMOL>diagnostics PyMOL 2.3.4 build date: Wed Nov 6 20:04:05 2019 -0100 git sha: b5302154d05cd6c9f0ed78394d1ca2dcf91ebf8f conda build: py37h75f9260_0 file:///tmp/miniconda/conda-bld/linux-64 License Information: PyMOL for educational use only Expiry date: 01-jan-2021 License Files: /home/my_user/pymol/share/pymol/license.lic Operating System: Linux-4.4.0-178-generic-x86_64-with-debian-stretch-sid #208-Ubuntu SMP Sun Apr 5 23:45:10 UTC 2020 OpenGL Driver:(none)(none)(none) PyQt5 5.6 (Qt 5.6.2) Python: 3.7.5 (default, Oct 25 2019, 15:51:11) [GCC 7.3.0] prefix=/home/my_user/pymol executable=/home/my_user/pymol/bin/python filesystemencoding=utf-8 Startup Scripts: (no pymolrc file found) Qt, Python and PyMOL Environment Variables: LANG=es_ES.UTF-8 PYMOL_DATA=/home/my_user/pymol/share/pymol/data PYMOL_LICENSE_FILE=/home/my_user/pymol/share/pymol/license.lic PYMOL_PATH=/home/my_user/pymol/share/pymol PYTHONEXECUTABLE=/home/my_user/pymol/bin/python PYTHONPATH=/home/my_user/envs/dqn_docking/RDKit:/home/my_user/envs/dqn_docking/lib:/home/my_user/envs/dqn_docking/local/lib:/home/my_user/envs/dqn_docking/bin/python:/home/my_user/miniconda3/bin/python PYTHONSTARTUP=/home/my_user/.startup.py QT_API=PyQt5 QT_QPA_PLATFORMTHEME=appmenu-qt5 QT_XKB_CONFIG_ROOT=/home/my_user/pymol/lib PATH: /home/my_user/pymol/bin:/home/my_user/envs/dqn_pymol/bin:/usr/local/MGLTools -1.5.6/bin:/home/my_user/miniconda3/bin:/home/my_user/projects/baselines/bas elines/deepq/mgltools/bin:/home/my_user/bin:/home/my_user/.local/bin:/usr/lo cal/MGLTools-1.5.6/bin:/home/my_user/miniconda3/bin/conda:/home/my_user/proj ects/baselines/baselines/deepq/mgltools/bin:/usr/local/sbin:/usr/local/bin:/us r/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk-11.0.5 /bin:/snap/bin:/usr/local/cuda/bin:/usr/local/cuda/bin Diagnostics collected on Fri Jun 19 18:46:42 2020 -0100 Now the license file is recognized. So, apparently this problem should be solved. But unfortunately the warning message persists. It should be noted that I'm calling pymol through the Python's API. I'm working with a virtual environment. I wonder if the problem is related to