MKorablyov / LambdaZero

4 stars 0 forks source link

add method to MolMDP to compute parent transitions #159

Open bengioe opened 3 years ago

bengioe commented 3 years ago

Adds a method to MolMDP compute the parents of a given molecule.

mdp.parents(mol) returns a list of tuples (m, (blockidx, stemidx)) such that, when mdp.molecule == m calling mdp.add_block(blockidx, stemidx) yields that mdp.molecule == mol. In other words, mol is reconstructed by applying the action (blockidx, stemidx) on m.

Note that due to block attachment symmetry (there are many was to attach to a new block), some blockidxs translation is necessary. As such, mol is not exactly reconstructed in the block-space. The block indices of the BlockMoleculeData instance might differ between mol and the reconstructed molecule, but their atom-graph or RDkit Mol representation will be exactly equivalent.