[Chimera-users] Clustering saving PDB
Eric Pettersen
pett at cgl.ucsf.edu
Mon Dec 28 11:40:15 PST 2020
Glad you were able to figure it out! I'm surprised that coordset requires a 'wait' to work, but not totally shocked I guess. :-)
--Eric
> On Dec 24, 2020, at 3:02 AM, Lorena Roldán Martín <lorena.roldan at uab.cat> wrote:
>
> Finally solved!
> runCommand("coordset #0 " + line.strip().split()[0] + “; wait 1”) did the trick.
>
>
> Thank you so much, Merry Christmas and Happy New Year
> Lorena
>
>
>> El 23 dic 2020, a las 19:31, Eric Pettersen <pett at cgl.ucsf.edu <mailto: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>
>>
>
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: 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/20201228/1f67ab86/attachment.html>
More information about the Chimera-users
mailing list