tessl install tessl/pypi-rdkit@2024.9.0Platform wheels for RDKit - a comprehensive cheminformatics and machine-learning library with Python bindings
Agent Success
Agent success rate when using this tile
89%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
88%
Build a molecular substructure validator that can identify specific structural patterns in chemical compounds and extract matching substructures.
Your implementation should provide functionality to:
Your solution should accept molecules as SMILES strings (standard chemical notation format). For example:
"CCO" represents ethanol"c1ccccc1" represents benzene"CC(=O)Oc1ccccc1C(=O)O" represents aspirinImplement the ability to search for molecular patterns defined using specialized pattern notation. Your implementation should:
For pattern detection, return boolean values indicating presence/absence.
For match extraction, return a list of matches where each match is represented as a tuple of atom indices that participate in the substructure.
"CCO" and a hydroxyl pattern "[OH]", the validator detects the pattern is present @test"CC(=O)Oc1ccccc1C(=O)O" and a carboxylic acid pattern "C(=O)O", the validator extracts exactly two matches @test"c1ccccc1" and an aromatic ring pattern "c1ccccc1", the validator confirms the pattern exists @test"CC(=O)C" and a carbonyl pattern "C=O", the validator identifies one match with the correct atom indices @test@generates
def has_pattern(smiles: str, pattern: str) -> bool:
"""
Check if a molecule contains a specific structural pattern.
Args:
smiles: SMILES string representation of the molecule
pattern: Pattern definition to search for
Returns:
True if pattern is found, False otherwise
"""
pass
def find_matches(smiles: str, pattern: str) -> list:
"""
Find all instances of a pattern in a molecule.
Args:
smiles: SMILES string representation of the molecule
pattern: Pattern definition to search for
Returns:
List of tuples, where each tuple contains atom indices of a match
"""
pass
def analyze_patterns(smiles: str, patterns: dict) -> dict:
"""
Analyze a molecule against multiple patterns.
Args:
smiles: SMILES string representation of the molecule
patterns: Dictionary mapping pattern names to pattern definitions
Returns:
Dictionary mapping pattern names to their match counts
"""
passProvides cheminformatics capabilities for molecular analysis.