Hi Paolo,
Your previous reply already helped me.
If I need to sort multiple properties, with different directions, What would
the code be?
Would it be easier to put mols into a pandas dataframe? If so, how to do it?
Best regards
Zhenting
---Original---
From: "Paolo Tosco"<paolo.tosco.m...@gmail.com>
Date: Fri, Apr 3, 2020 23:58 PM
To: "Zhenting
Gao"<183310...@qq.com>;"Rdkit-discuss"<Rdkit-discuss@lists.sourceforge.net>;
Subject: Re: [Rdkit-discuss] How to sort a list of mol objects
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