Random seed for Chem.MolToSmiles(mol, doRandom=True) #6489
-
Dear all, I am looking for help with the doRandom option in Chem.MolToSmiles. This function makes sure that SMILES that are returned are random which is a necessity for the functionality of my code. I also need to set the seed, however, random.seed(42) and np.random.seed(42) do not seem to effect this function. As far as I'm aware there is not yet an option to set the seed using rdkits randomSeed() parameter, which is is a possibility in, for instance, the AllChem.EmbedMolecule function. Would anybody know of a way to fix the seed when using doRandom=True? Or is there a possibility that randomSeed() can be added to this function? The code looks like this: Any help would be greatly appreciated! Kind regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @daanjiskoot, at the moment it's not possible to control the random number seed which is used (or to reset it).
but the RNG seed it not reset between calls to
(These results were generated on my windows laptop, but they should be the same on linux or the mac) I believe this behavior gives you the option for reproducibility when you need it without further complicating the API for |
Beta Was this translation helpful? Give feedback.
-
Hello, I had the same problem and the use of:
Instead of (I think "isomericSmiles" and "kekuleSmiles" are not mandatory but they were needed in my case) Not sure if there will be people out there with the same problem but as I needed this without restarting the script if possible, I thought this might be useful to some other people. Best and thank you so much for the great work with rdkit, Theo |
Beta Was this translation helpful? Give feedback.
Hi @daanjiskoot, at the moment it's not possible to control the random number seed which is used (or to reset it).
The RNG is seeded at program start, so the results that the RDKit generates should be reproducible across runs, as this shows:
but the RNG seed it not reset between calls to
MolToSmiles()
, so you get different results…