[Chimera-users] Clustering saving PDB

Lorena Roldán Martín lorena.roldan at uab.cat
Thu Dec 24 02:10:12 PST 2020


Hi Eric, 

Thank you so much for your quick response. I have tried the script you sent me and the only problem with this is that all the PDBs saved correspond to the same frame, although I have tested that the frames are correctly parsed to the coordset command. I have also loaded the full trajectory to the MD movie and visualized every single frame. Do you know why this might happen?

Thank you, 
Lorena

> El 23 dic 2020, a las 19:31, Eric Pettersen <pett at cgl.ucsf.edu> escribió:
> 
> Hi Lorena,
> 	I don't think a per-frame script is really the approach you want.  What you want to do is open your trajectory, use "coordset" commands to go to the representative frames, and then write them out.  Here's a possible script (that you would run simply be opening it with the "open" command [make sure the file name ends in '.py']):
> 
> from chimera import runCommand
> with open("/HDD/lroldan/Master/Metals_bA/Template/2LFM/MD/GaMD/clusters_frame.txt", "r") as f:
>     cluster_number = 1
>     for line in f:
>         if line.startswith('#'): #comment line
>             continue
>         runCommand("coordset #0 " + line.strip().split()[0])
>         name = "/HDD/lroldan/Master/Metals_bA/Template/2LFM/MD/GaMD/Clusters/_" + str(cluster_number)
>         runCommand("write format pdb 0 " + name)
>         cluster_number += 1
> 
> --Eric
> 
> 	Eric Pettersen
> 	UCSF Computer Graphics Lab
> 
> 
>> On Dec 23, 2020, at 8:20 AM, Lorena Roldán <Lorena.Roldan at uab.cat <mailto:Lorena.Roldan at uab.cat>> wrote:
>> 
>> Good afternoon, 
>> 
>> I contact you as I would really appreciate your help. I have a MD trajectory which I have processed into Clusters with the Analysis ... Cluster tool. I have saved the resulting file with the members and the representative frame, but now I would like to save those representative frames in separate PDB files. This process is extremely tedious if manually done, so I have tried to perform a script:
>> 
>> 
>> 
>> with open("/HDD/lroldan/Master/Metals_bA/Template/2LFM/MD/GaMD/clusters_frame.txt", "r") as f:
>>     lines=f.readlines()
>>     cluster_number = 1
>>     for i in range(len(lines)):
>>         frame = i
>>         if mdInfo["frame number"] == frame:
>>             name = "/HDD/lroldan/Master/Metals_bA/Template/2LFM/MD/GaMD/Clusters/_" + str(cluster_number)
>>             runCommand('write format pdb 0 $name)
>> 
>> 
>> 
>> which would be run in the "Per-frame Commands", in order to 1) encounter the frames of the cluster and 2) save each frame in a PDB file, correctly numbered.
>> 
>> 
>> 
>> However, this script is not working, and I would greatly thank any help you could provide me with.
>> 
>> 
>> 
>> Lorena.
>> 
>> -- 
>>  <http://www.uab.cat/>	Lorena Roldán Martín
>> PhD Student in Bioinformatics
>> 
>> Departament de Química
>> Unitat de Química Física
>> 
>> Campus de la UAB · 08193 Bellaterra
>> (Cerdanyola del Vallès) · Barcelona · Spain
>> 
>> +34 690799431
>> www.uab.cat <http://www.uab.cat/>
>> 
>> 
>>  <https://orcid.org/0000-0002-6902-8285> <https://www.linkedin.com/in/lorena-roldan-biomedica/>
>> 
>> _______________________________________________
>> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
>> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20201224/be921b15/attachment-0001.html>


More information about the Chimera-users mailing list