"""
Classifies: CHEBI:25029 leukotriene
"""
from rdkit import Chem

def is_leukotriene(smiles: str):
    """
    Determines if a molecule is a leukotriene based on its SMILES string.
    Leukotrienes have polyene structures, usually derived from arachidonic acid,
    containing conjugated double bonds, carboxyl groups, and may include hydroxyl
    and sulfur-containing groups.

    Args:
        smiles (str): SMILES string of the molecule

    Returns:
        bool: True if molecule is a leukotriene, False otherwise
        str: Reason for classification
    """
    # Parse SMILES
    mol = Chem.MolFromSmiles(smiles)
    if mol is None:
        return False, "Invalid SMILES string"

    # Revise carbon count to encompass broader variations in chains
    c_count = sum(1 for atom in mol.GetAtoms() if atom.GetAtomicNum() == 6)
    if not (18 <= c_count <= 58):
        return False, f"Unusual carbon count: found {c_count} carbons"

    # Conjugated double bond patterns - expanded possibilities
    conjugated_patterns = [
        Chem.MolFromSmarts("[#6]=[#6]-[#6]=[#6]-[#6]=[#6]"),
        Chem.MolFromSmarts("[#6]-[#6]=[#6]-[#6]=[#6]-[#6]=[#6]"),
        Chem.MolFromSmarts("[#6]=[#6]-[#6]=[#6]"),
        Chem.MolFromSmarts("[#6]-[#6]=[#6]-[#6]=[#6]"),
        Chem.MolFromSmarts("[#6]-[#6]=[#6]-[#6]-[#6]=[#6]"),
        Chem.MolFromSmarts("[#6]=[#6]-[#6]=[#6]-[#6]=[#6]-[#6]"),
    ]
    if not any(mol.HasSubstructMatch(pattern) for pattern in conjugated_patterns):
        return False, "No suitable conjugated double bond pattern found"

    # Carboxyl groups presence
    carboxyl_patterns = [Chem.MolFromSmarts("C(=O)[OH]"), Chem.MolFromSmarts("C(=O)[O-]")]
    if not any(mol.HasSubstructMatch(pattern) for pattern in carboxyl_patterns):
        return False, "No carboxyl group (COOH or COO-) detected"

    # Check for hydroxyl groups (flexible count)
    hydroxyl_pattern = Chem.MolFromSmarts("[OX2H]")
    if len(mol.GetSubstructMatches(hydroxyl_pattern)) == 0:
        return False, "No hydroxyl group (OH) found"

    # Consider sulfur - optional due to variety in leukotriene types
    sulfur_count = sum(1 for atom in mol.GetAtoms() if atom.GetAtomicNum() == 16)
    
    # Optional validation if there are distinguishing sulfur patterns

    return True, "Structure matches typical features of leukotrienes"


