Re: [PyMOL] hydrogen bond list for a series of files

2020-06-17 Thread Robert Campbell
Hi,

I would make one minor change to your script -- the command "run list_hb.py" 
needs to be run only once at the beginning of the script so:

# multiple_hb.py
from pymol import cmd
from glob import glob
cmd.do("run list_hb.py")

for file in glob("model.000.*.pdb"):
print(file)
#file_list = [f'{m:02d}'  for m in  list(range(0,30,1))]
cmd.load(file)
obj=cmd.get_object_list('all')
print(obj)
#chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
cmd.do("list_hb chain F, chain A:E,
write_distances_file=hb_"+str(obj[0])+".txt") cmd.delete("all”)

Cheers,
Rob

On Tue, 2020-06-16 20:23  +,  "Chen, Qiang"  wrote:

> This script will have a memory issue. My pymol will stuck if I have
> more than 3 files be processed. file_list = [f'{m:02d}'  for m in
> list(range(1,30,1))] [cmd.do("load
> model.000."+str(k)+"_minimized.pdb") for k in file_list]
> object_list=cmd.get_object_list('(model.000.*_minimized)')
> chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')] run
> C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
> [cmd.do("list_hb chain F, chain A:E,
> write_distances_file=hb_"+str(file)+".txt") for file in object_list ]
> 
> I modified from the sample script here
> 
> https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pymolwiki.org%2Findex.php%2FProcess_All_Files_In_Directorydata=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764004254sdata=p5tXmvSD1QCS%2BdIXyJv58rEBk9GCIRtl8BFSnamwoNs%3Dreserved=0
> 
> Save the following lines in a file named as, eg. multiple_hb.py and
> make sure list_hb.py in the working directory of searching directory.
> 
> Then run multiple_hb.py in the pymol command line.
> 
> from pymol import cmd
> from glob import glob
> 
> for file in glob("model.000.*.pdb"):
> print(file)
> #file_list = [f'{m:02d}'  for m in  list(range(0,30,1))]
> cmd.load(file)
> obj=cmd.get_object_list('all')
> print(obj)
> #chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
> cmd.do("run list_hb.py")
> cmd.do("list_hb chain F, chain A:E,
> write_distances_file=hb_"+str(obj[0])+".txt") cmd.delete("all”)
> 
> 
> On Jun 16, 2020, at 11:15 AM,
> pymol-users-requ...@lists.sourceforge.net<mailto:pymol-users-requ...@lists.sourceforge.net>
> wrote:
> 
> Send PyMOL-users mailing list submissions to
> pymol-users@lists.sourceforge.net<mailto:pymol-users@lists.sourceforge.net>
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fpymol-usersdata=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764004254sdata=9UIjcsPwiUC9PmwQ4mcTi1%2F4%2BIGx9jQKarXsh7dfpGk%3Dreserved=0
> or, via email, send a message with subject or body 'help' to
> pymol-users-requ...@lists.sourceforge.net
> 
> You can reach the person managing the list at
> pymol-users-ow...@lists.sourceforge.net
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PyMOL-users digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: hydrogen bond list for a series of files
>  (Mooers, Blaine H.M.  (HSC))
>   2. Re: hydrogen bond list for a series of files (Chen, Qiang)
> 
> 
> --
> 
> Message: 1
> Date: Tue, 16 Jun 2020 14:51:38 +
> From: "Mooers, Blaine H.M.  (HSC)" 
> To: "Chen, Qiang" , "pymol-users@lists.sourceforge.net"
> 
> Subject: Re: [PyMOL] hydrogen bond list for a series of files
> Message-ID:
> <87dcc6c40b22804192b6892e6429ec5fdbefd...@countach.hsc.net.ou.edu>
> Content-Type: text/plain; charset="Windows-1252"
> 
> Hi Charlie,
> 
> This will give the desired list.
> 
> file_list = [f'{m:02d}'  for m in  list(range(1,30,1))]
> print(file_list)
> 
> Best regards,
> 
> Blaine
> 
> Blaine Mooers, Ph.D.
> Associate Professor
> Department of Biochemistry and Molecular Biology
> College of Medicine
> University of Oklahoma Health Sciences Center
> S.L. Young Biomedical Research Center (BRC) Rm. 466
> 975 NE 10th Street, BRC 466
> Oklahoma City, OK 73104-5419
> 
> 
> From: Chen, Qiang [q...@pitt.edu]
> Sent: Tuesday, June 16, 2020 9:26 AM
> To: Mooers, Blaine H.M.  (HSC); pymol-users@lists.sourceforge.net
> Subject: [EXTERNAL] Re: hy

Re: [PyMOL] hydrogen bond list for a series of files

2020-06-16 Thread Mooers, Blaine H.M. (HSC)
Hi Charles,

Great job! Your code works lightning fast in my hands on 10 files.
Sometimes simple for loops beat complicated list comprehensions. 

Note for those that are following this thread, 
all of the lines below the line staring with 'for' need to be indented 4 spaces.

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419


From: Chen, Qiang [q...@pitt.edu]
Sent: Tuesday, June 16, 2020 3:23 PM
To: pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] hydrogen bond list for a series of files

This script will have a memory issue. My pymol will stuck if I have more than 3 
files be processed.
file_list = [f'{m:02d}'  for m in  list(range(1,30,1))]
[cmd.do("load model.000."+str(k)+"_minimized.pdb") for k in file_list]
object_list=cmd.get_object_list('(model.000.*_minimized)')
chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in object_list ]

I modified from the sample script here

https://www.pymolwiki.org/index.php/Process_All_Files_In_Directory<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.pymolwiki.org_index.php_Process-5FAll-5FFiles-5FIn-5FDirectory=DwMGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=oMPpjfMZ6UhM7G_hl2D769S7iBpeJl_H__qcbbVNjdc=plXR0rM1RxGNiFceh4zwKCmYVRvBuNA-55ZtLitQ2Y0=>

Save the following lines in a file named as, eg. 
multiple_hb.py<https://urldefense.proofpoint.com/v2/url?u=http-3A__multiple-5Fhb.py=DwQGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=oMPpjfMZ6UhM7G_hl2D769S7iBpeJl_H__qcbbVNjdc=3bErPOJ2H0Xw7ySEdeILwH8fJnY-2CNsLgrLaJdBgAQ=>
 and make sure 
list_hb.py<https://urldefense.proofpoint.com/v2/url?u=http-3A__list-5Fhb.py=DwQGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=oMPpjfMZ6UhM7G_hl2D769S7iBpeJl_H__qcbbVNjdc=CnFcZDPs5_473MLmU6NxGndfSqYfJX0HxHJD8PXkCDw=>
 in the working directory of searching directory.

Then run 
multiple_hb.py<https://urldefense.proofpoint.com/v2/url?u=http-3A__multiple-5Fhb.py=DwQGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=oMPpjfMZ6UhM7G_hl2D769S7iBpeJl_H__qcbbVNjdc=3bErPOJ2H0Xw7ySEdeILwH8fJnY-2CNsLgrLaJdBgAQ=>
 in the pymol command line.

from pymol import cmd
from glob import glob

for file in glob("model.000.*.pdb"):
print(file)
#file_list = [f'{m:02d}'  for m in  list(range(0,30,1))]
cmd.load(file)
obj=cmd.get_object_list('all')
print(obj)
#chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
cmd.do("run list_hb.py")
cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(obj[0])+".txt")
cmd.delete("all”)


On Jun 16, 2020, at 11:15 AM, 
pymol-users-requ...@lists.sourceforge.net<mailto:pymol-users-requ...@lists.sourceforge.net>
 wrote:

Send PyMOL-users mailing list submissions to
pymol-users@lists.sourceforge.net<mailto:pymol-users@lists.sourceforge.net>

To subscribe or unsubscribe via the World Wide Web, visit
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fpymol-usersdata=02%7C01%7Cqic8%40pitt.edu%7C4ec7afdbd857446afad308d812081e49%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279173371378327sdata=v28nxT%2ByGrbeZCuvUvBY327R7wDd2z%2FSDo13H8%2BoPwc%3Dreserved=0<https://urldefense.proofpoint.com/v2/url?u=https-3A__nam05.safelinks.protection.outlook.com_-3Furl-3Dhttps-253A-252F-252Flists.sourceforge.net-252Flists-252Flistinfo-252Fpymol-2Dusers-26amp-3Bdata-3D02-257C01-257Cqic8-2540pitt.edu-257C4ec7afdbd857446afad308d812081e49-257C9ef9f489e0a04eeb87cc3a526112fd0d-257C1-257C0-257C637279173371378327-26amp-3Bsdata-3Dv28nxT-252ByGrbeZCuvUvBY327R7wDd2z-252FSDo13H8-252BoPwc-253D-26amp-3Breserved-3D0=DwQGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=oMPpjfMZ6UhM7G_hl2D769S7iBpeJl_H__qcbbVNjdc=TMWKuro9I9BunWhiW8jHe052FVrYbeblA0VWnSB3Yss=>
or, via email, send a message with subject or body 'help' to
pymol-users-requ...@lists.sourceforge.net

You can reach the person managing the list at
pymol-users-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of PyMOL-users digest..."


Today's Topics:

  1. Re: hydrogen bond list for a series of files
 (Mooers, Blaine H.M.  (HSC))
  2. Re: hydrogen bond list for a series of files (Chen, Qiang)


-

[PyMOL] hydrogen bond list for a series of files

2020-06-16 Thread Chen, Qiang
This script will have a memory issue. My pymol will stuck if I have more than 3 
files be processed.
file_list = [f'{m:02d}'  for m in  list(range(1,30,1))]
[cmd.do("load model.000."+str(k)+"_minimized.pdb") for k in file_list]
object_list=cmd.get_object_list('(model.000.*_minimized)')
chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in object_list ]

I modified from the sample script here

https://www.pymolwiki.org/index.php/Process_All_Files_In_Directory

Save the following lines in a file named as, eg. multiple_hb.py and make sure 
list_hb.py in the working directory of searching directory.

Then run multiple_hb.py in the pymol command line.

from pymol import cmd
from glob import glob

for file in glob("model.000.*.pdb"):
print(file)
#file_list = [f'{m:02d}'  for m in  list(range(0,30,1))]
cmd.load(file)
obj=cmd.get_object_list('all')
print(obj)
#chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
cmd.do("run list_hb.py")
cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(obj[0])+".txt")
cmd.delete("all”)


On Jun 16, 2020, at 11:15 AM, 
pymol-users-requ...@lists.sourceforge.net<mailto:pymol-users-requ...@lists.sourceforge.net>
 wrote:

Send PyMOL-users mailing list submissions to
pymol-users@lists.sourceforge.net<mailto:pymol-users@lists.sourceforge.net>

To subscribe or unsubscribe via the World Wide Web, visit
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fpymol-usersdata=02%7C01%7Cqic8%40pitt.edu%7C4ec7afdbd857446afad308d812081e49%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279173371378327sdata=v28nxT%2ByGrbeZCuvUvBY327R7wDd2z%2FSDo13H8%2BoPwc%3Dreserved=0
or, via email, send a message with subject or body 'help' to
pymol-users-requ...@lists.sourceforge.net

You can reach the person managing the list at
pymol-users-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of PyMOL-users digest..."


Today's Topics:

  1. Re: hydrogen bond list for a series of files
 (Mooers, Blaine H.M.  (HSC))
  2. Re: hydrogen bond list for a series of files (Chen, Qiang)


--

Message: 1
Date: Tue, 16 Jun 2020 14:51:38 +
From: "Mooers, Blaine H.M.  (HSC)" 
To: "Chen, Qiang" , "pymol-users@lists.sourceforge.net"

Subject: Re: [PyMOL] hydrogen bond list for a series of files
Message-ID:
<87dcc6c40b22804192b6892e6429ec5fdbefd...@countach.hsc.net.ou.edu>
Content-Type: text/plain; charset="Windows-1252"

Hi Charlie,

This will give the desired list.

file_list = [f'{m:02d}'  for m in  list(range(1,30,1))]
print(file_list)

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419


From: Chen, Qiang [q...@pitt.edu]
Sent: Tuesday, June 16, 2020 9:26 AM
To: Mooers, Blaine H.M.  (HSC); pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] Re: hydrogen bond list for a series of files

Hi, Blaine,

Then the question becomes how to generate a list with 30 or 300 numbers.

Will this work?
file_list=list(range(00, 30))

Thanks!

Charles



From: Mooers, Blaine H.M. (HSC) 
Sent: Tuesday, June 16, 2020 9:57 AM
To: Chen, Qiang ; pymol-users@lists.sourceforge.net 

Subject: RE: hydrogen bond list for a series of files

Hi Charles,

You are right and I am wrong about the files needing to be loaded.

The object name has the pesky pdb file extension stripped off, so lets use the 
object name instead of using Python to strip it off for us.
We no longer need to use glob.
We do need to the create a list of strings that encode the indexing of the 
files.
This code worked for me with two files.
Adapt to your 30 or 300 files.

file_list = ['01','02']
[cmd.do("load model.000."+str(k)+"_minimized.pdb") for k in file_list]
object_list=cmd.get_object_list('(model.000.*_minimized)')
chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in object_list ]


Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of 

Re: [PyMOL] hydrogen bond list for a series of files

2020-06-16 Thread Chen, Qiang
26s-253DKYQX-5FtOI8-5FHnmseLbJRMv7UTirG78evoaztp35Gg74E-2526e-253D-26amp-3Bdata-3D02-257C01-257Cqic8-2540pitt.edu-257C2ea32a0b061443a37f1908d811fd40fd-257C9ef9f489e0a04eeb87cc3a526112fd0d-257C1-257C0-257C637279126707606574-26amp-3Bsdata-3D8VnRodmeEUrqQfFm7fe0gqd02cYPsKv8VxPcb09RIkQ-253D-26amp-3Breserved-3D0%26d%3DDwMF-g%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DQ6LxvA7WaglxixxzDsbpjU7pbOFqJPXxmweHw0k_x7I%26s%3D6cyeevFFP1ip0quoSgRLS9fqrvVtj8JlnLJWMpJWqFg%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C912defbc336647dae60f08d81204d365%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279159230377514sdata=WwpxXonai3NKa2289uyyZSaX%2BiogfaMUstB4PvumZzM%3Dreserved=0>>
import glob
chains = [('A','B'), ('A','C'), ('A','D'), ('A','E'), ('B','C'), ('B','D'), 
('B','E'), ('C','D'), ('C','E'), ('D','E') ]
[[cmd.do("list_hb chain "+ str(i) +", chain " +str(j) + ", 
write_distances_file=hb_"+ str(file) + "_" + str(i) + "_" +str( j) + 
"_001.txt") for i, j in chains] for file in glob.glob("model.??.pdb")]

