Re: [PyMOL] Python script with iterate_state and selection command

2020-06-24 Thread ABEL Stephane
Thank you very much, 

It was very helpful since i did not find similar examples on the web that 
combine this directives 

Thanks again 

Stéphane
--

Envoyé : mardi 23 juin 2020 09:10
À : ABEL Stephane
Cc : Pedro Lacerda; pymol-users
Objet : Re: [PyMOL] Python script with iterate_state and selection command

Hi Stéphane,

Pedro is correct, you should change the selection like he suggested.

You also need to:
- Make a state specific selection with cmd.select(..., state=i)
- Adjust the loop to start at 1 and not at 0
- Use "stored.resid.append(resv)" as the expression

This should work:

###
from pymol import cmd, stored

objname = "mytraj"

cmd.load("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0ns.pdb",
 objname)
cmd.load_traj("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0_50ns_Every_0.5ns_TRANSLATED.xtc",
 objname)

nb_states = cmd.count_states(objname)

for i in range(1, nb_states + 1):
stored.resid = []
cmd.select("water_channel", "resn SOL within 3.5 of resn CHO", state=i)
cmd.iterate("water_channel", 'stored.resid.append(resv)')
print("frame " + str(i) + ":" + str(stored.residues))
###


Hope that helps.

Cheers,
  Thomas


> On Jun 22, 2020, at 4:52 PM, ABEL Stephane  wrote:
>
> 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

--
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] Python script with iterate_state and selection command

2020-06-23 Thread Thomas Holder
Hi Stéphane,

Pedro is correct, you should change the selection like he suggested.

You also need to:
- Make a state specific selection with cmd.select(..., state=i)
- Adjust the loop to start at 1 and not at 0
- Use "stored.resid.append(resv)" as the expression

This should work:

###
from pymol import cmd, stored

objname = "mytraj"

cmd.load("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0ns.pdb",
 objname)
cmd.load_traj("1JNO_GrA_DMPC_NACL_Membrane_TIP3P_SemiIso_rep3_Water_InChannel_0_50ns_Every_0.5ns_TRANSLATED.xtc",
 objname)

nb_states = cmd.count_states(objname)

for i in range(1, nb_states + 1):
stored.resid = []
cmd.select("water_channel", "resn SOL within 3.5 of resn CHO", state=i)
cmd.iterate("water_channel", 'stored.resid.append(resv)')
print("frame " + str(i) + ":" + str(stored.residues))
###


Hope that helps.

Cheers,
  Thomas


> On Jun 22, 2020, at 4:52 PM, ABEL Stephane  wrote:
> 
> 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

--
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] Python script with iterate_state and selection command

2020-06-22 Thread ABEL Stephane
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

2020-06-22 Thread Pedro Lacerda
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

2020-06-22 Thread ABEL Stephane
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] Python 2 support removed from master branch

2020-06-06 Thread Thomas Holder
To those who compile Open-Source PyMOL from the github repo:

We've removed Python 2 support from the master branch, the master branch now 
requires Python 3.6 or later.

There is a new "py2" branch which marks the last Python 2 compatible state. We 
have no plans to actively maintain this legacy branch, but we will accept pull 
requests with bug fixes.

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] How to best create a sliding window (a selection of specific residues) and compare specific residue names+numbers in pymol/python?

2019-03-27 Thread Thomas Holder
Hi Anne,

This is not at all an obvious question, it's quite advanced! Impressive code 
snippet for a newbie :-)

For the sliding window question, I suggest to have a look at the implementation 
of "local_rms" from the psico package:

https://github.com/speleo3/pymol-psico/blob/master/psico/fitting.py

Example usage:

import psico.fitting
fetch 1akeA, async=0
fetch 4akeA, async=0
local_rms 1akeA, 4akeA, window=5

It calculates the RMSD of the entire sliding window, not only one residue. And 
it only considers the C-alpha atoms (remove the "and guide" selector which is 
passed to Matchmaker to include all atoms).

My question would be: What does the RMSD of a single residue really tell you? 
The number will reflect something in between the fit of the sliding window and 
the sidechain conformation of the center residue. Are you interested in both? 
Or only one of them?

Cheers,
  Thomas


