molecularsets/moses

Is the validity check of smiles in moses the same as RDKit?

Opened this issue · 0 comments

I have this function to check the validity of smiles that is based on RDKit :

from rdkit import Chem
def checksmi(smi):
    m = Chem.MolFromSmiles(smi,sanitize=False)
    if m is None:
        #print('invalid SMILES')
        v = 0
    else:
        #print("valid smiles.")
        v = 1
        try:
            Chem.SanitizeMol(m)
        except:
            #print('invalid chemistry')
            v = 0
     return v

is this the same as the validity given by moses when we type the below code, does moses validity checks for valid smiles (grammar) or also valid chemistry:

import moses
metrics = moses.get_all_metrics(list_to_evaluate)
print(metrics)
{'valid': 0.8571428571428572,
 'unique@1000': 1.0,
 'unique@10000': 1.0,
 'FCD/Test': 52.710485508527654,
 'SNN/Test': 0.2737954681118329,
 'Frag/Test': 0.26661035762724716,
 'Scaf/Test': nan,
 'FCD/TestSF': 54.30007202575979,
 'SNN/TestSF': 0.23380156854788461,
 'Frag/TestSF': 0.3777161249748274,
 'Scaf/TestSF': nan,
 'IntDiv': 0.7468284898334079,
 'IntDiv2': 0.578859979666881,
 'Filters': 0.6666666666666666,
 'logP': 3.048971913797608,
 'SA': 0.8860967344024802,
 'QED': 0.3780715536953819,
 'weight': 184.10358258270205,
 'Novelty': 1.0}