Note that you do not have to load the pdb files into PyMOL.
If you want to analyze more than 99 files and less than 999 files, add a third 
question mark to the argument of glob.glob().

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419

____________
From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 2:53 PM
To: pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] hydrogen bond list for a series of files

Hi, Pymol users

Could you help me do this in an efficient way?

Let me describe the task I try to do.

I have a series of numerically ordered files, say model00.pdb model.01.pdb …… 
model.30.pdb

All the pdb have the same protein composition, chain A, B, C, D, and E. Their 
relative position is different in each file.

I would like to check the hydrogen bonds between, say, chain A and B.

Thanks to Prof. Robert L. Campbell, I can list the hydrogen bonds in one pdb 
and print the list as the follows

list_hb chain A, chain B, write_distances_file=hb_A_B_01.txt

How can I process the 30 files in an efficient way? what if I have 300 pdb 
files?

Shell script, python, or anything else?


Thanks!
Charles Chen




___
PyMOL-users mailing list
Archives: 
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.mail-2Darchive.com_pymol-2Dusers-40lists.sourceforge.net%26d%3DDwIGaQ%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw%26s%3DaOpeSOw9Gqop8KF8Xf_lkPoBC_MSbb5i0cKlRaIAulI%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C912defbc336647dae60f08d81204d365%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279159230387509sdata=yNeKzDtF62jtKbwlABRSdk9Z2YsifFaBdbfDw0GAQ6k%3Dreserved=0<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps-3A__nam05.safelinks.protection.outlook.com_-3Furl-3Dhttps-253A-252F-252Furldefense.proofpoint.com-252Fv2-252Furl-253Fu-253Dhttp-2D3A-5F-5Fwww.mail-2D2Darchive.com-5Fpymol-2D2Dusers-2D40lists.sourceforge.net-2526d-253DDwIGaQ-2526c-253DVjzId-2DSM5S6aVB-5FcCGQ0d3uo9UfKByQ3sI6Audoy6dY-2526r-253Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks-2526m-253DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw-2526s-253DaOpeSOw9Gqop8KF8Xf-5FlkPoBC-5FMSbb5i0cKlRaIAulI-2526e-253D-26amp-3Bdata-3D02-257C01-257Cqic8-2540pitt.edu-257C01a30e93a2ca4a40b37308d81196d7ba-257C9ef9f489e0a04eeb87cc3a526112fd0d-257C1-257C0-257C637278686852886299-26amp-3Bsdata-3DH-252BbXZ7ylGnf8aHeqS8UfkWyeYYuKCLZv1GikWVh2gAM-253D-26amp-3Breserved-3D0%26d%3DDwMF-g%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DX2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18%26s%3DUml8pWJGL1VV1FRsRqY0A8xQ-ZVcOqvXJIUCvJgGjSY%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C912defbc336647dae60f08d81204d365%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279159230387509sdata=dCkeeyUd5TGKmYILIOqxanCGsFaADZTnLWnnq%2BxQrXQ%3Dreserved=0>
Unsubscribe: 
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps-3A__sourceforge.net_projects_pymol_lists_pymol-2Dusers_unsubscribe%26d%3DDwIGaQ%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw%26s%3DPY-g0XYMB9DqXC06Iixbjxfqf8jB9Pb_GFu8zClx3oY%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C912defbc336647dae60f08d81204d365%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C63727915

Re: [PyMOL] hydrogen bond list for a series of files

2020-06-16 Thread Chen, Qiang
Hi, Blaine,

Then the question becomes how to generate a list with 30 or 300 numbers.

Will this work?
file_list=list(range(00, 30))

Thanks!

Charles



From: Mooers, Blaine H.M. (HSC) 
Sent: Tuesday, June 16, 2020 9:57 AM
To: Chen, Qiang ; pymol-users@lists.sourceforge.net 

Subject: RE: hydrogen bond list for a series of files

Hi Charles,

You are right and I am wrong about the files needing to be loaded.

The object name has the pesky pdb file extension stripped off, so lets use the 
object name instead of using Python to strip it off for us.
We no longer need to use glob.
We do need to the create a list of strings that encode the indexing of the 
files.
This code worked for me with two files.
Adapt to your 30 or 300 files.

file_list = ['01','02']
[cmd.do("load model.000."+str(k)+"_minimized.pdb") for k in file_list]
object_list=cmd.get_object_list('(model.000.*_minimized)')
chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in object_list ]


Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419


From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 10:18 PM
To: Mooers, Blaine H.M.  (HSC); pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] Re: hydrogen bond list for a series of files

Thanks, Dr. Mooers.

I modified a little.

It seems the pdb files need be loaded.

