You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be an edge case in the UnlabeledSmiles data loader that fails to initialize the edges attribute for a single heavy atom smiles string. This causes a key error when trying to access the edge features.
_collections_abc.py", line 795, in pop value = self[key]
dgl/view.py", line 181, in getitem
return self._graph._get_e_repr(self._etid, self._edges)[key]
KeyError: 'e'
The text was updated successfully, but these errors were encountered:
This is because that you have a single atom and there are no chemical bonds. As a result, the molecular graph has no edges, hence no edge features. For a workaround, try the solution below, which adds self loops.
from dgllife.data import UnlabeledSMILES
from dgllife.utils import mol_to_bigraph, CanonicalAtomFeaturizer, CanonicalBondFeaturizer
from functools import partial
data = UnlabeledSMILES(['C'], mol_to_graph=partial(mol_to_bigraph, add_self_loop=True),
node_featurizer=CanonicalAtomFeaturizer(),
edge_featurizer=CanonicalBondFeaturizer(self_loop=True))
There appears to be an edge case in the UnlabeledSmiles data loader that fails to initialize the edges attribute for a single heavy atom smiles string. This causes a key error when trying to access the edge features.
_collections_abc.py", line 795, in pop value = self[key]
dgl/view.py", line 181, in getitem
return self._graph._get_e_repr(self._etid, self._edges)[key]
KeyError: 'e'
The text was updated successfully, but these errors were encountered: