liveBook · Manning

Glaxo Wellcome hard filter

As explained in Build AI Drug Discovery Pipelines

The Glaxo Wellcome hard filter is a rule-based substructure filter for removing compounds with undesirable structural motifs from chemical libraries.

The Glaxo Wellcome hard filter removes library compounds containing undesirable structural motifs. It encodes 55 structural alerts as SMARTS patterns and automatically rejects any molecule matching one through RDKit substructure search. section 2.3.2

A practical filtering workflow:

  • Load SMARTS alerts, convert them with MolFromSmarts(), and discard invalid patterns. section 2.3.2
  • Apply HasSubstructMatch() to each molecule, record matched alerts, and retain only compounds without matches. section 2.3.2
  • Interpret rejection counts alongside earlier filters, because overlapping liabilities can make later filters appear redundant. section 2.3.2

Library-scale result

After Rule of Five, PAINS, and BRENK filtering, the Glaxo filter rejected 135 of 105,630 compounds, leaving 105,495 compliant molecules, or 99.9% of the input. Betalactams, nitroso groups, and crown ethers were the three most common alerts. section 2.3.2

Listing 2.6 Loading SMARTS
from rdkit.Chem import Draw, MolFromSmarts
def load_glaxo_alerts():
    alerts_df = pd.read_csv("data/ch02/glaxo_structural_alerts.csv")
    alerts_df["ROMol"] = alerts_df.smarts.apply(MolFromSmarts)    #A
        
    invalid_count = alerts_df.ROMol.isnull().sum()
    if invalid_count > 0:    #B
        print(f"Warning: {invalid_count} invalid SMARTS patterns")
        alerts_df = alerts_df.dropna(subset=['ROMol'])
    print(f"Loaded {len(alerts_df)} Glaxo Wellcome structural alerts")
    return alerts_df
glaxo_alerts = load_glaxo_alerts()
>> Loaded 55 Glaxo Wellcome structural alerts

Inspect the SMARTS-loading implementation and its invalid-pattern check. section 2.3.2

Listing 2.7 Applying a Custom Substructure Filter
def apply_glaxo_filters(df, alerts, mol_col='mol'):
    df = df.copy()
    glaxo_sa_matches = []
    
    def check_glaxo_match(mol, alerts_df):    #A
        match_ = False
        for _, alert in alerts_df.iterrows():
            if mol is not None and mol.HasSubstructMatch(alert.ROMol):
                glaxo_sa_matches.append({
                    "mol": mol,
                    "alert": alert.ROMol,
                    "description": alert.description,
                })
                match_ = True    #B
        return match_
    
    df['GLAXO_match'] = df[mol_col].apply(
        check_glaxo_match, alerts_df=alerts
    )
    df['GLAXO_compliant'] = ~df['GLAXO_match']
    filtered_df = df[df['GLAXO_compliant']].copy()
    match_df = pd.DataFrame(glaxo_sa_matches)    
    return df, filtered_df, match_df    #C
 
specs_ro5_pains_brenk_compliant, specs_filtered, glaxo_match_df = \
    apply_glaxo_filters(specs_ro5_pains_brenk_compliant, glaxo_alerts)

Inspect the custom RDKit substructure-filter implementation and match reporting. section 2.3.2

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Explains SMARTS loading, invalid-pattern handling, substructure matching, and filter-order effects, but not toxicity certainty.
Examples
Uses betalactams, nitroso groups, crown ethers, acylhydrazides, thiols, and reactive sulfur-containing motifs as alert examples.
What it assumes
Assumes molecule records and basic substructure concepts while teaching SMARTS-based pattern matching from the implementation level.
What you can do after
Apply it via RDKit to load SMARTS alerts, identify matching molecules, report alerts, and produce a compliant library.
How it connects
Connects SMARTS and substructure searching with PAINS, BRENK, Rule of Five, and structural-alert filtering.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.