> On Feb 22, 2019, at 6:28 PM, Anne Nierobisch 
>  wrote:
> 
> Hi,
> 
> I need to calculate the RMSD for the same residue, e.g. 131Thr, from 2 pdb 
> files for the same target. As I need a local alignment, I use a sliding 
> window of 5 residues (the residue of interest is in the middle.)
> I have adapted the script from https://pymolwiki.org/index.php/RmsdByResidue 
> (also see below my code below) by adding a sliding window, but I need advice 
> on the following:
> 
> - I would need to check whether I am actually comparing the intended 
> residues, e.g. 131Thr, 131Thr, or whether the same residues (e.g. His, Asp, 
> His), with specific residue names and numbers   are in the selection I have 
> chosen from both pdb files for my sliding window. 
> The reason:
> I have coded up the script below, but often it skips and doesn't compare two 
> residues,  because the atom count is different between the residue from 
> protein A and protein B. 
> (It is exactly double the number, I have already checked and excluded 
> problems like occupancy and different conformations as potential causes.)
> 
> - I constructed a sliding window by selecting two residues before the residue 
> of interest and two residues which follow said residue. (I know that residues 
> can be missing, I am working on this.)
> Is there a better way for constructing a sliding window? I have not found 
> such a method in pymol.
> 
> For anyone interested, I have attached a code snipplet below.
> I am sorry, if these seem like obvious questions, but I tried various 
> approaches and I feel that I need a push in the right direction. I have the 
> feeling that I am missing something fundamental. 
> 
> Many thanks for any suggestion!
> Anne (Newbie in Pymol)
> 
> ##
> 
> Code snipplet (Python/Pymol interface):
>   referenceProteinChain = cmd.fetch(pbdstructure1)
>   targetProteinChain = cmd.fetch(pdbstructure2)
>   sel = referenceProteinChain
>   list_atoms = [[133, 133]] # example list, I want to calculate the rmsd 
> between residue 133 and residue 133 of two pdb structures
> 
> for j in list_atoms:
># I formulate my sliding window of 5 residues, my residue of interest is 
> in the middle
> ref_begin = int(j[0])-2
> ref_end = int(j[0])+2
> target_begin = int(j[1])-2
> target_end = int(j[1])+2
> 
> # I create a selection for the reference protein and the target protein 
> cmd.create("ref_gzt", referenceProteinChain+" and polymer and not alt B 
> and not Alt C and not alt D  and resi %s-%s" 
> cmd.alter("ref_gzt", "chain='A'")
> cmd.alter("ref_gzt", "segi=''")
> cmd.create("target_gzt", targetProteinChain+" and polymer and  not alt B 
> and not Alt C and not alt D  and resi %s-%s" %(target_begin,target_end) )
> cmd.alter("target_gzt", "chain='A'")
> cmd.alter("target_gzt", "segi=''")
> 
> # I align my selected 5 residues for a local alignment window
> cmd.align("target_gzt","ref_gzt",object="align", cycles =5) 
> 
> 
># select alpha carbon of in reference structure to loop over
> calpha=cmd.get_model(sel+" and name CA and not alt B and not Alt C and 
> not alt D  and resi %s-%s" %(ref_begin,ref_end) )
> 
>## here I loop over all residues in the sliding window and calculte the 
> rmsd for my residues of interest.
> for g in calpha.atom : I loop over the slinding window
> if g.resi == str(j[0]): ## we select only our residue of interest 
> within the sliding window
> if cmd.count_atoms("ref_gzt and polymer and resi 
> "+g.resi)==cmd.count_atoms("target_gzt and polymer and resi "+g.resi):
> 
> ## calculte the pairwise RMSD between the residues I 
> specified in list_atoms 
> rmsdRes=cmd.rms_cur("ref_gzt and polymer and resi 
> "+g.resi,"target_gzt and polymer and resi "+g.resi)

--
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://sourcefo

[PyMOL] How to best create a sliding window (a selection of specific residues) and compare specific residue names+numbers in pymol/python?

2019-02-22 Thread Anne Nierobisch
Hi,

I need to calculate the RMSD for the same residue, e.g. 131Thr, from 2 pdb 
files for the same target. As I need a local alignment, I use a sliding window 
of 5 residues (the residue of interest is in the middle.)
I have adapted the script from https://pymolwiki.org/index.php/RmsdByResidue 
(also see below my code below) by adding a sliding window, but I need advice on 
the following:

- I would need to check whether I am actually comparing the intended residues, 
e.g. 131Thr, 131Thr, or whether the same residues (e.g. His, Asp, His), with 
specific residue names and numbers   are in the selection I have chosen from 
both pdb files for my sliding window.
The reason:
I have coded up the script below, but often it skips and doesn't compare two 
residues,  because the atom count is different between the residue from protein 
A and protein B.
(It is exactly double the number, I have already checked and excluded problems 
like occupancy and different conformations as potential causes.)

- I constructed a sliding window by selecting two residues before the residue 
of interest and two residues which follow said residue. (I know that residues 
can be missing, I am working on this.)
Is there a better way for constructing a sliding window? I have not found such 
a method in pymol.

For anyone interested, I have attached a code snipplet below.
I am sorry, if these seem like obvious questions, but I tried various 
approaches and I feel that I need a push in the right direction. I have the 
feeling that I am missing something fundamental.

Many thanks for any suggestion!
Anne (Newbie in Pymol)

##


Code snipplet (Python/Pymol interface):

  referenceProteinChain = cmd.fetch(pbdstructure1)
  targetProteinChain = cmd.fetch(pdbstructure2)
  sel = referenceProteinChain
  list_atoms = [[133, 133]] # example list, I want to calculate the rmsd 
between residue 133 and residue 133 of two pdb structures

for j in list_atoms:
   # I formulate my sliding window of 5 residues, my residue of interest is in 
the middle
ref_begin = int(j[0])-2
ref_end = int(j[0])+2
target_begin = int(j[1])-2
target_end = int(j[1])+2

# I create a selection for the reference protein and the target protein
cmd.create("ref_gzt", referenceProteinChain+" and polymer and not alt B and 
not Alt C and not alt D  and resi %s-%s"
cmd.alter("ref_gzt", "chain='A'")
cmd.alter("ref_gzt", "segi=''")
cmd.create("target_gzt", targetProteinChain+" and polymer and  not alt B 
and not Alt C and not alt D  and resi %s-%s" %(target_begin,target_end) )
cmd.alter("target_gzt", "chain='A'")
cmd.alter("target_gzt", "segi=''")

# I align my selected 5 residues for a local alignment window
cmd.align("target_gzt","ref_gzt",object="align", cycles =5)


   # select alpha carbon of in reference structure to loop over
calpha=cmd.get_model(sel+" and name CA and not alt B and not Alt C and not 
alt D  and resi %s-%s" %(ref_begin,ref_end) )

   ## here I loop over all residues in the sliding window and calculte the rmsd 
for my residues of interest.
for g in calpha.atom : I loop over the slinding window
if g.resi == str(j[0]): ## we select only our residue of interest 
within the sliding window
if cmd.count_atoms("ref_gzt and polymer and resi 
"+g.resi)==cmd.count_atoms("target_gzt and polymer and resi "+g.resi):

## calculte the pairwise RMSD between the residues I specified 
in list_atoms
rmsdRes=cmd.rms_cur("ref_gzt and polymer and resi 
"+g.resi,"target_gzt and polymer and resi "+g.resi)

___
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 command to get b-factor and occupancy of a single atom?

2015-08-27 Thread Thomas Holder
Hi Dirk,

cmd.iterate is actually the most efficient function to access atom properties. 
If you want a wrapper which directly gets b and q for one atom, it could look 
like this (returns a dictionary):

from pymol import cmd
@cmd.extend
def get_signle_atom_props(selection, props=['b', 'q'], quiet=1):
if isinstance(props, basestring):
props = cmd.safe_list_eval(props)
expr = ','.join((repr(k) + ':' + k) for k in props)
expr = '_r.update({' + expr + '})'
r = {}
n = cmd.iterate(selection, expr, space={'_r': r})
if n > 1:
print ' Warning: selections spans more than one atom'
if not int(quiet):
print r
return r

You can use the "first" operator to limit your selection to one atom:
print get_single_atom_props('first polymer')

Cheers,
  Thomas

On 27 Aug 2015, at 06:27, Dirk Kostrewa  wrote:

> Dear PyMOLers,
> 
> I have trouble to find out, which command I could use in a python script 
> to get the b-factor and occupancy of a single atom.
> In the script library, I only found examples getting b-factors iterating 
> over a selection.
> Although, I could iterate over one atom, only, is there a more elegant 
> way of getting the b-factor and occupancy of a single atom?
> 
> Best regards,
> 
> Dirk.
> 
> -- 
> 
> ***
> Dirk Kostrewa
> Gene Center Munich, A5.07
> Department of Biochemistry
> Ludwig-Maximilians-Universität München
> Feodor-Lynen-Str. 25
> D-81377 Munich
> Germany
> Phone:  +49-89-2180-76845
> Fax:+49-89-2180-76999
> E-mail: kostr...@genzentrum.lmu.de
> WWW:www.genzentrum.lmu.de
> ***

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] python command to get b-factor and occupancy of a single atom?

2015-08-27 Thread Dirk Kostrewa
Dear PyMOLers,

I have trouble to find out, which command I could use in a python script 
to get the b-factor and occupancy of a single atom.
In the script library, I only found examples getting b-factors iterating 
over a selection.
Although, I could iterate over one atom, only, is there a more elegant 
way of getting the b-factor and occupancy of a single atom?

Best regards,

Dirk.

-- 

***
Dirk Kostrewa
Gene Center Munich, A5.07
Department of Biochemistry
Ludwig-Maximilians-Universität München
Feodor-Lynen-Str. 25
D-81377 Munich
Germany
Phone:  +49-89-2180-76845
Fax:+49-89-2180-76999
E-mail: kostr...@genzentrum.lmu.de
WWW:www.genzentrum.lmu.de
***


--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Python from PyMOL or PyMOL from Python?

2015-08-14 Thread David Hall
I vastly prefer calling the python program from pymol

You can call any python program using pymol as:


pymol -r program.py — arg1 arg2 arg3

Or, my full preferred method is:

pymol -qrck program.py — arg1 arg2 arg3


These make it quieter, stay on the command line, and not read the .pymolrc file

Other options at: http://www.pymolwiki.org/index.php/Command_Line_Options 



Why is this my preferred method?
Running python from pymol doesn’t require you to do any of these arcane things 
like call “finish_launching”, etc. You just write a python script and run it.



> On Aug 14, 2015, at 5:27 AM, Dirk Kostrewa  wrote:
> 
> Dear PyMOLers,
> 
> I want to modify atomic coordinates in a python program and make 
> pictures with PyMOL for making a movie.
> 
> In your experience, is it better to call the python program from PyMOL 
> or to call PyMOL from the python program?
> 
> And could you please give me any good pointer for your preferred method 
> (other than the simple scripting tutorial)?
> 
> Best regards,
> 
> Dirk.
> 
> -- 
> 
> ***
> Dirk Kostrewa
> Gene Center Munich, A5.07
> Department of Biochemistry
> Ludwig-Maximilians-Universität München
> Feodor-Lynen-Str. 25
> D-81377 Munich
> Germany
> Phone:  +49-89-2180-76845
> Fax:+49-89-2180-76999
> E-mail: kostr...@genzentrum.lmu.de
> WWW:www.genzentrum.lmu.de
> ***
> 
> 
> --
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] Python from PyMOL or PyMOL from Python?

2015-08-14 Thread Dirk Kostrewa
Dear PyMOLers,

I want to modify atomic coordinates in a python program and make 
pictures with PyMOL for making a movie.

In your experience, is it better to call the python program from PyMOL 
or to call PyMOL from the python program?

And could you please give me any good pointer for your preferred method 
(other than the simple scripting tutorial)?

Best regards,

Dirk.

-- 

***
Dirk Kostrewa
Gene Center Munich, A5.07
Department of Biochemistry
Ludwig-Maximilians-Universität München
Feodor-Lynen-Str. 25
D-81377 Munich
Germany
Phone:  +49-89-2180-76845
Fax:+49-89-2180-76999
E-mail: kostr...@genzentrum.lmu.de
WWW:www.genzentrum.lmu.de
***


--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] installing other libraries with pymol python

2015-06-23 Thread Thomas Holder
Hi Jordan,

I think there are no drawbacks, I'm using this version for several months now 
and it works great. Of course such a question is hard to answer a-priori, 
that's why we didn't simply replace the regular bundle but offer the 
"syspython" version in addition.

Cheers,
  Thomas

On 23 Jun 2015, at 18:04, Jordan Willis  wrote:

> Wow that is so cool. Is there any drawbacks I can expect?
> 
> 
>> On Jun 23, 2015, at 1:44 PM, Thomas Holder  
>> wrote:
>> 
>> Hi Jordan,
>> 
>> if you want to use MacPyMOL with other libraries then I recommend to use the 
>> "syspython" version that we offer (installer named 
>> MacPyMOL-v1.7.x.x-syspython.dmg). It simply does not bundle a Python 
>> distribution, but uses /usr/bin/python2.7 to run MacPyMOL.
>> 
>> Related:
>> https://sourceforge.net/p/pymol/mailman/message/33531659/
>> 
>> Cheers,
>> Thomas
>> 
>> On 21 Jun 2015, at 21:44, Jordan Willis  wrote:
>> 
>>> Hi,
>>> 
>>> I’m trying to use the pandas library with MacPymol 1.7.05 but get the 
>>> following with import pandas. 
>>> 
>>> File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in 
>>> 
>>>   from . import hashtable, tslib, lib
>>> File "numpy.pxd", line 157, in init pandas.hashtable 
>>> (pandas/hashtable.c:22315)
>>> ValueError: numpy.dtype has the wrong size, try recompiling
>>> 
>>> Obviously there is some conflict with PyMOLs python interpreter and the 
>>> interpreter I installed pandas with. That’s fine, I’ll just compile pandas 
>>> against PyMOLs python library, but I don’t know how to do it.
>>> 
>>> I used pip within pymol 
>>> 
>>> python
>>> import pip
>>> pip.main([‘install’,’pandas’,’—reinstall’])
>>> python end
>>> 
>>> 
>>> but got something wrong with the certificate in the pypy server
>>> 
>>> /Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL run on Sun Jun 21 
>>> 18:35:15 2015
>>> Getting page https://pypi.python.org/simple/pandas/
>>> Could not fetch URL https://pypi.python.org/simple/pandas/: connection 
>>> error: [Errno 1] _ssl.c:504: error:14090086:SSL 
>>> routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
>>> 
>>> . I thought before I dug too deep, I would check with the list to see if 
>>> anyone has added the pandas library that is compatible with pymol. Or more 
>>> generally, how would one install third party libraries for use with pymol. 
>>> If you don’t use pandas, I highly recommend it. It’s incredibly useful for 
>>> manipulating data and it would be very handy to have with pymol scrips.
>>> 
>>> Jordan

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.
--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] installing other libraries with pymol python

2015-06-23 Thread Jordan Willis
Wow that is so cool. Is there any drawbacks I can expect?


> On Jun 23, 2015, at 1:44 PM, Thomas Holder  
> wrote:
> 
> Hi Jordan,
> 
> if you want to use MacPyMOL with other libraries then I recommend to use the 
> "syspython" version that we offer (installer named 
> MacPyMOL-v1.7.x.x-syspython.dmg). It simply does not bundle a Python 
> distribution, but uses /usr/bin/python2.7 to run MacPyMOL.
> 
> Related:
> https://sourceforge.net/p/pymol/mailman/message/33531659/
> 
> Cheers,
>  Thomas
> 
> On 21 Jun 2015, at 21:44, Jordan Willis  wrote:
> 
>> Hi,
>> 
>> I’m trying to use the pandas library with MacPymol 1.7.05 but get the 
>> following with import pandas. 
>> 
>>  File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in 
>> 
>>from . import hashtable, tslib, lib
>>  File "numpy.pxd", line 157, in init pandas.hashtable 
>> (pandas/hashtable.c:22315)
>> ValueError: numpy.dtype has the wrong size, try recompiling
>> 
>> Obviously there is some conflict with PyMOLs python interpreter and the 
>> interpreter I installed pandas with. That’s fine, I’ll just compile pandas 
>> against PyMOLs python library, but I don’t know how to do it.
>> 
>> I used pip within pymol 
>> 
>> python
>> import pip
>> pip.main([‘install’,’pandas’,’—reinstall’])
>> python end
>> 
>> 
>> but got something wrong with the certificate in the pypy server
>> 
>> /Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL run on Sun Jun 21 
>> 18:35:15 2015
>> Getting page https://pypi.python.org/simple/pandas/
>> Could not fetch URL https://pypi.python.org/simple/pandas/: connection 
>> error: [Errno 1] _ssl.c:504: error:14090086:SSL 
>> routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
>> 
>> . I thought before I dug too deep, I would check with the list to see if 
>> anyone has added the pandas library that is compatible with pymol. Or more 
>> generally, how would one install third party libraries for use with pymol. 
>> If you don’t use pandas, I highly recommend it. It’s incredibly useful for 
>> manipulating data and it would be very handy to have with pymol scrips.
>> 
>> Jordan
> 
> -- 
> Thomas Holder
> PyMOL Principal Developer
> Schrödinger, Inc.
> 


--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] installing other libraries with pymol python

2015-06-23 Thread Thomas Holder
Hi Jordan,

if you want to use MacPyMOL with other libraries then I recommend to use the 
"syspython" version that we offer (installer named 
MacPyMOL-v1.7.x.x-syspython.dmg). It simply does not bundle a Python 
distribution, but uses /usr/bin/python2.7 to run MacPyMOL.

Related:
https://sourceforge.net/p/pymol/mailman/message/33531659/

Cheers,
  Thomas

On 21 Jun 2015, at 21:44, Jordan Willis  wrote:

> Hi,
> 
> I’m trying to use the pandas library with MacPymol 1.7.05 but get the 
> following with import pandas. 
> 
>   File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in 
> 
> from . import hashtable, tslib, lib
>   File "numpy.pxd", line 157, in init pandas.hashtable 
> (pandas/hashtable.c:22315)
> ValueError: numpy.dtype has the wrong size, try recompiling
> 
> Obviously there is some conflict with PyMOLs python interpreter and the 
> interpreter I installed pandas with. That’s fine, I’ll just compile pandas 
> against PyMOLs python library, but I don’t know how to do it.
> 
> I used pip within pymol 
> 
> python
> import pip
> pip.main([‘install’,’pandas’,’—reinstall’])
> python end
> 
> 
> but got something wrong with the certificate in the pypy server
> 
> /Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL run on Sun Jun 21 18:35:15 
> 2015
> Getting page https://pypi.python.org/simple/pandas/
> Could not fetch URL https://pypi.python.org/simple/pandas/: connection error: 
> [Errno 1] _ssl.c:504: error:14090086:SSL 
> routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
> 
> . I thought before I dug too deep, I would check with the list to see if 
> anyone has added the pandas library that is compatible with pymol. Or more 
> generally, how would one install third party libraries for use with pymol. If 
> you don’t use pandas, I highly recommend it. It’s incredibly useful for 
> manipulating data and it would be very handy to have with pymol scrips.
> 
> Jordan

-- 
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.


--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] installing other libraries with pymol python

2015-06-21 Thread Jordan Willis
Hi,

I’m trying to use the pandas library with MacPymol 1.7.05 but get the following 
with import pandas. 

  File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in 

from . import hashtable, tslib, lib
  File "numpy.pxd", line 157, in init pandas.hashtable 
(pandas/hashtable.c:22315)
ValueError: numpy.dtype has the wrong size, try recompiling

Obviously there is some conflict with PyMOLs python interpreter and the 
interpreter I installed pandas with. That’s fine, I’ll just compile pandas 
against PyMOLs python library, but I don’t know how to do it.

I used pip within pymol 

python
import pip
pip.main([‘install’,’pandas’,’—reinstall’])
python end


but got something wrong with the certificate in the pypy server

/Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL run on Sun Jun 21 18:35:15 
2015
Getting page https://pypi.python.org/simple/pandas/
Could not fetch URL https://pypi.python.org/simple/pandas/: connection error: 
[Errno 1] _ssl.c:504: error:14090086:SSL 
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

. I thought before I dug too deep, I would check with the list to see if anyone 
has added the pandas library that is compatible with pymol. Or more generally, 
how would one install third party libraries for use with pymol. If you don’t 
use pandas, I highly recommend it. It’s incredibly useful for manipulating data 
and it would be very handy to have with pymol scrips.

Jordan--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] Python 2.7.9 update on Windows 7, resultant PyMOL problems

2015-03-12 Thread Brenton Horne
Hi,

I updated Python from 2.7.8 to 2.7.9 via installing python(x,y) (i.e., 
the science/math software, 0.8GB size, downloaded from 
http://ftp.ntua.gr/pub/devel/pythonxy/Python(x,y)-2.7.9.0.exe) and now 
PyMOL (1.7.2.1, which was running just fine under 2.7.8) launches just 
the viewer giving this error: http://i.imgur.com/jxZe4Kl.png. Any ideas 
of how to overcome this error?

Thanks for your time,
Brenton

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] Pymol python 3.

2014-09-14 Thread Osvaldo Martin
Hi,

I just want to know if there have been some discussion about porting PyMOL
to python 3.

Osvaldo.
--
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] python script to define an extra pymol function and then use it during the same session

2014-09-02 Thread Matthew Baumgartner
Hi,
When you call cmd.extend(), it does not add the function to pymol.cmd. 
Just call it directly:

Change
  pymol.cmd.align_all_to_all()
to
align_all_to_all()

You may need to import it if you haven't already (and make sure it is in 
the PYTHONPATH).

HTH,
Matt Baumgartner


On 09/02/2014 10:38 AM, Jose Manuel Gally wrote:
> Dear Pymol mailing list,
>
> I am facing a problem with some python scripting involving pymol...
>
> I have a python script which adds a new function to pymol
> (align_all_to_all.py that I found on pymolwiki).
> I added some features to it so that it can load pdbs and thus automate
> the calculations.
>
> Whenever I run the script, I get this error:
> Traceback (most recent call last):
> File "calculateRMSD_04.py", line 145, in 
>   pymol.cmd.align_all_to_all()
> AttributeError: 'module' object has no attribute 'align_all_to_all'
>
> However, the align_all_to_all function is correctly added to pymol
> functions (autocompletion works in the displayed session).
> I guess the problem comes from how I call it in the script, but so far I
> couldn't figure what is the problem
>
> I am very new to both pymol and python, so any help would be much
> appreciated!
>
> Cheers,
> Jose Manuel
>
> Here is the relevent part of the script:
>  SCRIPT 
>   import __main__
> #__main__.pymol_argv = ['pymol','-cq'] # Pymol: quiet and no GUI
> import pymol, commented for debugging
>
> # Initialisation
>   import pymol
>   pymol.finish_launching()
>   pymol.cmd.extend('align_all_to_all',align_all_to_all)# add
> function into pymol commands
>
> # Load all pdbs listed in the input file
>   for pdb in list_pdb:
>   pdbfile =  path + pdb + ".pdb"
>   pymol.cmd.load(pdbfile, pdb)
>
> # Compute RMSD
>
>   pymol.cmd.align_all_to_all()
>   pymol.cmd.quit()
>
> --
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] python script to define an extra pymol function and then use it during the same session

2014-09-02 Thread Jose Manuel Gally
Dear Pymol mailing list,

I am facing a problem with some python scripting involving pymol...

I have a python script which adds a new function to pymol 
(align_all_to_all.py that I found on pymolwiki).
I added some features to it so that it can load pdbs and thus automate 
the calculations.

Whenever I run the script, I get this error:
Traceback (most recent call last):
   File "calculateRMSD_04.py", line 145, in 
 pymol.cmd.align_all_to_all()
AttributeError: 'module' object has no attribute 'align_all_to_all'

However, the align_all_to_all function is correctly added to pymol 
functions (autocompletion works in the displayed session).
I guess the problem comes from how I call it in the script, but so far I 
couldn't figure what is the problem

I am very new to both pymol and python, so any help would be much 
appreciated!

Cheers,
Jose Manuel

Here is the relevent part of the script:
 SCRIPT 
 import __main__
#__main__.pymol_argv = ['pymol','-cq'] # Pymol: quiet and no GUI
import pymol, commented for debugging

# Initialisation
 import pymol
 pymol.finish_launching()
 pymol.cmd.extend('align_all_to_all',align_all_to_all)# add 
function into pymol commands

# Load all pdbs listed in the input file
 for pdb in list_pdb:
 pdbfile =  path + pdb + ".pdb"
 pymol.cmd.load(pdbfile, pdb)

# Compute RMSD

 pymol.cmd.align_all_to_all()
 pymol.cmd.quit()

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] python scripting in pymol

2014-04-06 Thread Folmer Fredslund
Hi James,

On the pymol-wiki there is a script called findseq (
http://pymolwiki.org/index.php/Findseq)
That does what you want (or at least the first part of your request)

Best regards,
Folmer


2014-04-05 13:29 GMT+02:00 James Starlight :

> Dear PyMol users!
>
> I'm learning of the python scripting for the solution of typical
> structural bioinformatics problems. This time I'd like to integrate in
> pymol simple script which will search for the selected motifs (just several
> amino acids situated in adjacent positions along the sequence) and marked
> selection data assuming that I'm working with  ensemble of homologue
> proteins having common motifs. Could someone provide me with the example of
> such script included pymol syntax in code? During further steps I'd like to
> improve such script for searching  of motis situated in adjacent space
> position in 3D pdb structures but not in its sequences.
>
>
> Thanks for help,
>
>
> James
>
>
> --
>
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>



-- 
Folmer Fredslund
--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] python scripting in pymol

2014-04-05 Thread James Starlight
Dear PyMol users!

I'm learning of the python scripting for the solution of typical structural
bioinformatics problems. This time I'd like to integrate in pymol simple
script which will search for the selected motifs (just several amino acids
situated in adjacent positions along the sequence) and marked selection
data assuming that I'm working with  ensemble of homologue proteins having
common motifs. Could someone provide me with the example of such script
included pymol syntax in code? During further steps I'd like to improve
such script for searching  of motis situated in adjacent space position in
3D pdb structures but not in its sequences.


Thanks for help,


James
--
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] Basic Pymol/ Python syntax question

2013-08-27 Thread James Rutley
Hi,

This is a fairly basic question about syntax. How does one: as surface the
protein and pseudoatoms in the short script below? Moreover, and work with
the Lysine amines rather than the alpha carbons?

# for_gnp.py

# fetch a protein and create whole phage
cmd.fetch("1ifp", type="pdb1", multiplex=1, async=0)


# make a blank list
l=[]

# iterate over all lysine's alpha carbons
cmd.iterate_state(1, "n. CA and resn lys", "l.append((x,y,z))")

# set a counter to 0 for controlling unique names
p=0

# iterate over all coordinates and create a
# pseudoatom at each lysine's alpha carbon
for ca in l:
p+=1
cmd.pseudoatom("pseudo%s" % (p), pos=ca, vdw=5.0)

# measure the pairwise distances across all pseudoatoms just created
cmd.distance("/pseudo*", "/pseudo*")



Many thanks,
James
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] python module in pymol

2013-07-09 Thread Jérôme Pansanel
Dear Pascal,

Do you have any errors/warning when launching PyMOL?

If you fetch a structure in your PML file, be sure that the structure is
downloaded before to start the plugin (use: fetch pdb_code, async=0)

Can you send me some part of your PML file, so I can help you to debug?

Best regards,

Jerome Pansanel



Le mardi 09 juillet 2013 à 13:06 +0200, Pascal Auffinger a écrit :
> Hi,
> 
> 
> I tried to use the "cluster_count" script
> (http://www.pymolwiki.org/index.php/Cluster_Count)
> in a pymol.pml file. Unfortunately I get the following message:
> ---
> PyMOL>cluster_count PO4
> Traceback (most recent call last):
>   File "/home/sws2/Desktop/pymol/modules/pymol/parser.py", line 464,
> in parse
> exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
>   File "", line 1
> cluster_count PO4
>^
> SyntaxError: invalid syntax
> ---
> (PO4) is a selection of five atoms
> 
> 
> When I use the same script as a pymol plugin, it works fine
> when I type in the command "cluster_count PO4"
> 
> 
> Any idea ???
> 
> 
> Thanks for helping,
> 
> 
> Pascal
> 
> 
> 
> 
> 
> -
> Pascal Auffinger
> IBMC/CNRS
> 15 rue René Descartes
> 67084 Strasbourg Cedex
> 
> 
> p.auffin...@ibmc-cnrs.unistra.fr
> -
> 
> 
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___ PyMOL-users mailing list 
> (PyMOL-users@lists.sourceforge.net) Info Page: 
> https://lists.sourceforge.net/lists/listinfo/pymol-users Archives: 
> http://www.mail-archive.com/pymol-users@lists.sourceforge.net



--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] python module in pymol

2013-07-09 Thread Jason Vertrees
Hi Pascal,

PyMOL treats .pml and .py files differently. The "cluster_count"
script was written as a .py file as needs to be used as such.

run cluster_count.py

cluster_count PO4

worked just fine when run as a Python file.

Cheers,

-- Jason

On Tue, Jul 9, 2013 at 6:06 AM, Pascal Auffinger
 wrote:
> Hi,
>
> I tried to use the "cluster_count" script
> (http://www.pymolwiki.org/index.php/Cluster_Count)
> in a pymol.pml file. Unfortunately I get the following message:
> ---
> PyMOL>cluster_count PO4
> Traceback (most recent call last):
>   File "/home/sws2/Desktop/pymol/modules/pymol/parser.py", line 464, in
> parse
> exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
>   File "", line 1
> cluster_count PO4
>^
> SyntaxError: invalid syntax
> ---
> (PO4) is a selection of five atoms
>
> When I use the same script as a pymol plugin, it works fine
> when I type in the command "cluster_count PO4"
>
> Any idea ???
>
> Thanks for helping,
>
> Pascal
>
>
>
> -
> Pascal Auffinger
> IBMC/CNRS
> 15 rue René Descartes
> 67084 Strasbourg Cedex
>
> p.auffin...@ibmc-cnrs.unistra.fr
> -
>
>
> --
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net



-- 
Jason Vertrees, PhD
Director of Core Modeling Products
Schrödinger, Inc.

(e) jason.vertr...@schrodinger.com
(o) +1 (603) 374-7120

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] python module in pymol

2013-07-09 Thread Pascal Auffinger
Hi,

I tried to use the "cluster_count" script 
(http://www.pymolwiki.org/index.php/Cluster_Count)
in a pymol.pml file. Unfortunately I get the following message:
---
PyMOL>cluster_count PO4
Traceback (most recent call last):
  File "/home/sws2/Desktop/pymol/modules/pymol/parser.py", line 464, in parse
exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
  File "", line 1
cluster_count PO4
   ^
SyntaxError: invalid syntax
---
(PO4) is a selection of five atoms

When I use the same script as a pymol plugin, it works fine
when I type in the command "cluster_count PO4"

Any idea ???

Thanks for helping,

Pascal



-
Pascal Auffinger
IBMC/CNRS
15 rue René Descartes
67084 Strasbourg Cedex

p.auffin...@ibmc-cnrs.unistra.fr
-

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Convert pml script to Pymol Python script

2011-04-09 Thread Thomas Holder
it's on the wiki now:
http://pymolwiki.org/index.php/Pml2py

Cheers,
   Thomas

Thomas Holder wrote, On 04/09/11 11:17:
> Michael Lerner wrote, On 04/08/11 20:16:
>> It's not elegant at all, but it's worth knowing that you can use 
>> cmd.do("...") as a quick fix for lines that aren't immediately easy to 
>> convert.
>>
>> Even a mostly-working pml2py tool would be a useful addition to the wiki.
> 
> mostly-working script attached, have fun!
> 
> Cheers,
>   Thomas

-- 
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen

--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] Convert pml script to Pymol Python script

2011-04-09 Thread Thomas Holder

Michael Lerner wrote, On 04/08/11 20:16:
It's not elegant at all, but it's worth knowing that you can use 
cmd.do("...") as a quick fix for lines that aren't immediately easy to 
convert.


Even a mostly-working pml2py tool would be a useful addition to the wiki.


mostly-working script attached, have fun!

Cheers,
  Thomas

--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen
'''
http://sourceforge.net/mailarchive/message.php?msg_id=27331786
Subject: [PyMOL] Convert pml script to Pymol Python script
Date: Fri, 8 Apr 2011 18:01:32 +0100
'''

import sys
from pymol import cmd

def pml2py(filename, out=sys.stdout):
	'''
DESCRIPTION

Convert a pml script to python syntax.

USAGE

pml2py infile [, outfile]

TODO

comments, aliases
	'''
	if isinstance(out, basestring):
		out = open(out, 'w')
	print >> out, '''
# automatically converted from '%s'
import pymol
from pymol import *
''' % (filename)
	handle = open(filename)
	for line in handle:
		a = line.split(None, 1)
		try:
			name = a[0]
			name = cmd.kwhash.shortcut.get(name, name)
			assert name in cmd.keyword
			func = cmd.keyword[name][0]
			assert func.func_name != 'python_help'
		except:
			out.write(line)
			continue
		if len(a) > 1:
			args = [i.strip() for i in a[1].split(',')]
		else:
			args = []

		if name == 'python':
			for line in handle:
if line.split() == ['python', 'end']:
	break
out.write(line)
			continue

		print >> out, '%s.%s(%s)' % (func.__module__, func.func_name, ', '.join(map(repr, args)))

cmd.extend('pml2py', pml2py)
--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Convert pml script to Pymol Python script

2011-04-09 Thread Thomas Holder
Jason Vertrees wrote, On 04/08/11 20:09:
> Hi Matthias,
> 
> There is no script that I'm aware of, but writing one should be rather
> straightforward because of how the API is organized:
> 
> commandName arg1, arg2, arg3
> 
> becomes
> 
> cmd.commandName(arg1, arg2, arg3)

I would use the cmd.keyword dictionary for the translation, I thinks not 
all commands have the exact same name in PyMOl API.

Also pml scripts can contain python code which must not be translated.

> The hardest part would be determining when to quote strings versus not
> quoting numbers and variables.

It should be save to just quote everything.

Cheers,
   Thomas

--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] Convert pml script to Pymol Python script

2011-04-08 Thread Michael Lerner
It's not elegant at all, but it's worth knowing that you can use
cmd.do("...") as a quick fix for lines that aren't immediately easy to
convert.

Even a mostly-working pml2py tool would be a useful addition to the wiki.

Cheers,

-Michael

On Fri, Apr 8, 2011 at 2:09 PM, Jason Vertrees <
jason.vertr...@schrodinger.com> wrote:

> Hi Matthias,
>
> There is no script that I'm aware of, but writing one should be rather
> straightforward because of how the API is organized:
>
> commandName arg1, arg2, arg3
>
> becomes
>
> cmd.commandName(arg1, arg2, arg3)
>
> The hardest part would be determining when to quote strings versus not
> quoting numbers and variables.  You might be able to reflect against
> the API for a more robust script
> (http://diveintopython.org/power_of_introspection/index.html).  Java's
> great at that, not sure about Python.  Good luck.
>
> Cheers,
>
> -- Jason
>
>
> On Fri, Apr 8, 2011 at 1:01 PM, Matthias Schmidt
>  wrote:
> > Hi,
> >
> > I have a few pml scripts for pymol that I would like to rewrite
> > properly in python, making use of Pymol's ability to interprete Python
> > scripts.
> >
> > Do you know of an interpreter that converts pml scripts automatically
> > to python scripts for Pymol? Since the number of tasks that you can do
> > in pml is finite, this should be possible, or not?
> >
> > Best,
> >
> > Matthias
> >
> > --
> > Structural Bioinformatics and Computational Biochemistry Unit
> > Dept. of Biochemistry
> > University of Oxford
> > South Parks Road
> > Oxford
> > OX1 3QU
> > U.K.
> >
> > Telephone: 01865 613304
> > Fax: 01865 613238
> >
> >
> --
> > Xperia(TM) PLAY
> > It's a major breakthrough. An authentic gaming
> > smartphone on the nation's most reliable network.
> > And it wants your games.
> > http://p.sf.net/sfu/verizon-sfdev
> > ___
> > PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> > Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> > Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> >
>
>
>
> --
> Jason Vertrees, PhD
> PyMOL Product Manager
> Schrodinger, LLC
>
> (e) jason.vertr...@schrodinger.com
> (o) +1 (603) 374-7120
>
>
> --
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>



-- 
Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)
--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Re: [PyMOL] Convert pml script to Pymol Python script