I put all the following lines in a file multifile_hb.pml

run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
import glob
load model.000.*_minimized.pdb
#chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in 
glob.glob("model.000.??_minimized.pdb")]

A little not so perfect is that the output file,

hb_model.000.??_minimized.pdb.txt

Is is possible to do something like this
write_distances_file=hb_"+basename(file)+".txt"

Then the output will be
hb_model.000.??_minimized.txt

I tried, and this simple thing does not work.

Any suggestion?

Thanks!

Charles

From: Mooers, Blaine H.M. (HSC) 
Sent: Monday, June 15, 2020 9:44 PM
To: Chen, Qiang ; pymol-users@lists.sourceforge.net 

Subject: RE: hydrogen bond list for a series of files

Hi Charles,

Make sure that PyMOL's present working directory is where the pdb files are 
stored.
Copy and paste each of the four lines below one at a time on the command line 
in PyMOL.


run 
list_hb.py<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__list-5Fhb.py%26d%3DDwQF-g%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DX2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18%26s%3DKYQX_tOI8_HnmseLbJRMv7UTirG78evoaztp35Gg74E%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C2ea32a0b061443a37f1908d811fd40fd%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279126707606574sdata=8VnRodmeEUrqQfFm7fe0gqd02cYPsKv8VxPcb09RIkQ%3Dreserved=0>
import glob
chains = [('A','B'), ('A','C'), ('A','D'), ('A','E'), ('B','C'), ('B','D'), 
('B','E'), ('C','D'), ('C','E'), ('D','E') ]
[[cmd.do("list_hb chain "+ str(i) +", chain " +str(j) + ", 
write_distances_file=hb_"+ str(file) + "_" + str(i) + "_" +str( j) + 
"_001.txt") for i, j in chains] for file in glob.glob("model.??.pdb")]

