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  +0000,  "Chen, Qiang" <q...@pitt.edu> 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_Directory&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764004254&amp;sdata=p5tXmvSD1QCS%2BdIXyJv58rEBk9GCIRtl8BFSnamwoNs%3D&amp;reserved=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-users&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764004254&amp;sdata=9UIjcsPwiUC9PmwQ4mcTi1%2F4%2BIGx9jQKarXsh7dfpGk%3D&amp;reserved=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 +0000
> From: "Mooers, Blaine H.M.  (HSC)" <blaine-moo...@ouhsc.edu>
> To: "Chen, Qiang" <q...@pitt.edu>, "pymol-users@lists.sourceforge.net"
> <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) <blaine-moo...@ouhsc.edu>
> Sent: Tuesday, June 16, 2020 9:57 AM
> To: Chen, Qiang <q...@pitt.edu>; pymol-users@lists.sourceforge.net
> <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) <blaine-moo...@ouhsc.edu>
> Sent: Monday, June 15, 2020 9:44 PM
> To: Chen, Qiang <q...@pitt.edu>; pymol-users@lists.sourceforge.net
> <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://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764004254&amp;sdata=NvuLHnhUNs8SbnVriI5mzDDHt%2FTOAYkCszgvxCLf3%2BA%3D&amp;reserved=0<https://can01.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-5Flist-2D5Fhb.py-2526d-253DDwQF-2Dg-2526c-253DVjzId-2DSM5S6aVB-5FcCGQ0d3uo9UfKByQ3sI6Audoy6dY-2526r-253Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks-2526m-253DX2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18-2526s-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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764004254&amp;sdata=Wvtb4FDbK8ph8tIPtB3XZwSj8GR%2FaKTwqu%2FFxqwGsS8%3D&amp;reserved=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://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764014248&amp;sdata=yZqQXrkiZ9xi%2Fq0wQYI02RrH2QfUStm2IhKPBTPLzcY%3D&amp;reserved=0<https://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764014248&amp;sdata=xtvWDb4Qm9z9PC21dmPn7%2BpLdpmHSKtRYyuGwA7yP3c%3D&amp;reserved=0>
> Unsubscribe:
> https://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764014248&amp;sdata=DPsvHWHcmU74LFh%2FTC1PJ5eURwVcW%2FGN%2BYE5Ip73QzU%3D&amp;reserved=0<https://can01.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-253Dhttps-2D3A-5F-5Fsourceforge.net-5Fprojects-5Fpymol-5Flists-5Fpymol-2D2Dusers-5Funsubscribe-2526d-253DDwIGaQ-2526c-253DVjzId-2DSM5S6aVB-5FcCGQ0d3uo9UfKByQ3sI6Audoy6dY-2526r-253Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks-2526m-253DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw-2526s-253DPY-2Dg0XYMB9DqXC06Iixbjxfqf8jB9Pb-5FGFu8zClx3oY-2526e-253D-26amp-3Bdata-3D02-257C01-257Cqic8-2540pitt.edu-257C01a30e93a2ca4a40b37308d81196d7ba-257C9ef9f489e0a04eeb87cc3a526112fd0d-257C1-257C0-257C637278686852886299-26amp-3Bsdata-3Do1asKPIbwdAFwN-252FCJSTCXDg-252BndmmLXC8VJW8z48Y-252BAA-253D-26amp-3Breserved-3D0%26d%3DDwMF-g%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DX2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18%26s%3D52GYpWEgXcbl5EqO1gYdzX31C41KuEUPECZU1zDR_TU%26e%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764014248&amp;sdata=%2FwsE8dTQEIVGqA5dEK5Vxy1a9RycJ1MHZAZ4DjckGWA%3D&amp;reserved=0>
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 16 Jun 2020 15:15:11 +0000
> From: "Chen, Qiang" <q...@pitt.edu>
> To: "Mooers, Blaine H.M.  (HSC)" <blaine-moo...@ouhsc.edu>,
> "pymol-users@lists.sourceforge.net"
> <pymol-users@lists.sourceforge.net>
> Subject: Re: [PyMOL] hydrogen bond list for a series of files
> Message-ID:
> <bl0pr04mb4660485ca7e2c00bf335ab34fa...@bl0pr04mb4660.namprd04.prod.outlook.com>
> 
> Content-Type: text/plain; charset="windows-1252"
> 
> Great, thanks!
> 
> Really appreciate your help!
> 
> Charles
> ________________________________
> From: Mooers, Blaine H.M. (HSC) <blaine-moo...@ouhsc.edu>
> Sent: Tuesday, June 16, 2020 10:51 AM
> To: Chen, Qiang <q...@pitt.edu>; pymol-users@lists.sourceforge.net
> <pymol-users@lists.sourceforge.net> Subject: RE: hydrogen bond list
> for a series of files
> 
> 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) <blaine-moo...@ouhsc.edu>
> Sent: Tuesday, June 16, 2020 9:57 AM
> To: Chen, Qiang <q...@pitt.edu>; pymol-users@lists.sourceforge.net
> <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) <blaine-moo...@ouhsc.edu>
> Sent: Monday, June 15, 2020 9:44 PM
> To: Chen, Qiang <q...@pitt.edu>; pymol-users@lists.sourceforge.net
> <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://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764014248&amp;sdata=mRQt8S4QlPA4%2FO%2FNvifhW54IYOXxpnv1IFvOqPpOeIg%3D&amp;reserved=0<https://can01.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-5Flist-2D5Fhb.py-2526d-253DDwQF-2Dg-2526c-253DVjzId-2DSM5S6aVB-5FcCGQ0d3uo9UfKByQ3sI6Audoy6dY-2526r-253Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks-2526m-253DX2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18-2526s-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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764024242&amp;sdata=xcUVp%2FkLfWCbq%2FWAF6rakqELuj4V9snyTM5Cxpl20yg%3D&amp;reserved=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://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764024242&amp;sdata=2zE5NgwAaNXgWinjnCb6TVj2iHwQ0Cuw1Fh4aRwpsEA%3D&amp;reserved=0<https://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764024242&amp;sdata=hkpTCkX2MdmYw%2Fw4Uw%2FEoccSpAS6OsEPOsSscxT77wY%3D&amp;reserved=0>
> Unsubscribe:
> https://can01.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%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764024242&amp;sdata=QUul7as5eiAqGaLlmJ4qhWWuTgZapJzxE4tQ9oP7iak%3D&amp;reserved=0<https://can01.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-253Dhttps-2D3A-5F-5Fsourceforge.net-5Fprojects-5Fpymol-5Flists-5Fpymol-2D2Dusers-5Funsubscribe-2526d-253DDwIGaQ-2526c-253DVjzId-2DSM5S6aVB-5FcCGQ0d3uo9UfKByQ3sI6Audoy6dY-2526r-253Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks-2526m-253DxyAmhZRZYDjhbBLdiMRRk6wCJ14kA5UeQYC4urBFvQw-2526s-253DPY-2Dg0XYMB9DqXC06Iixbjxfqf8jB9Pb-5FGFu8zClx3oY-2526e-253D-26amp-3Bdata-3D02-257C01-257Cqic8-2540pitt.edu-257C01a30e93a2ca4a40b37308d81196d7ba-257C9ef9f489e0a04eeb87cc3a526112fd0d-257C1-257C0-257C637278686852886299-26amp-3Bsdata-3Do1asKPIbwdAFwN-252FCJSTCXDg-252BndmmLXC8VJW8z48Y-252BAA-253D-26amp-3Breserved-3D0%26d%3DDwMF-g%26c%3DVjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY%26r%3Dk0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks%26m%3DX2B3s7D21CBjGtOAQJ2noNR7vnKXPiHiT2eLIRiSC18%26s%3D52GYpWEgXcbl5EqO1gYdzX31C41KuEUPECZU1zDR_TU%26e%3D&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764024242&amp;sdata=C9b8SlYDOS0SpLnWq2Ih%2B5nu6kdOq6Rd4xEk%2FBJagHE%3D&amp;reserved=0>
> -------------- next part -------------- An HTML attachment was
> scrubbed...
> 
> ------------------------------
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fpymol-users&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764034235&amp;sdata=TUvORX%2F5dgwsdyNUwGHHcGu2C1K%2F1WUYU8Wo5uRKTM4%3D&amp;reserved=0
> Unsubscribe:
> https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fpymol%2Flists%2Fpymol-users%2Funsubscribe&amp;data=02%7C01%7Crobert.campbell%40queensu.ca%7C5a300643d81e4d7ea3f608d812359b34%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C637279368764034235&amp;sdata=98ZkC2W40dOQ9ApMEOC8jCHsY%2FvvqzXr%2F%2BIfs7X4gFQ%3D&amp;reserved=0
> 
> ------------------------------
> 
> End of PyMOL-users Digest, Vol 169, Issue 26
> ********************************************
> 



-- 
Robert L. Campbell, Ph.D.
Academic Advisor, BHSc Program
Assistant Professor, Dept. of Biomedical & Molecular Sciences, 
Queen's University, Kingston, ON K7L 3N6  Canada
Botterell Hall Rm 644     Tel: 613-533-6821
<robert.campb...@queensu.ca>  http://pldserver1.biochem.queensu.ca/~rlc


_______________________________________________
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

Reply via email to