2011-04-08 Thread Jason Vertrees
Hi Matthias,

There is no script that I'm aware of, but writing one should be rather
straightforward because of how the API is organized:

commandName arg1, arg2, arg3

becomes

cmd.commandName(arg1, arg2, arg3)

The hardest part would be determining when to quote strings versus not
quoting numbers and variables.  You might be able to reflect against
the API for a more robust script
(http://diveintopython.org/power_of_introspection/index.html).  Java's
great at that, not sure about Python.  Good luck.

Cheers,

-- Jason


On Fri, Apr 8, 2011 at 1:01 PM, Matthias Schmidt
 wrote:
> Hi,
>
> I have a few pml scripts for pymol that I would like to rewrite
> properly in python, making use of Pymol's ability to interprete Python
> scripts.
>
> Do you know of an interpreter that converts pml scripts automatically
> to python scripts for Pymol? Since the number of tasks that you can do
> in pml is finite, this should be possible, or not?
>
> Best,
>
> Matthias
>
> --
> Structural Bioinformatics and Computational Biochemistry Unit
> Dept. of Biochemistry
> University of Oxford
> South Parks Road
> Oxford
> OX1 3QU
> U.K.
>
> Telephone: 01865 613304
> Fax: 01865 613238
>
> --
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
>



-- 
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC

(e) jason.vertr...@schrodinger.com
(o) +1 (603) 374-7120

--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] Convert pml script to Pymol Python script

2011-04-08 Thread Matthias Schmidt
Hi,

I have a few pml scripts for pymol that I would like to rewrite
properly in python, making use of Pymol's ability to interprete Python
scripts.

Do you know of an interpreter that converts pml scripts automatically
to python scripts for Pymol? Since the number of tasks that you can do
in pml is finite, this should be possible, or not?

Best,

Matthias

-- 
Structural Bioinformatics and Computational Biochemistry Unit
Dept. of Biochemistry
University of Oxford
South Parks Road
Oxford
OX1 3QU
U.K.

Telephone: 01865 613304
Fax: 01865 613238

--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] python

2010-07-12 Thread Robert Campbell
On Mon, 12 Jul 2010 10:37:07 -0400 Vivek Ranjan  wrote:

> Hello,
> 
> How can I find out what version of python my current installation of
> pymol is using ?

One way is simply to type "python" in a terminal window and you should see
something like:

Python 2.6.5+ (release26-maint, Jul  1 2010, 00:47:18) 
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Or type "python -V" to see just the version. So I'm running version 2.6.5.

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821Fax: 613-533-2497
http://pldserver1.biochem.queensu.ca/~rlc

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] python

2010-07-12 Thread Schubert, Carsten [PRDUS]
import sys
print sys.version


> -Original Message-
> From: Vivek Ranjan [mailto:vran...@gmail.com]
> Sent: Monday, July 12, 2010 10:37 AM
> To: Pymol
> Subject: [PyMOL] python
> 
> Hello,
> 
> How can I find out what version of python my current installation of
> pymol is using ?
> 
> --
> Thank you and Regards,
> 
> Vivek Ranjan
> 
>
---
> ---
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> ___
> PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
> Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
> Archives:
http://www.mail-archive.com/pymol-users@lists.sourceforge.net


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] python

2010-07-12 Thread Vivek Ranjan
Hello,

How can I find out what version of python my current installation of
pymol is using ?

-- 
Thank you and Regards,

Vivek Ranjan

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] Python Function with Unlimited Positional Arguments

2009-08-02 Thread Warren DeLano
Sean,

You need a keyword argument list as well, so that the effective PyMOL
class instance (_self) can be passed in by keyword (actual use of _self
is only strictly required when you have multiple PyMOLs active in a
single Python interpreter).

# pml input:

python
 
def my_fn(*arg, **kwd):
   print arg

cmd.extend("my_fn", my_fn)

python end

my_fn my_arg_1, my_arg_2

# PyMOL output:

('my_arg_1', 'my_arg_2') 

Cheers,
Warren



From: Sean Law [mailto:magic...@hotmail.com] 
Sent: Sunday, August 02, 2009 10:56 AM
To: pymol-users@lists.sourceforge.net
    Subject: [PyMOL] Python Function with Unlimited Positional
Arguments


Hi PyMOLers,

I am trying to write a python script that will allow a user to
provide an unlimited number of positional arguments for a function.  I
am use to the following scheme for defining a function and its
arguments:

def some_function ( x, y, z, file="false"):

#DO SOMETHING

return

Where x, y, and z are required arguments and "file=false" is an
optional argument.  I came across the following page pertaining to
Python:


http://www.linuxtopia.org/online_books/programming_books/python_programm
ing/python_ch15s09.html

See "Unlimited Number of Positional Arguments Values"

There it explains that one could use the following syntax:

def some_function ( *args):

print arg[0]

return

Now, when put this in a script and call the function in PyMOL it
spits out the following error:

Traceback (most recent call last):
  File "/pymol/./modules/pymol/parser.py", line 254, in parse
self.result=apply(layer.kw[0],layer.args,layer.kw_args)
TypeError: some_function() got an unexpected keyword argument
'_self'

Is the "*args" method simply not possible in PyMOL?  I tried
using "**args" which worked nicely for keyword arguments.

Any help would be greatly appreciated.  Thank you for your time.

Sean




Stay on top of things, check email from other accounts! Check it
out. <http://go.microsoft.com/?linkid=9671350>  



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


[PyMOL] Python Function with Unlimited Positional Arguments

2009-08-02 Thread Sean Law

Hi PyMOLers,

I am trying to write a python script that will allow a user to provide an 
unlimited number of positional arguments for a function.  I am use to the 
following scheme for defining a function and its arguments:

def some_function ( x, y, z, file="false"):

#DO SOMETHING

return

Where x, y, and z are required arguments and "file=false" is an optional 
argument.  I came across the following page pertaining to Python:

http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch15s09.html

See "Unlimited Number of Positional Arguments Values"

There it explains that one could use the following syntax:

def some_function ( *args):

print arg[0]

return

Now, when put this in a script and call the function in PyMOL it spits out the 
following error:

Traceback (most recent call last):
  File "/pymol/./modules/pymol/parser.py", line 254, in parse
self.result=apply(layer.kw[0],layer.args,layer.kw_args)
TypeError: some_function() got an unexpected keyword argument '_self'

Is the "*args" method simply not possible in PyMOL?  I tried using "**args" 
which worked nicely for keyword arguments.

Any help would be greatly appreciated.  Thank you for your time.

Sean

_
Stay on top of things, check email from other accounts!
http://go.microsoft.com/?linkid=9671355--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

[PyMOL] python library versions for pymol binary distributions

2008-08-26 Thread Matthew O'Meara
Hi I'm making a Plugin that uses SWIG python bindings.

I would like to distribute it in such a way that people who use
pre-compiled versions of PyMOL will be able to use it.

However, the python.h and python libraries PyMOL was compiled with and
the python.h and python libraries that the bindings are compiled with
must be compatible.

The best solution that I can think of is that somehow the python.h and
python libraries are distributed with PyMOL--but this may not work for
a variety of reasons.

An alternate solution might be someone can tell me which which version
the pre-compiled versions of PyMOL are compiled with and I can try to
get ahold of the same version of python myself.

Are there any other solutions you can think of?

Thanks,
Matt



Re: [PyMOL] python/pymol malfunction on new Ubuntu installation

2008-07-22 Thread Daniel Rigden
Warren

Thanks for that.  That's rather what I expected/feared.

I'd still be delighted to hear from anyone who may understand why Python
isn't working straight out of the box.

Best wishes

Daniel


On Tue, 2008-07-22 at 09:04 -0700, Warren DeLano wrote:
> Daniel,
> 
> This kind of complexity illustrates why we distribute standalone binaries for 
> Linux which include their own Python interpreter.  In short, there is simply 
> too much heterogenaiety present in the 7+ years worth of deployed Linux 
> distribution / version / package-manager combinations for us to be able to 
> support any one of them individually.
> 
> So to use PyMOL with a system-provided Python on Linux, our recommended 
> approach is to build from the open-source code using the distutils method 
> (python setup.py build install; python setup2.py install; ./pymol).  
> 
> However, in this case, it sounds like your system-provided Python may not 
> itself be working, so you may need to work with the Unbuntu folks to 
> straighten that out first.  I can assure you that until "python" or 
> "python2.5" alone just works with no errors, there is little chance of PyMOL 
> building or running correctly.
> 
> Cheers,
> Warren
> 
> -Original Message-
> From: pymol-users-boun...@lists.sourceforge.net 
> [mailto:pymol-users-boun...@lists.sourceforge.net] On Behalf Of Daniel Rigden
> Sent: Tuesday, July 22, 2008 8:25 AM
> To: DeLano Scientific
> Cc: pymol-users@lists.sourceforge.net
> Subject: Re: [PyMOL] python/pymol malfunction on new Ubuntu installation
> 
> Warren
> 
> Thanks for the quick reply.  I tried what you suggested but I get the same 
> error.
> 
> How can I check how the path has been configured?  It seems as if there is 
> only one python so there shouldn't be scope for confusion; I can only find 
> one site.py, for example, in
> 
> /usr/lib/python2.5/site.py
> 
> [I'm assuming /usr/lib64/python2.5/site.py is a link]
> 
> On the other hand, in Synaptic, I see
> 
> python
> python2.5
> python2.5-minimal
> 
> all separately listed and installed, which I don;t really understand.
> The Installed version of python is 2.5.2-0ubuntu1, while for the others it's 
> 2.5.2-2ubuntu4.  
> 
> Thanks again
> 
> Daniel
> 
> On Tue, 2008-07-22 at 07:59 -0700, DeLano Scientific wrote:
> > Daniel,
> > 
> > Any time you see the "import site failed" error from Python, you can infer 
> > that there is a problem with the Python interpreter being unable to access 
> > its required libraries.  Messages after that aren't typically informative.
> > 
> > This usually a path configuration issue, but I think it can also happen 
> > when there is a version mismatch betweehn the executable the libraries 
> > (running python 2.5 executables against 2.4 libraries or vice versa).
> > 
> > If using the system-provided Python, you shouldn't have to set PYTHON_HOME 
> > since it will have been compiled in by default.  Try the following in a new 
> > shell:
> > 
> > export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
> > python2.5 ${PYMOL_PATH}/__init__.py
> > 
> > Cheers,
> > Warren
> > --
> > DeLano Scientific LLC
> > Subscriber Support Services
> > mailto:supp...@delsci.com
> > 
> > 
> > -Original Message-
> > From: pymol-users-boun...@lists.sourceforge.net 
> > [mailto:pymol-users-boun...@lists.sourceforge.net] On Behalf Of Daniel 
> > Rigden
> > Sent: Tuesday, July 22, 2008 7:39 AM
> > To: pymol-users@lists.sourceforge.net
> > Subject: [PyMOL] python/pymol malfunction on new Ubuntu installation
> > 
> > Dear all
> > 
> > First let me confess that my problem does not just involved pymol.
> > However, it is hampering my use of pymol amongst other things and there 
> > must be many python experts who read this list.
> > 
> > My problem, on a completely fresh Ubuntu 8.04 install, is that python 
> > can find modules when asked to import them.  So
> > 
> > export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
> > export PYTHONHOME=/usr/lib/python2.5
> > python2.5 ${PYMOL_PATH}/__init__.py
> > 
> > gives me
> > 
> > 'import site' failed; use -v for traceback Traceback (most recent call 
> > last):
> >   File "/var/lib/python-support/python2.5/pymol//__init__.py", line 109, in 
> > 
> > import threading
> > ImportError: No module named threading
> > 
> > 
> > /usr/lib/python2.5 contains site.py, threading.py and all the rest.
> > 
> > 

Re: [PyMOL] python/pymol malfunction on new Ubuntu installation

2008-07-22 Thread Daniel Rigden
Warren

Thanks for the quick reply.  I tried what you suggested but I get the
same error.

How can I check how the path has been configured?  It seems as if there
is only one python so there shouldn't be scope for confusion; I can only
find one site.py, for example, in

/usr/lib/python2.5/site.py

[I'm assuming /usr/lib64/python2.5/site.py is a link]

On the other hand, in Synaptic, I see

python
python2.5
python2.5-minimal

all separately listed and installed, which I don;t really understand.
The Installed version of python is 2.5.2-0ubuntu1, while for the others
it's 2.5.2-2ubuntu4.  

Thanks again

Daniel

On Tue, 2008-07-22 at 07:59 -0700, DeLano Scientific wrote:
> Daniel,
> 
> Any time you see the "import site failed" error from Python, you can infer 
> that there is a problem with the Python interpreter being unable to access 
> its required libraries.  Messages after that aren't typically informative.
> 
> This usually a path configuration issue, but I think it can also happen when 
> there is a version mismatch betweehn the executable the libraries (running 
> python 2.5 executables against 2.4 libraries or vice versa).
> 
> If using the system-provided Python, you shouldn't have to set PYTHON_HOME 
> since it will have been compiled in by default.  Try the following in a new 
> shell:
> 
> export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
> python2.5 ${PYMOL_PATH}/__init__.py
> 
> Cheers,
> Warren
> --
> DeLano Scientific LLC
> Subscriber Support Services
> mailto:supp...@delsci.com
> 
> 
> -Original Message-
> From: pymol-users-boun...@lists.sourceforge.net 
> [mailto:pymol-users-boun...@lists.sourceforge.net] On Behalf Of Daniel Rigden
> Sent: Tuesday, July 22, 2008 7:39 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] python/pymol malfunction on new Ubuntu installation
> 
> Dear all
> 
> First let me confess that my problem does not just involved pymol.
> However, it is hampering my use of pymol amongst other things and there must 
> be many python experts who read this list.
> 
> My problem, on a completely fresh Ubuntu 8.04 install, is that python can 
> find modules when asked to import them.  So
> 
> export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
> export PYTHONHOME=/usr/lib/python2.5
> python2.5 ${PYMOL_PATH}/__init__.py
> 
> gives me
> 
> 'import site' failed; use -v for traceback Traceback (most recent call last):
>   File "/var/lib/python-support/python2.5/pymol//__init__.py", line 109, in 
> 
> import threading
> ImportError: No module named threading
> 
> 
> /usr/lib/python2.5 contains site.py, threading.py and all the rest.
> 
> 
> Can anyone help?  I'd be very grateful.
> 
> Daniel
> 
-- 
Dr Daniel John Rigden Tel:(+44) 151 795 4467
School of Biological Sciences FAX:(+44) 151 795 4406
Room 101, Biosciences Building
University of Liverpool
Crown St.,
Liverpool L69 7ZB, U.K.




Re: [PyMOL] python/pymol malfunction on new Ubuntu installation

2008-07-22 Thread Daniel Rigden
Michael

Like I said, the problem is not pymol-specific; no modules can be found
even when explicitly pointing PYTHONHOME to them.

Pymol0.99 off the website works fine since it comes packaged with its
own python modules.  The one I'd like to get to work is a 1.0rc2
obtained from synaptic.  It locates itself in /usr/bin/pymol and looks
like this

#!/bin/sh
# debian wrapper script for pymol

export PYMOL_DATA=/usr/share/pymol
export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
export CHEMPY_DATA=/usr/share/chempy

python2.5 ${PYMOL_PATH}/__init__.py $*


Thanks for your help

Daniel


On Tue, 2008-07-22 at 16:54 +0200, Michael Banck wrote:
> On Tue, Jul 22, 2008 at 03:38:53PM +0100, Daniel Rigden wrote:
> > First let me confess that my problem does not just involved pymol.
> > However, it is hampering my use of pymol amongst other things and there
> > must be many python experts who read this list.
> > 
> > My problem, on a completely fresh Ubuntu 8.04 install, is that python
> > can find modules when asked to import them.  So
> 
> Are you saying python cannot find any modules?  In that case, the
> problem does not sound pymol specific at all.
>  
> > export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
> > export PYTHONHOME=/usr/lib/python2.5
> > python2.5 ${PYMOL_PATH}/__init__.py
> > 
> > gives me
> > 
> > 'import site' failed; use -v for traceback
> > Traceback (most recent call last):
> >   File "/var/lib/python-support/python2.5/pymol//__init__.py", line 109,
> > in 
> > import threading 
> > ImportError: No module named threading
> 
> Are you running the Ubuntu pymol package, or a self-compiled one?  If
> the former, does simply running "pymol" work or not?
> 
> 
> Michael
-- 
Dr Daniel John Rigden Tel:(+44) 151 795 4467
School of Biological Sciences FAX:(+44) 151 795 4406
Room 101, Biosciences Building
University of Liverpool
Crown St.,
Liverpool L69 7ZB, U.K.




Re: [PyMOL] python/pymol malfunction on new Ubuntu installation

2008-07-22 Thread DeLano Scientific
Daniel,

Any time you see the "import site failed" error from Python, you can infer that 
there is a problem with the Python interpreter being unable to access its 
required libraries.  Messages after that aren't typically informative.

This usually a path configuration issue, but I think it can also happen when 
there is a version mismatch betweehn the executable the libraries (running 
python 2.5 executables against 2.4 libraries or vice versa).

If using the system-provided Python, you shouldn't have to set PYTHON_HOME 
since it will have been compiled in by default.  Try the following in a new 
shell:

export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
python2.5 ${PYMOL_PATH}/__init__.py

Cheers,
Warren
--
DeLano Scientific LLC
Subscriber Support Services
mailto:supp...@delsci.com


-Original Message-
From: pymol-users-boun...@lists.sourceforge.net 
[mailto:pymol-users-boun...@lists.sourceforge.net] On Behalf Of Daniel Rigden
Sent: Tuesday, July 22, 2008 7:39 AM
To: pymol-users@lists.sourceforge.net
Subject: [PyMOL] python/pymol malfunction on new Ubuntu installation

Dear all

First let me confess that my problem does not just involved pymol.
However, it is hampering my use of pymol amongst other things and there must be 
many python experts who read this list.

My problem, on a completely fresh Ubuntu 8.04 install, is that python can find 
modules when asked to import them.  So

export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
export PYTHONHOME=/usr/lib/python2.5
python2.5 ${PYMOL_PATH}/__init__.py

gives me

'import site' failed; use -v for traceback Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/pymol//__init__.py", line 109, in 

import threading
ImportError: No module named threading


/usr/lib/python2.5 contains site.py, threading.py and all the rest.


Can anyone help?  I'd be very grateful.

Daniel

-- 
Dr Daniel John Rigden Tel:(+44) 151 795 4467
School of Biological Sciences FAX:(+44) 151 795 4406
Room 101, Biosciences Building
University of Liverpool
Crown St.,
Liverpool L69 7ZB, U.K.


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users




Re: [PyMOL] python/pymol malfunction on new Ubuntu installation

2008-07-22 Thread Michael Banck
On Tue, Jul 22, 2008 at 03:38:53PM +0100, Daniel Rigden wrote:
> First let me confess that my problem does not just involved pymol.
> However, it is hampering my use of pymol amongst other things and there
> must be many python experts who read this list.
> 
> My problem, on a completely fresh Ubuntu 8.04 install, is that python
> can find modules when asked to import them.  So

Are you saying python cannot find any modules?  In that case, the
problem does not sound pymol specific at all.
 
> export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
> export PYTHONHOME=/usr/lib/python2.5
> python2.5 ${PYMOL_PATH}/__init__.py
> 
> gives me
> 
> 'import site' failed; use -v for traceback
> Traceback (most recent call last):
>   File "/var/lib/python-support/python2.5/pymol//__init__.py", line 109,
> in 
> import threading 
> ImportError: No module named threading

Are you running the Ubuntu pymol package, or a self-compiled one?  If
the former, does simply running "pymol" work or not?


Michael



[PyMOL] python/pymol malfunction on new Ubuntu installation

2008-07-22 Thread Daniel Rigden
Dear all

First let me confess that my problem does not just involved pymol.
However, it is hampering my use of pymol amongst other things and there
must be many python experts who read this list.

My problem, on a completely fresh Ubuntu 8.04 install, is that python
can find modules when asked to import them.  So

export PYMOL_PATH=/var/lib/python-support/python2.5/pymol/
export PYTHONHOME=/usr/lib/python2.5
python2.5 ${PYMOL_PATH}/__init__.py

gives me

'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/pymol//__init__.py", line 109,
in 
import threading 
ImportError: No module named threading


/usr/lib/python2.5 contains site.py, threading.py and all the rest.


Can anyone help?  I'd be very grateful.

Daniel

-- 
Dr Daniel John Rigden Tel:(+44) 151 795 4467
School of Biological Sciences FAX:(+44) 151 795 4406
Room 101, Biosciences Building
University of Liverpool
Crown St.,
Liverpool L69 7ZB, U.K.




[PyMOL] python traceback from apbs plugin

2008-06-25 Thread Justin Lecher

Hi all,
I am using the latest svn version of Pymol with python 2.5.2. Now I get
following traceback when clicking the set grid button of the apbs plugin:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/pmg_tk/__init__.py", line 35,
in run
PMGApp(pymol_instance,skin).run(poll)
  File "/usr/lib/python2.5/site-packages/pmg_tk/PMGApp.py", line 170, 
in run

self.root.mainloop()
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1023, in mainloop
self.tk.mainloop(n)
  File "/usr/lib/python2.5/site-packages/Pmw/Pmw_1_2/lib/PmwBase.py",
line 1751, in __call__
_reporterror(self.func, args)
  File "/usr/lib/python2.5/site-packages/Pmw/Pmw_1_2/lib/PmwBase.py",
line 1777, in _reporterror
msg = exc_type + ' Exception in Tk callback\n'
TypeError: unsupported operand type(s) for +: 'type' and 'str'


I am not that familiar with python, so that I couldn't figure out where
it comes from.

Thanks for help,
jusitn



--
Justin Lecher
Institute for  Neuroscience and Biophysics
INB 2 - Molecular Biophysics II
Research centre Juelich GmbH,
52425 Juelich,Germany
phone: +49 2461 61 5385




signature.asc
Description: OpenPGP digital signature


Re: [PyMOL] python for loop with pymol command usage

2007-07-04 Thread Robert Campbell
Hi Louis,

* Clark, Louis  [2007-07-04 12:01] wrote:
> Dear user-group,
> 
>   I'm trying to learn how to use python commands inside pymol .pml
> scripts.  I seem to be missing some understanding about how the
> interface works.  Could somebody tell me how to fix this command below?
> 
>  
> 
> PyMOL>for x in range(10): cmd.label("(name ca and resi %d)" % x, "%s%s" 
> 
> PyMOL>% (resi, resn))
> 
> Traceback (most recent call last):
> 
>   File "/usr/local/pymol/modules/pymol/parser.py", line 232, in parse
> 
> exec(com2[nest]+"\n",pymol_names,pymol_names)
> 
>   File "", line 1, in ?
> 
> NameError: name 'resi' is not defined

You need quotes around the label expression '"%s%s" % (resi, resn)':

for x in range(10): cmd.label("(name ca and resi %d)" % x, '"%s%s" % (resi, 
resn)')

The expression has to be passed to pymol as a string to be interpreted
correctly.

Cheers,
Rob
-- 
Robert L. Campbell, Ph.D.
Senior Research Associate/Adjunct Assistant Professor 
Botterell Hall Rm 644
Department of Biochemistry, Queen's University, 
Kingston, ON K7L 3N6  Canada
Tel: 613-533-6821Fax: 613-533-2497
http://pldserver1.biochem.queensu.ca/~rlc



Re: [PyMOL] python for loop with pymol command usage

2007-07-04 Thread gilleain torrance

Hmmm.

With a little messing around, it seems that this works at the pymol prompt:

for x in range(10): cmd.label("(name ca and resi %d)" % x, '"%s%s\" %
(resi, resn)')

The only difference is in the quoting. Double quotes inside single quotes.

gilleain

On 7/4/07, Clark, Louis  wrote:





Dear user-group,

  I'm trying to learn how to use python commands inside pymol .pml scripts.
I seem to be missing some understanding about how the interface works.
Could somebody tell me how to fix this command below?



PyMOL>for x in range(10): cmd.label("(name ca and resi %d)" % x, "%s%s"

PyMOL>% (resi, resn))

Traceback (most recent call last):

  File "/usr/local/pymol/modules/pymol/parser.py", line
232, in parse

exec(com2[nest]+"\n",pymol_names,pymol_names)

  File "", line 1, in ?

NameError: name 'resi' is not defined



thanks much!!



-Louis



Louis Clark, Ph.D.

louis.cl...@codexis.com


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users






[PyMOL] python for loop with pymol command usage

2007-07-04 Thread Clark, Louis
Dear user-group,

  I'm trying to learn how to use python commands inside pymol .pml
scripts.  I seem to be missing some understanding about how the
interface works.  Could somebody tell me how to fix this command below?

 

PyMOL>for x in range(10): cmd.label("(name ca and resi %d)" % x, "%s%s" 

PyMOL>% (resi, resn))

Traceback (most recent call last):

  File "/usr/local/pymol/modules/pymol/parser.py", line 232, in parse

exec(com2[nest]+"\n",pymol_names,pymol_names)

  File "", line 1, in ?

NameError: name 'resi' is not defined

 

thanks much!!

 

-Louis

 

Louis Clark, Ph.D.

louis.cl...@codexis.com  

 



[PyMOL] python libraries for surface visualization

2007-02-21 Thread Giacomo Bastianelli
Dear PyMol users,
 
I would like to use PyMol classes for surface visualization.
Any idea where to find them?
 
Thanks,
Giacomo


[PyMOL] Python extension module for reading O files

2006-09-11 Thread Morten Kjeldgaard
Python programmers, who wish to extract information from O files, may 
find the OdbParser module useful. The module reads both binary and 
formatted O files, and is very simple to use. Try it! Simply import the 
module, and use the get() method:


$ python
Python 2.3.4 (#1, Mar 10 2006, 06:12:09)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import odbparser
>>> db = odbparser.get("binary.o")

Now you have the O database as a Python dictionary 'db', with the 
datablock names as keys. For example, print out some information on the 
di-peptide from Baton:


>>> print db["di_atom_name"]
('N', 'CA', 'C', 'O', 'CB', 'N', 'CA', 'C', 'O', 'CB')
>>> print x["di_residue_type"]
('ALA', 'ALA')

Go to http://www.bioxray.dk/~mok/odbparser for information about 
download, installation, etc.


Cheers,
Morten

--
Morten Kjeldgaard, Asc. professor, Ph.D.
Department of Molecular Biology, Aarhus University
Gustav Wieds Vej 10 C, DK-8000 Aarhus C, Denmark
Lab +45 89425026 * Mobile +45 51860147 * Fax +45 86123178
Home +45 86188180 * http://www.bioxray.dk/~mok




RE: [PyMOL] Python scripting for Pymol

2006-01-08 Thread Jerome Pansanel
Hi,

pymol.cmd.refresh() doesn't work when the function is placed before
cmd.png(), but works when placed after.
As cmd.refresh() is much faster than time.sleep(1), the script is now
quicker (I used this function to get the 2D pictures from a sdf file
containing less than 100 structures).

here is now the corrected script :
def mol2png(ctfile,name):
pymol.cmd.read_molstr(ctfile,name)
pymol.cmd.set("valence",1)
pymol.cmd.hide("all")
pymol.cmd.show("sticks")
pymol.cmd.set("stick_radius",1)
pymol.cmd.color("black","elem c")
pymol.cmd.color("red","elem o")
pymol.cmd.color("blue","elem n")
pymol.cmd.color("yellow","elem s")
pymol.cmd.bg_color("white")
pymol.cmd.zoom(name)
pymol.cmd.ray()
pymol.cmd.png(name)
pymol.cmd.refresh()
pymol.cmd.delete(name)

Works fine with a Centrino (1.6GHz) laptop and Linux Debian (sarge).

Thanks,

Jerome Pansanel


Selon Warren DeLano :

> Jerome,
> 
> Try calling 
> 
>pymol.cmd.refresh()
> 
> before 
> 
>pymol.cmd.png(name)
> 
> Cheers,
> Warren
> 
> --
> Warren L. DeLano, Ph.D. 
> Principal Scientist
> 
> . DeLano Scientific LLC  
> . 400 Oyster Point Blvd., Suite 213   
> . South San Francisco, CA 94080 USA   
> . Biz:(650)-872-0942  Tech:(650)-872-0834 
> . Fax:(650)-872-0273  Cell:(650)-346-1154
> . mailto:war...@delsci.com  
>  
> 
> > -Original Message-
> > From: pymol-users-ad...@lists.sourceforge.net 
> > [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of 
> > Jerome PANSANEL
> > Sent: Friday, January 06, 2006 5:06 AM
> > To: pymol-users@lists.sourceforge.net
> > Subject: [PyMOL] Python scripting for Pymol
> > 
> > Hi,
> > 
> > I writing a small script in python, in order to export png 
> > picture from a MDL sdfile.
> > Here is a sample of the function :
> > 
> > def mol2png(ctfile,name):
> > pymol.cmd.read_molstr(ctfile,name)
> > pymol.cmd.set("valence",1)
> > pymol.cmd.color("black","elem c")
> > pymol.cmd.color("red","elem o")
> > pymol.cmd.color("blue","elem n")
> > pymol.cmd.color("yellow","elem s")
> > pymol.cmd.bg_color("white")
> > pymol.cmd.zoom(name)
> > pymol.cmd.png(name)
> > time.sleep( 1 )
> > pymol.cmd.delete(name)
> > 
> > 
> > It works fine only if I have the function time.sleep(1). If 
> > not, I have only empty pictures. Is there another solution to 
> > delete the molecule only when the png file has been written ?
> > 
> > Thanks,
> > 
> > Jerome Pansanel
> > 
> > 
> > 
> > ---
> > This SF.net email is sponsored by: Splunk Inc. Do you grep 
> > through log files for problems?  Stop!  Download the new AJAX 
> > search engine that makes searching your log files as easy as 
> > surfing the  web.  DOWNLOAD SPLUNK!
> > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> > ___
> > PyMOL-users mailing list
> > PyMOL-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/pymol-users
> > 
> > 
> > 
> > 
> 





Mail sent through IMP: http://horde.org/imp/



RE: [PyMOL] Python scripting for Pymol

2006-01-06 Thread Warren DeLano
Jerome,

Try calling 

   pymol.cmd.refresh()

before 

   pymol.cmd.png(name)

Cheers,
Warren

--
Warren L. DeLano, Ph.D. 
Principal Scientist

. DeLano Scientific LLC  
. 400 Oyster Point Blvd., Suite 213   
. South San Francisco, CA 94080 USA   
. Biz:(650)-872-0942  Tech:(650)-872-0834 
. Fax:(650)-872-0273  Cell:(650)-346-1154
. mailto:war...@delsci.com  
 

> -Original Message-
> From: pymol-users-ad...@lists.sourceforge.net 
> [mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of 
> Jerome PANSANEL
> Sent: Friday, January 06, 2006 5:06 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] Python scripting for Pymol
> 
> Hi,
> 
> I writing a small script in python, in order to export png 
> picture from a MDL sdfile.
> Here is a sample of the function :
> 
> def mol2png(ctfile,name):
> pymol.cmd.read_molstr(ctfile,name)
> pymol.cmd.set("valence",1)
> pymol.cmd.color("black","elem c")
> pymol.cmd.color("red","elem o")
> pymol.cmd.color("blue","elem n")
> pymol.cmd.color("yellow","elem s")
> pymol.cmd.bg_color("white")
> pymol.cmd.zoom(name)
> pymol.cmd.png(name)
> time.sleep( 1 )
> pymol.cmd.delete(name)
> 
> 
> It works fine only if I have the function time.sleep(1). If 
> not, I have only empty pictures. Is there another solution to 
> delete the molecule only when the png file has been written ?
> 
> Thanks,
> 
> Jerome Pansanel
> 
> 
> 
> ---
> This SF.net email is sponsored by: Splunk Inc. Do you grep 
> through log files for problems?  Stop!  Download the new AJAX 
> search engine that makes searching your log files as easy as 
> surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> ___
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
> 
> 
> 
> 



Re: [PyMOL] Python scripting for Pymol

2006-01-06 Thread gilleain torrance
Hi,

I tried a similar, but simpler, example :

def mol2png(name):
cmd.png(name)
cmd.delete(name)

called as 'mol2png("1a2pA")', given that I have an object called "1a2pA"
loaded.

It works just fine on my laptop (mac).

Odd.

gilleain torrance

On 1/6/06, Jerome PANSANEL  wrote:
>
> Hi,
>
> I writing a small script in python, in order to export png picture from a
> MDL
> sdfile.
> Here is a sample of the function :
>
> def mol2png(ctfile,name):
> pymol.cmd.read_molstr(ctfile,name)
> pymol.cmd.set("valence",1)
> pymol.cmd.color("black","elem c")
> pymol.cmd.color("red","elem o")
> pymol.cmd.color("blue","elem n")
> pymol.cmd.color("yellow","elem s")
> pymol.cmd.bg_color("white")
> pymol.cmd.zoom(name)
> pymol.cmd.png(name)
> time.sleep( 1 )
> pymol.cmd.delete(name)
>
>
> It works fine only if I have the function time.sleep(1). If not, I have
> only
> empty pictures. Is there another solution to delete the molecule only when
> the png file has been written ?
>
> Thanks,
>
> Jerome Pansanel
>
>
>
> ---
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> ___
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users
>


[PyMOL] Python scripting for Pymol

2006-01-06 Thread Jerome PANSANEL
Hi,

I writing a small script in python, in order to export png picture from a MDL
sdfile.
Here is a sample of the function :

def mol2png(ctfile,name):
pymol.cmd.read_molstr(ctfile,name)
pymol.cmd.set("valence",1)
pymol.cmd.color("black","elem c")
pymol.cmd.color("red","elem o")
pymol.cmd.color("blue","elem n")
pymol.cmd.color("yellow","elem s")
pymol.cmd.bg_color("white")
pymol.cmd.zoom(name)
pymol.cmd.png(name)
time.sleep( 1 )
pymol.cmd.delete(name)


It works fine only if I have the function time.sleep(1). If not, I have only
empty pictures. Is there another solution to delete the molecule only when
the png file has been written ?

Thanks,

Jerome Pansanel




[PyMOL] python script question

2004-10-28 Thread Scott Classen

Hello PyMol gurus,

I am trying to make a simple movie with my molecule rotating 360 
degrees. There are two molecules superimposed and one of them is turned 
on for 6 frames then off for 6 frames. Hopefully this won't give anyone 
epileptic seizures. So here is a part of my python script. The problem 
is that "sok" is only turning off once every 12 frames for a single 
frame. Can someone correct this script?

Thanks,
Scott


mset 1 x360
for a in range(1,6): cmd.mdo(a,"turn y,1;show cartoon,sok")
for a in range(7,12): cmd.mdo(a,"turn y,1;hide cartoon,sok")
for a in range(13,18): cmd.mdo(a,"turn y,1;show cartoon,sok")
for a in range(19,24): cmd.mdo(a,"turn y,1;hide cartoon,sok")
for a in range(25,30): cmd.mdo(a,"turn y,1;show cartoon,sok")
for a in range(31,36): cmd.mdo(a,"turn y,1;hide cartoon,sok")
for a in range(37,42): cmd.mdo(a,"turn y,1;show cartoon,sok")
for a in range(43,48): cmd.mdo(a,"turn y,1;hide cartoon,sok")
...
...




RE: [PyMOL] Python commands and variables

2003-08-27 Thread Warren L. DeLano
Yes, but you need to write in Python directly.  For example:

from pymol import cmd
cmd.select("mysel","none")
for i in range(10,20): cmd.select("mysel","mysel or resi %d"%i)

Would work in a ".py" file.

Cheers,
Warren

--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020

> -Original Message-
> From: pymol-users-ad...@lists.sourceforge.net [mailto:pymol-users-
> ad...@lists.sourceforge.net] On Behalf Of Shu-Hsien Sheu
> Sent: Wednesday, August 27, 2003 1:10 PM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] Python commands and variables
> 
> Hi,
> 
> I am new to Pymol with some experiences with Python.
> I have a basic question which maybe a little stupid.
> Does Pymal take Python commands in selecting atoms?
> For instance:
> 
> i = range(1, 299)
> select resi i
> 
> or, further:
> for i in range(1, 299)
> select  resi i
> 
> I understand the above can be easily done with:
> select resi 1-288
> 
> However, I am wondering if variables can work in Pymol in general.
> 
> Thanks!
> 
> 
> 
> 
> 
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users




[PyMOL] Python commands and variables

2003-08-27 Thread Shu-Hsien Sheu
Hi, 

I am new to Pymol with some experiences with Python.
I have a basic question which maybe a little stupid.
Does Pymal take Python commands in selecting atoms?
For instance:

i = range(1, 299)
select resi i

or, further:
for i in range(1, 299)
select  resi i

I understand the above can be easily done with:
select resi 1-288

However, I am wondering if variables can work in Pymol in general.

Thanks!






Re: [PyMOL] python as a satellite virus

2003-04-30 Thread Terry M. Gray

At 10:50 AM -0700 4/30/03, wgsc...@chemistry.ucsc.edu wrote:
Coincidently that was the exact same program that hosed my python 
installation too.



I had set up my computer to run the python based AutoDock Tools
interface to the docking program AutoDock. The installer for this
program puts its own copy of python as a subdirectory in the main
application directory and adds some environment variables to the
.cshrc file. Apparently, some variable created here affected other
python based apps. When I commented these out and opened a new xterm
and ran pymol, everything worked normally.


Moreover, my attempts to re-engineer the AutoDock installation ended 
in a complete morass.  This is a great reason for installation 
software to at least allow you the option of using your already 
installed system python.


Here's what I told my students. It seemed like a reasonable solution.

_

It appears that the problem was introduced by the installation of 
ADT. The ADT installer puts some lines in your .cshrc file that 
prevents pymol from working properly.  So here is a solution that 
worked for me.


Take out the ADT lines and put them into a separate text file--say 
call it "ADTenv.csh". If you open a new xterm, pymol should not work 
properly.


If you want to run ADT, open a new xterm and "source ADTenv.csh" (no 
quotes). Then run "adt" (no quotes) from this window.

_

Although I didn't try it, I assume that you can't run pymol from that 
xterm once you've run the ADTenv.csh script.


TG
--
_
Terry M. Gray, Ph.D., Computer Support Scientist
Chemistry Department, Colorado State University
Fort Collins, Colorado  80523
gr...@lamar.colostate.edu  http://www.chm.colostate.edu/~grayt/
phone: 970-491-7003 fax: 970-491-1801



[PyMOL] python as a satellite virus

2003-04-30 Thread wgscott
Coincidently that was the exact same program that hosed my python 
installation too.



I had set up my computer to run the python based AutoDock Tools
interface to the docking program AutoDock. The installer for this
program puts its own copy of python as a subdirectory in the main
application directory and adds some environment variables to the
.cshrc file. Apparently, some variable created here affected other
python based apps. When I commented these out and opened a new xterm
and ran pymol, everything worked normally.


Moreover, my attempts to re-engineer the AutoDock installation ended in 
a complete morass.  This is a great reason for installation software to 
at least allow you the option of using your already installed system 
python.