9
$\begingroup$

I’m a medicinal chemistry undergraduate student who is preparing his dissertation. My idea would be to create a classifier that can distinguish anticancer drugs as active or inactive and distinguish those active in three classes, describing the molecules as a graph. My supervisor suggested me to use the random forest classifier, and to do this I need to convert my graph into a vector trying to keep as many characteristics as possible.

I start from a molecular graph dataset like this:

Data(x=[9, 9], edge_index=[2, 18], edge_attr=[18, 2], y=[0], smiles='COC(=O)C=CN1CC1')

where x, edge_index and edge_attr are a torch tensor, and y is the label (0 is inactive, 1 is activity of class one, 2 is activity of class two, …). To run a random forest classifier I think I must convert them into a vector like a np.array, but I have no idea how to do it. Has anyone had experience on this task?

$\endgroup$
7
  • 1
    $\begingroup$ First, unless "activity class" is really a continuous or semi-continuous variable (e.g. are things in activity class 2 really twice as active as things in activity class 1), you should switch to representing y as a "one-hot" bit vector (for each molecule) or a "one-hot" matrix (for a stack of molecules) where the first column is a 1 if the molecule is activity class 0, the second column is a 1 is the molecule is activity class 1, etc. Only a single 1 should appear in these columns; the rest of the entries are 0. This is why it's called "one-hot". $\endgroup$
    – Curt F.
    Feb 6, 2022 at 18:58
  • 1
    $\begingroup$ Second, the most common approach to converting molecular graphs to vectors is called "fingerprinting". There are many approaches to fingerprinting and many algorithms to do this. Here's one somewhat gentle introduction to the topic. rdkit.org/UGM/2012/… $\endgroup$
    – Curt F.
    Feb 6, 2022 at 19:01
  • 1
    $\begingroup$ You might also want to look into Pytorch Geometric, a Pytorch derivative specifically built for Graph Neural Networks. Also, if you are new to machine learning in chemistry, Deepchem is an excellent library of chemical machine learning examples and tools. $\endgroup$
    – Polydynamical
    Feb 7, 2022 at 1:03
  • $\begingroup$ This blog has some good information. They mention graph2vec but it seems like it has to be pre-trained. A Morgan fingerprint might be the easier way to go. $\endgroup$
    – Cody Aldaz
    Feb 8, 2022 at 2:21
  • $\begingroup$ Have a look at this example: github.com/deepchem/deepchem/blob/master/examples/tutorials/… . It uses DeepChem to generate the graph, but it also shows how the graph is fed into the machine learning model. Also, you may want to try some simpler fingerprints first, like ECFP, APFP, Mordred etc. $\endgroup$
    – S R Maiti
    Feb 8, 2022 at 22:27

0

Browse other questions tagged .