forked from enviPath/enviPy
Merge branch 'develop' into enhancement/licenses
This commit is contained in:
@ -255,6 +255,30 @@ class FormatConverter(object):
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def is_valid_smarts(smarts: str) -> bool:
|
||||
"""
|
||||
Checks whether a given string is a valid SMARTS pattern.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
smarts : str
|
||||
The SMARTS string to validate.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True if the SMARTS string is valid, False otherwise.
|
||||
"""
|
||||
if not isinstance(smarts, str) or not smarts.strip():
|
||||
return False
|
||||
|
||||
try:
|
||||
mol = Chem.MolFromSmarts(smarts)
|
||||
return mol is not None
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def apply(
|
||||
smiles: str,
|
||||
|
||||
Reference in New Issue
Block a user