[Chimera-users] Writing each rotamers to individual PDB file

Eric Pettersen pett at cgl.ucsf.edu
Wed Feb 17 15:53:45 PST 2021



> On Feb 17, 2021, at 3:42 PM, Chemmama, Ilan <Ilan.Chemmama at ucsf.edu> wrote:
> 
> Hi Eric,
> 
> Thank you for the reply. 
> I have a couple of follow up questions if I may. 
> 
> (i) I have run the script you attached but I get a few errors:
> 
> rot_type=“GLU"
> rots=get_rotamers(res, resType=rot_type)
> 
> gives only two rotamers (`len(rots))`. When I run this on the GUI, I get 54 rotamers which is what I would expect.

Well, that's because there's a bug in the example code I sent.  Doh.  The second line should be:

	bbdep, rots = get_rotamers(res, resType=rot_type)

> 
> (ii) I get a Chimera error:
> File "/opt/chimera-1.14-1.fc31/share/chimera/triggerSet.py", line 83, in invoke
>     self._funcData, triggerData)
>   File "/opt/chimera-1.14-1.fc31/share/chimera/Sequence.py", line 401, in wrapper2
>     s._residueCB(a1, a2, a3)
>   File "/opt/chimera-1.14-1.fc31/share/chimera/Sequence.py", line 626, in _residueCB
>     if res3to1(res.type) != ungapped[pos]:
> IndexError: string index out of range
> 
> Error processing trigger "Residue":
> IndexError: string index out of range
> 
>   File "/opt/chimera-1.14-1.fc31/share/chimera/Sequence.py", line 626, in _residueCB
>     if res3to1(res.type) != ungapped[pos]:
> 
> I found a workaround in the mean time. 
> I managed to make Chimera saved all the rotamers in a single PDB file, and an extra character was added to RES_NAME entry in the PDB file to differentiate each rotamer. 
> Then I just did some file manipulations and split the PDB appropriately. 

Glad you got something satisfactory to work. :-)

--Eric

> 
> Thanks again ! 
> Ilan
> 
>> On Feb 17, 2021, at 2:40 PM, Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>> wrote:
>> 
>> Hi Ilan,
>> I see that the Dunbrack 2010 rotamer library is now being released under a more permissive license than previously, so this kind of quasi-bulk dumping of library info is probably okay.  Nonetheless, since you are using the library so extensively it would be nice of you to register as a library user here if you could: https://urldefense.proofpoint.com/v2/url?u=http-3A__dunbrack.fccc.edu_bbdep2010_&d=DwIFAg&c=iORugZls2LlYyCAZRB3XLg&r=mKSDZidXHAmavIl-Ov-liBnCRR7Q81s96Ue3o_9uiv0&m=WhkU7bXdiTiHIgdIWawwnAeUYVvhC0LnZfTGG8GEpVY&s=S3jcExeF5rf7cB2J3ns5Mwa8Btp-FXWolMsa3v2ysno&e= <https://urldefense.proofpoint.com/v2/url?u=http-3A__dunbrack.fccc.edu_bbdep2010_&d=DwIFAg&c=iORugZls2LlYyCAZRB3XLg&r=mKSDZidXHAmavIl-Ov-liBnCRR7Q81s96Ue3o_9uiv0&m=WhkU7bXdiTiHIgdIWawwnAeUYVvhC0LnZfTGG8GEpVY&s=S3jcExeF5rf7cB2J3ns5Mwa8Btp-FXWolMsa3v2ysno&e=>  .  And of course if any publication results from it, cite the paper shown in the Rotamers dialog.
>> Okay, that said, you are going to have to use a Python script to do what you want.  Assuming you have somehow selected the residue involved, to get all rotamers of LYS for it, the heart of the script would be:
>> 
>> from chimera import runCommand as run
>> from Rotamers import getRotamers
>> from chimera import selection
>> 
>> rot_type = "LYS"
>> 
>> res = selection.currentResidues()[0]
>> rots = getRotamers(res, resType=rot_type)
>> for i in range(len(rots)):
>> run("swapaa %s sel criteria %d" % (rot_type, i+1))
>> run("write 0 /path/to/save/folder/struct%s%d.%d.pdb" % (rot_type, res.id.position, i+1))
>> 
>> Let me know If you need more help than that.
>> 
>> --Eric
>> 
>> Eric Pettersen
>> UCSF Computer Graphics Lab
>> 
>> 
>>> On Feb 16, 2021, at 7:24 PM, Chemmama, Ilan <Ilan.Chemmama at ucsf.edu <mailto:Ilan.Chemmama at ucsf.edu>> wrote:
>>> 
>>> Dear Developers, 
>>> 
>>> I am trying to write a PDB for each rotamer in Chimera. 
>>> I run the command: 
>>> `swapaa RES :RESNUM lib Dunbrack criteria manual`
>>> 
>>> I get the enumeration for each rotamers from SCRWL library. 
>>> I was wondering if there was a way to write each of those rotamers into separate PDB file using a script. 
>>> Some residues have large number of possible rotamers and manually selecting the rotamer and saving the PDB file is not tractable. 
>>> 
>>> Thank you very much ! 
>>> Ilan
>>> _______________________________________________
>>> 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 <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/20210217/def01670/attachment.html>


More information about the Chimera-users mailing list