Note that you do not have to load the pdb files into PyMOL.
If you want to analyze more than 99 files and less than 999 files, add a third 
question mark to the argument of glob.glob().

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419

________
From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 2:53 PM
To: pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] hydrogen bond list for a series of files

Hi, Pymol users

Could you help me do this in an efficient way?

Let me describe the task I try to do.

I have a series of numerically ordered files, say model00.pdb model.01.pdb …… 
model.30.pdb

All the pdb have the same protein composition, chain A, B, C, D, and E. Their 
re

Re: [PyMOL] hydrogen bond list for a series of files

2020-06-16 Thread Mooers, Blaine H.M. (HSC)
Hi Charles,

You are right and I am wrong about the files needing to be loaded.

The object name has the pesky pdb file extension stripped off, so lets use the 
object name instead of using Python to strip it off for us.
We no longer need to use glob.
We do need to the create a list of strings that encode the indexing of the 
files. 
This code worked for me with two files.
Adapt to your 30 or 300 files.

file_list = ['01','02']
[cmd.do("load model.000."+str(k)+"_minimized.pdb") for k in file_list]
object_list=cmd.get_object_list('(model.000.*_minimized)')
chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in object_list ]


Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419


From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 10:18 PM
To: Mooers, Blaine H.M.  (HSC); pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] Re: hydrogen bond list for a series of files

Thanks, Dr. Mooers.

I modified a little.

It seems the pdb files need be loaded.

I put all the following lines in a file multifile_hb.pml

run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
import glob
load model.000.*_minimized.pdb
#chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in 
glob.glob("model.000.??_minimized.pdb")]

A little not so perfect is that the output file,

hb_model.000.??_minimized.pdb.txt

Is is possible to do something like this
write_distances_file=hb_"+basename(file)+".txt"

Then the output will be
hb_model.000.??_minimized.txt

I tried, and this simple thing does not work.

Any suggestion?

Thanks!

Charles

From: Mooers, Blaine H.M. (HSC) 
Sent: Monday, June 15, 2020 9:44 PM
To: Chen, Qiang ; pymol-users@lists.sourceforge.net 

Subject: RE: hydrogen bond list for a series of files

Hi Charles,

Make sure that PyMOL's present working directory is where the pdb files are 
stored.
Copy and paste each of the four lines below one at a time on the command line 
in PyMOL.


run 
list_hb.py<https://urldefense.proofpoint.com/v2/url?u=http-3A__list-5Fhb.py=DwQF-g=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=X2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18=KYQX_tOI8_HnmseLbJRMv7UTirG78evoaztp35Gg74E=>
import glob
chains = [('A','B'), ('A','C'), ('A','D'), ('A','E'), ('B','C'), ('B','D'), 
('B','E'), ('C','D'), ('C','E'), ('D','E') ]
[[cmd.do("list_hb chain "+ str(i) +", chain " +str(j) + ", 
write_distances_file=hb_"+ str(file) + "_" + str(i) + "_" +str( j) + 
"_001.txt") for i, j in chains] for file in glob.glob("model.??.pdb")]

Note that you do not have to load the pdb files into PyMOL.
If you want to analyze more than 99 files and less than 999 files, add a third 
question mark to the argument of glob.glob().

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419

________
From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 2:53 PM
To: pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] hydrogen bond list for a series of files

