or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/rdkit@2024.9.x
tile.json

tessl/pypi-rdkit

tessl install tessl/pypi-rdkit@2024.9.0

Platform 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%

task.mdevals/scenario-6/

Molecular Substructure Validator

Build a molecular substructure validator that can identify specific structural patterns in chemical compounds and extract matching substructures.

Requirements

Your implementation should provide functionality to:

  1. Pattern Detection: Check whether molecules contain specific structural patterns
  2. Match Extraction: Find and return all instances of a pattern within a molecule
  3. Multi-pattern Analysis: Analyze molecules against multiple patterns simultaneously

Specifications

Input Format

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 aspirin

Pattern Matching

Implement the ability to search for molecular patterns defined using specialized pattern notation. Your implementation should:

  • Accept pattern definitions that specify structural features to match
  • Return a boolean indicating pattern presence
  • Extract all matching substructures when a pattern is found

Output Format

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.

Test Cases

  • Given a molecule with SMILES "CCO" and a hydroxyl pattern "[OH]", the validator detects the pattern is present @test
  • Given aspirin "CC(=O)Oc1ccccc1C(=O)O" and a carboxylic acid pattern "C(=O)O", the validator extracts exactly two matches @test
  • Given benzene "c1ccccc1" and an aromatic ring pattern "c1ccccc1", the validator confirms the pattern exists @test
  • Given acetone "CC(=O)C" and a carbonyl pattern "C=O", the validator identifies one match with the correct atom indices @test

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

rdkit { .dependency }

Provides cheminformatics capabilities for molecular analysis.