sustainable-processes / pura

Clean chemical data quickly
MIT License
10 stars 3 forks source link

Standardize identifiers fails on bad SMILES #24

Closed marcosfelt closed 1 year ago

marcosfelt commented 1 year ago

Pd(OAc)2 misbehaves:

.../pura/pura_test_v2.py
Batch:   0%|                                                                                                                                          | 0/1 [00:00<?, ?it/s/.../pura/compound.py:101: UserWarning: Warning: SMILES of a mixture, rather than a pure compound, was found. [00:00<?, ?it/s]
  warnings.warn(
[12:46:21] SMILES Parse Error: syntax error while parsing: [Pd](|OC(C)=O)|OC(C)=O
[12:46:21] SMILES Parse Error: Failed parsing SMILES '[Pd](|OC(C)=O)|OC(C)=O' for input: '[Pd](|OC(C)=O)|OC(C)=O'
Batch:   0%|                                                                                                                                          | 0/1 [00:01<?, ?it/s]
Traceback (most recent call last):
  File ".../pura/pura_test_v2.py", line 7, in <module>
    resolved = resolve_identifiers(    
  File ".../pura/resolvers.py", line 491, in resolve_identifiers
    return resolver.resolve(
  File ".../pura/resolvers.py", line 237, in resolve
    return loop.run_until_complete(
  File "...//asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File ".../pura/resolvers.py", line 295, in _resolve
    resolved_identifiers.extend([await f for f in batch_bar])
  File ".../pura/resolvers.py", line 295, in <listcomp>
    resolved_identifiers.extend([await f for f in batch_bar])
  File ".../asyncio/tasks.py", line 611, in _wait_for_one
    return f.result()  # May raise f.exception().
  File ".../pura/resolvers.py", line 343, in _resolve_one_compound
    standardize_identifier(identifier)
  File ".../pura/compound.py", line 137, in standardize_identifier
    for a in mol.GetAtoms():
AttributeError: 'NoneType' object has no attribute 'GetAtoms'