Hi, Pymol users

Could you help me do this in an efficient way?

Let me describe the task I try to do.

I have a series of numerically ordered files, say model00.pdb model.01.pdb …… 
model.30.pdb

All the pdb have the same protein composition, chain A, B, C, D, and E. Their 
relative position is different in each file.

I would like to check the hydrogen bonds between, say, chain A and B.

Thanks to Prof. Robert L. Campbell, I can list the hydrogen bonds in one pdb 
and print the list as the follows

list_hb chain A, chain B, write_distances_file=hb_A_B_01.txt

How can I process the 30 files in an efficient way? what if I have 300 pdb 
files?

Shell script, python, or anything else?


Thanks!
Charles Chen




___
PyMOL-users mailing list
Archives: 
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.mail-2Darchi

Re: [PyMOL] hydrogen bond list for a series of files

2020-06-15 Thread Chen, Qiang
Thanks, Dr. Mooers.

I modified a little.

It seems the pdb files need be loaded.

I put all the following lines in a file multifile_hb.pml

run 
C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pymol\pymol_path\Pymol-script-repo\list_hb.py
import glob
load model.000.*_minimized.pdb
#chains=[('A','F'),('B', 'F'),('C','F'),('D','F'),('E','F')]
[cmd.do("list_hb chain F, chain A:E, 
write_distances_file=hb_"+str(file)+".txt") for file in 
glob.glob("model.000.??_minimized.pdb")]

A little not so perfect is that the output file,

hb_model.000.??_minimized.pdb.txt

Is is possible to do something like this
write_distances_file=hb_"+basename(file)+".txt"

Then the output will be
hb_model.000.??_minimized.txt

I tried, and this simple thing does not work.

Any suggestion?

Thanks!

Charles

From: Mooers, Blaine H.M. (HSC) 
Sent: Monday, June 15, 2020 9:44 PM
To: Chen, Qiang ; pymol-users@lists.sourceforge.net 

Subject: RE: hydrogen bond list for a series of files

Hi Charles,

Make sure that PyMOL's present working directory is where the pdb files are 
stored.
Copy and paste each of the four lines below one at a time on the command line 
in PyMOL.


run list_hb.py
import glob
chains = [('A','B'), ('A','C'), ('A','D'), ('A','E'), ('B','C'), ('B','D'), 
('B','E'), ('C','D'), ('C','E'), ('D','E') ]
[[cmd.do("list_hb chain "+ str(i) +", chain " +str(j) + ", 
write_distances_file=hb_"+ str(file) + "_" + str(i) + "_" +str( j) + 
"_001.txt") for i, j in chains] for file in glob.glob("model.??.pdb")]

Note that you do not have to load the pdb files into PyMOL.
If you want to analyze more than 99 files and less than 999 files, add a third 
question mark to the argument of glob.glob().

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419


From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 2:53 PM
To: pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] hydrogen bond list for a series of files

Hi, Pymol users

Could you help me do this in an efficient way?

Let me describe the task I try to do.

I have a series of numerically ordered files, say model00.pdb model.01.pdb …… 
model.30.pdb

All the pdb have the same protein composition, chain A, B, C, D, and E. Their 
relative position is different in each file.

I would like to check the hydrogen bonds between, say, chain A and B.

Thanks to Prof. Robert L. Campbell, I can list the hydrogen bonds in one pdb 
and print the list as the follows

list_hb chain A, chain B, write_distances_file=hb_A_B_01.txt

How can I process the 30 files in an efficient way? what if I have 300 pdb 
files?

Shell script, python, or anything else?


Thanks!
Charles Chen




___
PyMOL-users mailing list
Archives: 
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.mail-2Darchive.com_pymol-2Dusers-40lists.sourceforge.net%26d%3DDwIGaQ%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw%26s%3DaOpeSOw9Gqop8KF8Xf_lkPoBC_MSbb5i0cKlRaIAulI%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C01a30e93a2ca4a40b37308d81196d7ba%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637278686852886299sdata=H%2BbXZ7ylGnf8aHeqS8UfkWyeYYuKCLZv1GikWVh2gAM%3Dreserved=0
Unsubscribe: 
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps-3A__sourceforge.net_projects_pymol_lists_pymol-2Dusers_unsubscribe%26d%3DDwIGaQ%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw%26s%3DPY-g0XYMB9DqXC06Iixbjxfqf8jB9Pb_GFu8zClx3oY%26e%3Ddata=02%7C01%7Cqic8%40pitt.edu%7C01a30e93a2ca4a40b37308d81196d7ba%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637278686852886299sdata=o1asKPIbwdAFwN%2FCJSTCXDg%2BndmmLXC8VJW8z48Y%2BAA%3Dreserved=0
___
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] hydrogen bond list for a series of files

2020-06-15 Thread Mooers, Blaine H.M. (HSC)
Hi Charles, 

Make sure that PyMOL's present working directory is where the pdb files are 
stored.
Copy and paste each of the four lines below one at a time on the command line 
in PyMOL.


run list_hb.py
import glob
chains = [('A','B'), ('A','C'), ('A','D'), ('A','E'), ('B','C'), ('B','D'), 
('B','E'), ('C','D'), ('C','E'), ('D','E') ]
[[cmd.do("list_hb chain "+ str(i) +", chain " +str(j) + ", 
write_distances_file=hb_"+ str(file) + "_" + str(i) + "_" +str( j) + 
"_001.txt") for i, j in chains] for file in glob.glob("model.??.pdb")]

Note that you do not have to load the pdb files into PyMOL.
If you want to analyze more than 99 files and less than 999 files, add a third 
question mark to the argument of glob.glob(). 

Best regards,

Blaine

Blaine Mooers, Ph.D.
Associate Professor
Department of Biochemistry and Molecular Biology
College of Medicine
University of Oklahoma Health Sciences Center
S.L. Young Biomedical Research Center (BRC) Rm. 466
975 NE 10th Street, BRC 466
Oklahoma City, OK 73104-5419


From: Chen, Qiang [q...@pitt.edu]
Sent: Monday, June 15, 2020 2:53 PM
To: pymol-users@lists.sourceforge.net
Subject: [EXTERNAL] [PyMOL] hydrogen bond list for a series of files

Hi, Pymol users

Could you help me do this in an efficient way?

Let me describe the task I try to do.

I have a series of numerically ordered files, say model00.pdb model.01.pdb …… 
model.30.pdb

All the pdb have the same protein composition, chain A, B, C, D, and E. Their 
relative position is different in each file.

I would like to check the hydrogen bonds between, say, chain A and B.

Thanks to Prof. Robert L. Campbell, I can list the hydrogen bonds in one pdb 
and print the list as the follows

list_hb chain A, chain B, write_distances_file=hb_A_B_01.txt

How can I process the 30 files in an efficient way? what if I have 300 pdb 
files?

Shell script, python, or anything else?


Thanks!
Charles Chen




___
PyMOL-users mailing list
Archives: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.mail-2Darchive.com_pymol-2Dusers-40lists.sourceforge.net=DwIGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=xyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw=aOpeSOw9Gqop8KF8Xf_lkPoBC_MSbb5i0cKlRaIAulI=
Unsubscribe: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.net_projects_pymol_lists_pymol-2Dusers_unsubscribe=DwIGaQ=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks=xyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw=PY-g0XYMB9DqXC06Iixbjxfqf8jB9Pb_GFu8zClx3oY=


___
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] hydrogen bond list for a series of files

2020-06-15 Thread Chen, Qiang
Hi, Pymol users

Could you help me do this in an efficient way?

Let me describe the task I try to do.

I have a series of numerically ordered files, say model00.pdb model.01.pdb …… 
model.30.pdb

All the pdb have the same protein composition, chain A, B, C, D, and E. Their 
relative position is different in each file.

I would like to check the hydrogen bonds between, say, chain A and B.

Thanks to Prof. Robert L. Campbell, I can list the hydrogen bonds in one pdb 
and print the list as the follows

list_hb chain A, chain B, write_distances_file=hb_A_B_01.txt 

How can I process the 30 files in an efficient way? what if I have 300 pdb 
files?

Shell script, python, or anything else?


Thanks!
Charles Chen




___
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