__metadata__ = {   'chemical_class': {   'id': 'CHEBI:25029',
                          'name': 'leukotriene',
                          'definition': 'Any icosanoid from that family of C20 '
                                        'polyunsaturated fatty acids and their '
                                        'derivatives generated by leukocytes '
                                        'from arachidonic acid, each member '
                                        'having four double bonds of which '
                                        'three are conjugated.',
                          'parents': ['CHEBI:23899'],
                          'xrefs': [   'LIPID_MAPS_class:LMFA0302',
                                       'PMID:10922142',
                                       'PMID:15794321',
                                       'PMID:3001504',
                                       'PMID:6129158',
                                       'PMID:6293196',
                                       'PMID:6311078',
                                       'PMID:8842590',
                                       'PMID:9526099',
                                       'PMID:9561094'],
                          'all_positive_examples': []},
    'config': None,
    'message': '\n'
               'Attempt failed: F1 score of 0.3917525773195876 is too low.\n'
               'Outcomes:\n'
               '------\n'
               '\n'
               'True positives: SMILES: '
               'CCCCC\\C=C/C\\C=C/C=C/C=C/[C@@H](SC[C@H](N)C(=O)NCC(O)=O)[C@@H](O)CCCC(O)=O '
               'NAME: leukotriene D4 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: C(C(/C=C/C=C/C=C\\[C@H](CCCC(O)=O)O)=O)/C=C\\CCCCCO '
               'NAME: 12-oxo-20-hydroxyleukotriene B4 REASON: CORRECT '
               'Structure matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC\\C=C/C\\C=C\\C=C\\C=C\\[C@@H](SC[C@H](N)C(O)=O)[C@@H](O)CCCC(O)=O '
               'NAME: 11-trans-LTE4 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: '
               'O[C@@H](CCCC(O)=O)\\C=C/C=C/C=C/[C@H](O)C\\C=C/CCCCC=O NAME: '
               '20-oxoleukotriene B4 REASON: CORRECT Structure matches typical '
               'features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC[C@H](O)[C@H](SC[C@H](N)C(=O)NCC(O)=O)\\C=C\\C=C\\C=C/C\\C=C/CCCC(O)=O '
               'NAME: eoxin D4 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: '
               'O[C@H](CCCC(O)=O)/C=C\\C=C\\C=C\\C(=O)C/C=C\\CCCCC(O)O NAME: '
               '12-oxo-20-dihydroxy-leukotriene B4 REASON: CORRECT Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'S([C@@H]([C@@H](O)CCCC(O)=O)/C=C/C=C/C=C\\C/C=C\\CCCCC)C[C@H](N)C(OC[C@@H](O)CO)=O '
               'NAME: MG(LTE4/0:0/0:0) REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: '
               'C([C@H](/C=C/C=C/C=C\\[C@H](CCCC(O)=O)O)O)/C=C\\CCC(CC)O NAME: '
               '18-hydroxyleukotriene B4 REASON: CORRECT Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'C([C@H](/C=C/C=C/C=C/[C@H](CCCC(O)=O)O)O)/C=C\\CCCCCO NAME: '
               '20-hydroxy-6-trans-leukotriene B4 REASON: CORRECT Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC[C@H](O)[C@H](SC[C@H](NC(=O)CC[C@H](N)C(O)=O)C(=O)NCC(O)=O)\\C=C\\C=C\\C=C/C\\C=C/CCCC(O)=O '
               'NAME: eoxin C4 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: '
               'C([C@H](NC(CC[C@H](N)C(=O)O)=O)C(O)=O)S[C@H](\\C=C\\C=C\\C=C/C/C=C\\CCCCC)[C@@H](O)CCCC(=O)O '
               'NAME: leukotriene F4 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: '
               'CCCCC\\C=C/C\\C=C/C=C/C=C/[C@@H](SC[C@H](NC(=O)CC[C@H](N)C(O)=O)C(=O)NCC(O)=O)[C@@H](O)CCCC(O)=O '
               'NAME: leukotriene C4 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: O[C@H](C/C=C\\CCCCC)/C=C/C=C/C=C/C(=O)CCCC(O)=O '
               'NAME: 5-Oxo-6-trans-leukotriene B4 REASON: CORRECT Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC\\C=C/C[C@H](O)\\C=C\\C=C\\C=C\\[C@@H](O)CCCC(O)=O NAME: '
               'Delta(6)-trans-12-epi-leukotriene B4 REASON: CORRECT Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'C(\\C=C/C=C/C=C/[C@H]([C@@H](O)CCCC(=O)O)SC[C@H](N)C(=O)NCC(=O)O)CCCCCCC '
               'NAME: leukotriene D3 REASON: CORRECT Classes as cysteinyl '
               'leukotriene with sulfur present\n'
               ' * SMILES: O[C@@H](CCCC(O)=O)\\C=C/C=C/C=C/[C@H](O)CC#CCCCCC '
               'NAME: 14,15-dehydro-LTB4 REASON: CORRECT Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'C(/C=C\\CCCCC)\\C=C/C=C/C=C/[C@H]([C@@H](O)CCCC(=O)OC)SC[C@H](NC(=O)CC[C@H](N)C(O)=O)C(NCC(=O)O)=O '
               'NAME: leukotriene C4 methyl ester REASON: CORRECT Classes as '
               'cysteinyl leukotriene with sulfur present\n'
               ' * SMILES: '
               'CCCCC\\C=C/C[C@H](O)\\C=C\\C=C\\C=C/[C@@H](O)CCCC(O)=O NAME: '
               '12-epi-leukotriene B4 REASON: CORRECT Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'O[C@@H](CCCC(O)=O)\\C=C/C=C/C=C/[C@H](O)C/C=C\\C/C=C\\CC NAME: '
               'leukotriene B5 REASON: CORRECT Structure matches typical '
               'features of leukotrienes\n'
               ' * SMILES: '
               'C(/C=C\\CCCCC(=O)O)\\C=C/C=C/C=C/[C@H]([C@@H](O)CCCC(=O)O)SC[C@H](N)C(=O)O '
               'NAME: 20-carboxyleukotriene E4 REASON: CORRECT Classes as '
               'cysteinyl leukotriene with sulfur present\n'
               ' * SMILES: '
               'C([C@H](/C=C/C=C/C=C\\[C@H](CCCC(O)=O)O)O)/C=C\\CCCCC(O)O '
               'NAME: 20,20-dihydroxyleukotriene B4 REASON: CORRECT Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'C(/C=C\\CCCCC(=O)[H])\\C=C/C=C/C=C/[C@H]([C@@H](O)CCCC(=O)O)SC[C@H](N)C(=O)O '
               'NAME: 20-oxoleukotriene E4 REASON: CORRECT Classes as '
               'cysteinyl leukotriene with sulfur present\n'
               ' * SMILES: '
               'OC(O)(O)CCCC/C=C\\CC(=O)\\C=C\\C=C\\C=C/[C@H](O)CCCC(O)=O '
               'NAME: 12-Oxo-20-trihydroxy-leukotriene B4 REASON: CORRECT '
               'Structure matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CC[C@@H](O)\\C=C\\C=C/C\\C=C\\C=C\\C=C\\C1OC1CCCC(O)=O NAME: '
               '5,6-Epoxy-18R-HEPE REASON: CORRECT Structure matches typical '
               'features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC\\C=C/C[C@@H](O)\\C=C\\C=C\\C=C\\[C@@H](O)CCCC(O)=O NAME: '
               '6-trans-leukotriene B4 REASON: CORRECT Structure matches '
               'typical features of leukotrienes\n'
               'False positives: SMILES: '
               'C(\\CC)=C\\C/C=C\\CC(/C=C/C=C\\C/C=C\\CCCC(=O)O)O NAME: '
               '12-HEPE REASON: WRONGLY CLASSIFIED Structure matches typical '
               'features of leukotrienes\n'
               ' * SMILES: '
               'O=C1OC([C@@H]2CCC=3[C@]4([C@](C([C@H]5[C@H](O)C[C@@H](C5)[C@@](OC(=O)C)(C(=O)O)C)CC4)(C)CCC3C=C2C=C1)C)(C)C '
               'NAME: Kadhenrischinin E REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'S([C@H]([C@H](O)CCCC(O)=O)/C=C/C=C/C=C\\C/C=C\\C/C=C\\CC)C[C@H](N)C(=O)NCC(O)=O '
               'NAME: Leukotriene D5 REASON: WRONGLY CLASSIFIED Classes as '
               'cysteinyl leukotriene with sulfur present\n'
               ' * SMILES: '
               'O[C@@H](CCCC(O)=O)/C=C\\C=C\\C=C\\[C@H](O)C/C=C\\C=C\\[C@@H](O)CCO '
               'NAME: 20-Hydroxy-Resolvin E1 REASON: WRONGLY CLASSIFIED '
               'Structure matches typical features of leukotrienes\n'
               ' * SMILES: '
               'C(\\CCC(O)=O)=C\\C[C@@H]([C@@H](\\C=C\\C=C\\C=C/C=C/[C@H](C/C=C\\CC)O)O)O '
               'NAME: resolvin D1 REASON: WRONGLY CLASSIFIED Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'O=C1[C@]2([C@@H](C=C[C@@H]3[C@@H]2C[C@@H](OC(=O)C)[C@@H]([C@H]3O)C)C[C@H]([C@@]14C(=O)OC(C4=O)CO)C=CC=CC=CC(=O)O)C '
               'NAME: Lucensimycin B REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'C12(C(CCCC1(C)O2)(C)C)/C=C/C(=C/C=C/C(=C/C(O[C@H]3[C@@H]([C@H]([C@@H]([C@H](O3)C(=O)O)O)O)O)=O)/C)/C '
               'NAME: 1-O-(5,6-epoxyretinoyl)-beta-D-glucuronic acid REASON: '
               'WRONGLY CLASSIFIED Structure matches typical features of '
               'leukotrienes\n'
               ' * SMILES: '
               'O=C(O)/C=C/C=C/C=C/[C@@H]1[C@@](O)(C(=C[C@H]2[C@H]1CC=C(C2)C)C)[C@]3(O[C@@H]3[C@@H](CC)C)C '
               'NAME: Cladobotric acid A REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: OC(C/C=C\\C/C=C\\CCCCC)\\C=C/C=C/C/C=C\\C(O)=O '
               'NAME: 9-hydroxy-2z,5e,7z,11z,14z-eicosapentaenoic acid REASON: '
               'WRONGLY CLASSIFIED Structure matches typical features of '
               'leukotrienes\n'
               ' * SMILES: '
               'O=C1C=C2[C@@H]3[C@](O)(CCC[C@H]3/C=C(/C=C(\\OC)/C=C/C(=O)O)\\C)O[C@H]2[C@@H]4[C@H]1O4 '
               'NAME: JBIR-24 REASON: WRONGLY CLASSIFIED Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'C(C([O-])=O)C/C=C\\C/C=C\\C/C=C\\C=C\\[C@@H](C/C=C\\C/C=C\\CC)O '
               'NAME: (14R)-HDoHE(1-) REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CC/C=C\\C\\C=C/C=C/C(C(/C=C/C=C\\C(CCCCCC(=O)[O-])O)O)O NAME: '
               'resolvin T2(1-) REASON: WRONGLY CLASSIFIED Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'C(CC/C=C\\C/C=C\\C/C=C\\C\\C=C/C=C/[C@@H](C/C=C\\CC)O)(=O)[O-] '
               'NAME: 17(R)-HDoHE(1-) REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'O=C(O)/C=C/C=C/C1=C(C=C[C@@H]2[C@@H]1[C@@H](C[C@](C2)(O)C)C)C '
               'NAME: Tanzawaic acid L REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC\\C=C/C[C@@H](O)\\C=C\\C=C\\C=C/[C@@H](O)CCCC([O-])=O '
               'NAME: leukotriene B4(1-) REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: C(=CC=C/C=C/C(C(C/C=C\\CC)O)O)C=CC(CCCCCC(O)=O)O '
               'NAME: '
               '7,16,17-trihydroxy-(14E,19Z)-docosa-8,10,12,14,19-pentaenoic '
               'acid REASON: WRONGLY CLASSIFIED Structure matches typical '
               'features of leukotrienes\n'
               ' * SMILES: '
               'O=C\\1NC(CC(O)(C(=O)O)C(C)C)C(/C1=C(\\O)/C=C/C=C/CCC)=O NAME: '
               'Demethyl-harzianic acid REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'CCCCC[C@H](O)CC\\C=C/C=C/C=C/[C@@H](O)[C@@H](O)CCCC([O-])=O '
               'NAME: 13,14-dihydrolipoxin A4(1-) REASON: WRONGLY CLASSIFIED '
               'Structure matches typical features of leukotrienes\n'
               ' * SMILES: '
               'O[C@@H](C/C=C\\CCCCC)/C=C/C=C\\C/C=C\\CCCC(=O)NCC(O)=O NAME: '
               '12-HETE-Gly REASON: WRONGLY CLASSIFIED Structure matches '
               'typical features of leukotrienes\n'
               ' * SMILES: '
               'C(C(O)=O)C/C=C\\C/C=C\\C\\C=C/C=C/[C@@H](C/C=C\\C/C=C\\[C@@H](C)O)O '
               'NAME: (4Z,7Z,10Z,12E,14R,16Z,19Z,21R)-dihydroxydocosahexaenoic '
               'acid REASON: WRONGLY CLASSIFIED Structure matches typical '
               'features of leukotrienes\n'
               ' * SMILES: '
               '[H][C@@]1(CC[C@@]2([H])\\C(CCC[C@]12C)=C\\C=C1\\C[C@@H](O)C[C@H](O)C1=C)[C@H](C)CC(O)=O '
               'NAME: calcitroic acid REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               '[C@@]1(C)(CO)CC[C@@H](C(=C1\\C=C\\C(=C\\C=C\\C(=C\\C(=O)O)\\C)\\C)C)O '
               'NAME: (4S)-4,16-dihydroxyretinoic acid REASON: WRONGLY '
               'CLASSIFIED Structure matches typical features of leukotrienes\n'
               ' * SMILES: '
               'C(CC)(/C=C/C=C\\C/C=C\\C\\C=C/C=C/[C@H](CCCC(=O)O)OO)O NAME: '
               '(5S)-hydroperoxy-18-hydroxy-EPE REASON: WRONGLY CLASSIFIED '
               'Structure matches typical features of leukotrienes\n'
               ' * SMILES: CCCCC[C@H](O)\\C=C\\C1=C(C\\C=C/CCCC(O)=O)C(=O)CC1 '
               'NAME: prostaglandin B2 REASON: WRONGLY CLASSIFIED Structure '
               'matches typical features of leukotrienes\n'
               ' * SMILES: '
               'C(C(O)=O)C/C=C\\C/C=C\\C\\C=C/C=C/[C@H](C/C=C\\C/C=C\\[C@@H](C)O)O '
               'NAME: (4Z,7Z,10Z,12E,14S,16Z,19Z,21R)-dihydroxydocosahexaenoic '
               'acid REASON: WRONGLY CLASSIFIED Structure matches typical '
               'features of leukotrienes\n'
               'False negatives: SMILES: '
               'CCCCC[C@@H]1O[C@H]1\\C=C\\C=C\\C=C/C\\C=C/CCCC(O)=O NAME: '
               'eoxin A4 REASON: MISSED No hydroxyl group (OH) found\n'
               ' * SMILES: '
               'S([C@@H]([C@@H](O)CCCC(O)=O)/C=C/C=C/C=C\\C/C=C\\CCCCC)C[C@H](N)C(O[C@H](COC(=O)CCCCCCCCCCCCCCCCCCCCCCC)COP(OCCN)(O)=O)=O '
               'NAME: PE(24:0/LTE4) REASON: MISSED Unusual carbon count: found '
               '52 carbons\n'
               ' * SMILES: '
               'C([C@H](CC/C=C/C=C\\[C@H](CCCC(O)=O)O)O)/C=C\\CCCCC(O)(O)O '
               'NAME: 10,11-dihydro-20,20,20-trihydroxyleukotriene B4 REASON: '
               'MISSED No suitable conjugated double bond pattern found\n'
               ' * SMILES: CCCCC\\C=C/C\\C=C/C=C/C=C/C[C@H]1O[C@@H]1CCC(O)=O '
               'NAME: 4,5-leukotriene A4 REASON: MISSED No hydroxyl group (OH) '
               'found\n'
               ' * SMILES: '
               'C(/C=C\\CCCCC)[C@H](C/C=C/C=C/[C@H]([C@@H](O)CCCC(=O)O)SC[C@H](N)C(=O)O)O '
               'NAME: (12R)-hydroxy-10,11-dihydroleukotriene E4 REASON: MISSED '
               'No suitable conjugated double bond pattern found\n'
               ' * SMILES: '
               'S([C@@H]([C@@H](O)CCCC(O)=O)/C=C/C=C/C=C\\C/C=C\\CCCCC)C[C@H](N)C(OC[C@@H](OC(=O)CC/C=C\\C/C=C\\C/C=C\\C/C=C\\C/C=C\\CCCCC)COP(OC[C@H](N)C(O)=O)(O)=O)=O '
               'NAME: PS(LTE4/22:5(4Z,7Z,10Z,13Z,16Z)) REASON: MISSED Unusual '
               'carbon count: found 51 carbons\n'
               ' * SMILES: '
               'S([C@@H]([C@@H](O)CCCC(O)=O)/C=C/C=C/C=C\\C/C=C\\CCCCC)C[C@H](N)C(OC[C@@H](OC(=O)CCCCCCCCCCCCCCCCC(CC)C)COP(OC[C@@H](O)CO)(O)=O)=O '
               'NAME: PG(LTE4/a-21:0) REASON: MISSED Unusual carbon count: '
               'found 50 carbons\n'
               ' * SMILES: CCCCC\\C=C/C\\C=C/C=C/C=C/[C@@H]1O[C@H]1CCCC(O)=O '
               'NAME: leukotriene A4 REASON: MISSED No hydroxyl group (OH) '
               'found\n'
               ' * SMILES: '
               'C([C@H](NC(CC[C@@H](C(=O)O)N)=O)C(NCC(=O)O)=O)S[C@@H](\\C=C\\C=C\\CC(C/C=C\\CCCCC)=O)[C@H](O)CCCC(=O)O '
               'NAME: 11,12-dihydro-12-oxoleukotriene C4 REASON: MISSED No '
               'suitable conjugated double bond pattern found\n'
               ' * SMILES: '
               'S([C@@H]([C@@H](O)CCCC(O)=O)/C=C/C=C/C=C\\C/C=C\\CCCCC)C[C@H](N)C(O[C@H](CO\\C=C\\CCCCCCCCCCCCCC)COP(OCCN)(O)=O)=O '
               'NAME: PE(P-16:0/LTE4) REASON: MISSED Unusual carbon count: '
               'found 44 carbons\n'
               '------\n'
               '\n'
               'In your reasoning step, analyze the previous program and the '
               'above outcomes, hypothesizing about what went wrong, and how '
               'to improve.\n',
    'sample_true_negatives': [   {   'smiles': 'P(OCC(OC(=O)CC/C=C\\C/C=C\\C/C=C\\C/C=C\\C/C=C\\C/C=C\\CC)COC(=O)CCC/C=C\\C/C=C\\C/C=C\\CCCCCCCC)(OCCN(C)C)(O)=O',
                                     'name': 'Pe-nme2(20:3(5Z,8Z,11Z)/22:6(4Z,7Z,10Z,13Z,16Z,19Z))',
                                     'reason': 'No carboxyl group (COOH or '
                                               'COO-) detected'},
                                 {   'smiles': 'O1[C@]2([C@@H](O)[C@H](O)[C@@H](O)[C@@]1(OCC[C@H](CCC=C(C(OC[C@]3(O)[C@@H](O)[C@@](OC3)(OC2)[H])=O)C)C)[H])[H]',
                                     'name': 'Urceolide',
                                     'reason': 'No suitable conjugated double '
                                               'bond pattern found'},
                                 {   'smiles': 'CC1=CC(=C(C=C1)C)C(=O)CSC2=NN=C(S2)C',
                                     'name': '1-(2,5-dimethylphenyl)-2-[(5-methyl-1,3,4-thiadiazol-2-yl)thio]ethanone',
                                     'reason': 'Unusual carbon count: found 13 '
                                               'carbons'},
                                 {   'smiles': 'O=C1C=C([C@@]2(C(C[C@@H](C2)O)(C)C)C)CC[C@@]1(O)C',
                                     'name': 'Enokipodin H',
                                     'reason': 'Unusual carbon count: found 15 '
                                               'carbons'},
                                 {   'smiles': 'CCCC[C@](Cn1cncn1)(C#N)c1ccc(Cl)cc1',
                                     'name': '(S)-myclobutanil',
                                     'reason': 'Unusual carbon count: found 15 '
                                               'carbons'},
                                 {   'smiles': 'O=C1O[C@@H]([C@H](NC(=O)[C@@H](NC(=O)CCCCC)CC(=O)O)C(=O)N[C@H](C(=O)N[C@H]2CC[C@H](N([C@H](C(N([C@H](C(N[C@H]1C(C)C)=O)CC3=CC=CC=C3)C)=O)CC(C)C)C2=O)O)CCCCN(C)C)C',
                                     'name': 'Cyanopeptolin D',
                                     'reason': 'No suitable conjugated double '
                                               'bond pattern found'},
                                 {   'smiles': 'O1[C@]2(O)N([C@H](C(=O)N3[C@]2(CCC3)[H])C(C)C)C(=O)[C@@]1(NC(=O)[C@H]4CN([C@]5(C(=C4)C6=C7C(C5)=CNC7=CC=C6)[H])C)C',
                                     'name': 'Ergovaline',
                                     'reason': 'No suitable conjugated double '
                                               'bond pattern found'},
                                 {   'smiles': 'OC(=O)CCCCCCC#CCCCC',
                                     'name': '8-tridecynoic acid',
                                     'reason': 'Unusual carbon count: found 13 '
                                               'carbons'},
                                 {   'smiles': 'CC(=O)N([O-])CCC[C@H](N)C(=O)N[C@@H](CCCN([O-])C(C)=O)C(=O)N[C@@H](CCCN([O-])C(C)=O)C(=O)N[C@@H](CO)C(=O)N[C@H]([C@H](O)[C@H]1S[C@H]([C@H](O)[C@H]1O)n1ccc(=N)n(C)c1=O)C(O)=O',
                                     'name': 'desferrialbomycin epsilon(3-)',
                                     'reason': 'No suitable conjugated double '
                                               'bond pattern found'},
                                 {   'smiles': 'OC[C@H]1O[C@H](O[C@@H]2[C@@H](CO)O[C@H](O[C@@H]3[C@@H](CO)O[C@H](O[C@@H]4[C@@H](CO)O[C@H](O)[C@H](O)[C@H]4O)[C@H](O)[C@H]3O)[C@H](O)[C@H]2O)[C@H](O)[C@@H](O)[C@@H]1O',
                                     'name': 'alpha-maltotetraose',
                                     'reason': 'No suitable conjugated double '
                                               'bond pattern found'}],
    'sample_false_negatives': [],
    'attempt': 3,
    'reasoning': "In revising the `is_leukotriene` function, we'll take into "
                 'account the feedback from the failed attempt, aiming to '
                 'enhance the classification accuracy. The previous classifier '
                 'failed due to several false positives and false negatives, '
                 'indicating the need for refined criteria that align more '
                 'closely with the biochemical characteristics of '
                 'leukotrienes.\n'
                 '\n'
                 '### Areas to Improve\n'
                 '1. **Carbon Count Range**: The existing carbon count range '
                 '(18-32) is too narrow for some leukotrienes causing false '
                 'negatives. We should increase the range to accommodate '
                 'longer chain variations, especially for leukotriene variants '
                 'containing more extensive aliphatic chains.\n'
                 '   \n'
                 '2. **Conjugated Double Bond Patterns**: The false negatives '
                 'suggest the current double-bond patterns do not adequately '
                 'capture all leukotriene structures. The conjugation pattern '
                 'should be more comprehensive, considering both linear and '
                 'branched-chain forms, and further varied in length.\n'
                 '\n'
                 '3. **Functional Groups**:\n'
                 '   - **Hydroxyl (OH) Groups**: Ensure no false negatives '
                 'occur by allowing for the presence of multiple hydroxyl '
                 'groups as leukotrienes can have multiple OH groups.\n'
                 '   - **Sulfur Content**: Cysteinyl leukotrienes have sulfur '
                 'atoms. However, not all leukotrienes have sulfur; thus, '
                 'sulfur should not be a mandatory feature.\n'
                 '\n'
                 '4. **Additional Structural Features**: Consider heterocycles '
                 'and other expert rules from known leukotriene metabolites. '
                 'Ensure patterns like epoxides or keto groups that have been '
                 'missed are incorporated.\n'
                 '\n'
                 '### Updated Plan\n'
                 '- **Carbon Count**: Expand to a more inclusive range (e.g., '
                 '18-58), particularly to accommodate extended-chain '
                 'derivatives and conjugated patterns.\n'
                 '- **Conjugated Systems**: Broaden conjugated bond detection '
                 'to recognize varied combinations and longer lengths.\n'
                 '- **OH Group Relaxation**: Enable flexibility in the count '
                 'and position of hydroxyl groups.\n'
                 '- **Additional Checks**: Confirm epoxide functionality and '
                 'any common cyclic or heterocyclic structures that define '
                 'certain leukotrienes.\n'
                 '\n'
                 'Here is an updated version of the code:',
    'success': True,
    'best': True,
    'error': '',
    'stdout': None,
    'num_true_positives': 56,
    'num_false_positives': 100,
    'num_true_negatives': 4740,
    'num_false_negatives': 0,
    'num_negatives': None,
    'precision': 0.358974358974359,
    'recall': 1.0,
    'f1': 0.5283018867924528,
    'accuracy': 0.9795751633986928,
    'negative_predictive_value': 1.0}