Hi Zhenting,

you mean sort by a property value?
For example, this would sort your list by decreasing value of the ACTIVITY property (e.g., assuming it is a pIC50):

mol_list.sort(key=lambda m: float(m.GetProp("ACTIVITY")), reverse=True)

Cheers,
p.

On 03/04/2020 16:38, Zhenting Gao wrote:
Hi,

I create a list of mol objects, now I want to sort these mol objects, so that I can save the top 100 mols into an SDF file.
Could you help?

Best
Zhenting
4/3/2020


_______________________________________________
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