Closed thegodone closed 1 year ago
From here:
def _validate_features(features: List[Feature]):
dummy_mol = Chem.MolFromSmiles('CC')
dummy_atom = dummy_mol.GetAtomWithIdx(0)
dummy_bond = dummy_mol.GetBondWithIdx(0)
try:
# Check if features are atom features
_ = [f(dummy_atom) for f in features]
feature_type = 'atom'
except:
try:
# Check if features are bond features
_ = [f(dummy_bond) for f in features]
feature_type = 'bond'
except:
feature_type = None
if feature_type is None:
raise ValueError('Invalid `features`.')
return feature_type
( Not very informative value error :/ )
It checks whether the features of the Featurizer are atom features or bond features by testrunning the Featurizer on atoms or bonds respectively. (Not the prettiest implementation, but it was a quick implementation and it does its job)
So what happened is that it could not run your Featurizer (with its custom feature) on neither atoms nor bonds.
I checked what the error was:
NameError: name 'math' is not defined
So I guess the solution is to import the math library?
I will try to update the code in the near future to give a more informative error. You can keep this issue open.
EDIT: In addition to fixing the error message, should the Feature be implemented too (as a default feature of molgraph)? What is this (atom) feature?
yes it works with import math thanks I did not check this fantastic
I was just testing/experimenting potential new features and does not want to modify your code. OCHEM makes pip install molgraph. I don't want to change that
I would like to add one new atom feature but I don't want to change your features default file.
How to add this atom feature from an new python file ?
I try this but it is not working:
my error: