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://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%3D&data=02%7C01%7Cqic8%40pitt.edu%7C2ea32a0b061443a37f1908d811fd40fd%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279126707606574&sdata=8VnRodmeEUrqQfFm7fe0gqd02cYPsKv8VxPcb09RIkQ%3D&reserved=0<https://urldefense.proofpoint.com/v2/url?u=https-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&d=DwMF-g&c=VjzId-SM5S6aVB_cCGQ0d3uo9UfKByQ3sI6Audoy6dY&r=k0gMbcsdOcdbPUNV5tW66KQSZfXL0ewVDPVBp7tqbks&m=Q6LxvA7WaglxixxzDsbpjU7pbOFqJPXxmweHw0k_x7I&s=6cyeevFFP1ip0quoSgRLS9fqrvVtj8JlnLJWMpJWqFg&e=>> 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%3D&data=02%7C01%7Cqic8%40pitt.edu%7C2ea32a0b061443a37f1908d811fd40fd%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279126707606574&sdata=hv3wxBB9OoMRAwCeb44ok4suuSPP47IGl771qqDqaFs%3D&reserved=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%3D&data=02%7C01%7Cqic8%40pitt.edu%7C2ea32a0b061443a37f1908d811fd40fd%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279126707606574&sdata=Ro1JrjplPPP%2BnpS29PnQTnnIqNWCdpOJCoViVArOBkE%3D&reserved=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%3D&data=02%7C01%7Cqic8%40pitt.edu%7C2ea32a0b061443a37f1908d811fd40fd%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279126707606574&sdata=WPFSb8UDLcACThM4ujjxACYr%2FbNL8OtX9oPrQ%2F9ipsA%3D&reserved=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-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&data=02%7C01%7Cqic8%40pitt.edu%7C2ea32a0b061443a37f1908d811fd40fd%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637279126707606574&sdata=BE4anajstdDJuzCvU74%2B5qsAwIOsOuGCtYme8aV3OVc%3D&reserved=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