Re: [Rdkit-discuss] Generation of stereo-isomers
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Axel P. <axe...@gm...> - 2015-09-25 06:19:35
|
Hi Soren,
maybe this function which enumerates racemates with one stereocenter
into the corresponding enantiomers might help:
def enum_racemates(sdf_list_or_file, find_only=True, mol_id="molid"):
"""returns: result_sdf::list<mol>, racemic_molids::list<int>
find_only==True: return new sdf as list which contains all the
racemates of the input sdf.
find_only==False: return new sdf as list with ALL input structures,
where the racemates are
replaced by their two enantiomers. The returned
sdf is always
equal in size or larger as the input sdf.
Multiple stereo centers are not yet handled.
In the new sdf the molids are no longer unique and should be reassigned
(remove molid and run calc_props(sdf))."""
result_sdf = Mol_List()
racemic_molids = []
if not isinstance(sdf_list_or_file, list) and
sdf_list_or_file.atEnd(): # sdf is file
print(" * file object is at end, please reload.")
return None
for mol in sdf_list_or_file:
first_undefined = False
chiral_centers = Chem.FindMolChiralCenters(mol,
includeUnassigned=True)
if chiral_centers:
first_center = chiral_centers[0][0]
first_undefined = chiral_centers[0][1] == "?"
if first_undefined:
racemic_molids.append(int(mol.GetProp(mol_id)))
if find_only:
result_sdf.append(mol)
continue
else:
mol1 = Chem.Mol(mol)
mol2 = Chem.Mol(mol)
mol1.GetAtomWithIdx(first_center).SetChiralTag(Chem.rdchem.ChiralType.CHI_TETRAHEDRAL_CW)
mol2.GetAtomWithIdx(first_center).SetChiralTag(Chem.rdchem.ChiralType.CHI_TETRAHEDRAL_CCW)
result_sdf.append(mol1)
result_sdf.append(mol2)
else:
if not find_only: # return ALL mols
result_sdf.append(mol)
return result_sdf, racemic_molids
Please also have a look at this post
http://sourceforge.net/p/rdkit/mailman/message/32390126/ and Toby's
answer which pointed me in the right direction.
Kind regards,
Axel
On 24.09.2015 23:17, Soren Wacker wrote:
> Hi,
>
> is it possible with RDKit to generate all stereoisomers of a given
> compound?
>
> If not, is anyone working on it?
>
> If not, how difficult would it be / what would be the best way to
> implement such a function.
>
> best regards
>
> Soren
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdk...@li...
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
|