CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-rdkit

Platform wheels for RDKit - a comprehensive cheminformatics and machine-learning library with Python bindings

89

1.01x
Overview
Eval results
Files

task.mdevals/scenario-8/

Molecular Weight Analysis Tool

Build a molecular weight analysis tool that processes chemical structures and calculates their molecular weights.

Requirements

Your tool should provide functionality to:

  1. Calculate standard molecular weights for molecules provided as SMILES strings
  2. Calculate exact molecular weights (considering isotopes) for molecules
  3. Analyze multiple molecules and return their molecular weight information
  4. Filter molecules by molecular weight range

Input/Output Specifications

Input Format

Your tool should accept:

  • Individual SMILES strings representing chemical structures
  • Lists of SMILES strings for batch processing

Output Format

For individual molecules, return:

  • Standard molecular weight (averaged atomic masses)
  • Exact molecular weight (considering most abundant isotopes)

For batch processing, return structured data containing:

  • Molecule identifier (SMILES string)
  • Standard molecular weight
  • Exact molecular weight

Test Cases

  • Calculate molecular weight for caffeine (SMILES: CN1C=NC2=C1C(=O)N(C(=O)N2C)C) and verify it returns approximately 194.19 g/mol @test
  • Calculate exact molecular weight for caffeine and verify it differs from the standard molecular weight @test
  • Analyze a list of 5 SMILES strings and verify all molecular weights are calculated correctly @test
  • Filter molecules to find those with molecular weight between 150-250 g/mol from a set of 10 molecules @test

Implementation

@generates

API

def calculate_molecular_weight(smiles: str) -> float:
    """
    Calculate the standard molecular weight of a molecule from its SMILES string.

    Args:
        smiles: SMILES string representing the molecule

    Returns:
        Standard molecular weight in g/mol

    Raises:
        ValueError: If the SMILES string is invalid
    """
    pass

def calculate_exact_molecular_weight(smiles: str) -> float:
    """
    Calculate the exact molecular weight of a molecule from its SMILES string.

    Args:
        smiles: SMILES string representing the molecule

    Returns:
        Exact molecular weight in g/mol

    Raises:
        ValueError: If the SMILES string is invalid
    """
    pass

def analyze_molecules(smiles_list: list[str]) -> list[dict]:
    """
    Analyze multiple molecules and return their molecular weight information.

    Args:
        smiles_list: List of SMILES strings

    Returns:
        List of dictionaries containing:
            - 'smiles': the SMILES string
            - 'molecular_weight': standard molecular weight
            - 'exact_molecular_weight': exact molecular weight
    """
    pass

def filter_by_weight(smiles_list: list[str], min_weight: float, max_weight: float) -> list[str]:
    """
    Filter molecules by molecular weight range.

    Args:
        smiles_list: List of SMILES strings
        min_weight: Minimum molecular weight threshold (g/mol)
        max_weight: Maximum molecular weight threshold (g/mol)

    Returns:
        List of SMILES strings for molecules within the weight range
    """
    pass

Dependencies { .dependencies }

rdkit { .dependency }

Provides cheminformatics capabilities for molecular analysis.

Install with Tessl CLI

npx tessl i tessl/pypi-rdkit

tile.json