Hi Angelica,

if torsion_lists is the tuple of of (non_ring, ring) torsion lists in mol:

torsion_lists = TorsionFingerprints.CalculateTorsionLists(mol)

you can get the same list where the atom index is replaced by a (PDB_atom_serial, PDB_atom_name) tuple as follows:

torsion_lists_sn = [[tuple([[tuple([(
    mol.GetAtomWithIdx(i).GetMonomerInfo().GetSerialNumber(),
    mol.GetAtomWithIdx(i).GetMonomerInfo().GetName().strip()
) for i in t]) for t in tt], v]) for tt, v in tl] for tl in torsion_lists]

which is a rather unreadable nested list comprehension equivalent to the following series of nested loops:

torsion_lists_sn = []
for tl in torsion_lists:
    tl2 = []
    for tt, v in tl:
        tv2 = []
        for t in tt:
            tt2 = []
            for i in t:
                pdb_res_info = mol.GetAtomWithIdx(i).GetMonomerInfo()
                serial = pdb_res_info.GetSerialNumber()
                name = pdb_res_info.GetName().strip()
                tt2.append((serial, name))
            tv2.append(tuple(tt2))
        tl2.append((tv2, v))
    torsion_lists_sn.append(tl2)

Cheers,
p.

On 03/27/19 21:43, Angelica Parente wrote:
I’m trying to use the module |rdkit.Chem.TorsionFingerprints.||CalculateTorsionLists to print out a list of torsions. I pass in a PDB file using Chem.MolFromPDBFile, and would ideally like the torsion list to specify the atoms using the atom names and/or numbers from the PDB file. Right now I get a list of rdkit atom indices, and am not sure how to convert these back to the original PDB naming/numbering schemes. |
*
*
*
*
*Thanks,*
*
*
*Angelica
*
|
|
|
|
|
|




_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to