[Chimera-users] Loop through hundreds of files and find HBonds
Samuel Kyobe
samuelkyobe at gmail.com
Thu Apr 14 06:10:33 PDT 2022
Hi Elaine
Thank you so much for your responses.
I have modified the recommended example as seen below:
1 import chimera
2 import os
3 import glob
4
5 from chimera import runCommand as rc
6 from chimera import replyobj
7
8 # change to folder with data files
9 os.chdir("/Volumes/Auto_chimera")
10
11 # absolute path to search all .pdb files of ligands
12 path = r'./*_out_*.pdb’ # several files with output name specified as *_out_*.pdb
13 files = glob.glob(path)
14 print(files)
15
16 file_names = files
17
18 for files in file_names:
19 my_mod=chimera.openModels.open('./HLA_5w6a_model_4.pdb',type="PDB")
20 replyobj.status("Processing " + files)
21 rc("open " + files)
22 rc("addh")
23 rc("findhbond intermodel true intramodel false relax false reveal true saveFile")
24 rc("close all")
25 rc("stop now”)
My current challenge is how to save the different resultant files with unique file_names (line 25).
Is there an alternative way I can call the files names after saveFile (line 25)? Your example doesn’t not work with my modified code.
Thank you
Samuel
> On 13 Apr 2022, at 19:04, Elaine Meng <meng at cgl.ucsf.edu> wrote:
>
> Hi Samuel,
> Although the first link I sent you shows Chimera commands, the second link shows how to put those commands together with Python for looping.
> Elaine
>
>> On Apr 13, 2022, at 9:00 AM, Samuel Kyobe via Chimera-users <chimera-users at cgl.ucsf.edu> wrote:
>>
>> Dear Elaine
>>
>> The challenge I have is that the Command Index is not written for Python which I would prefer to use for looping in several files.
>>
>> I am using only Chimera I have no access to ChimeraX.
>>
>> Thank you
>>
>> Samuel
>
More information about the Chimera-users
mailing list