Fragmenstein

repository·master·Indexed 42 days ago

https://github.com/matteoferla/fragmenstein

A molecular tool for merging, linking, and placing compounds, specifically designed for fragment-based drug design. It stitches bound compounds together by creating combined conformers and performing minimization. Key capabilities include combining hits based on atomic overlap and placing follow-up molecules based on parent hits. The tool provides a Python API, a command-line interface, and a Web UI for managing molecular workflows, including analog searching via SmallWorld, PubChem, and Enamine REAL.

Tokens
45.2K
Snippets
137
Records
195
Agent score
53%

What's inside Fragmenstein

  1. Use the Fragmenstein CLI subcommands

    master

    The fragmenstein command is the main entry point for the CLI. It provides several high-level subcommands to manage different stages of the molecular stitching and combinatorial workflow:

    • utils: Utilities for file manipulation, such as minimizing PDB files.
    • monster: Stitching compounds (combining or placing) regardless of a protein context to create 'monster molecules'.
    • victor: Stitching compounds (combining or placing) within a specific protein template.
    • laboratory: Performs combinatorial operations.
    • pipeline: Executes the full end-to-end pipeline.

    Configuration can be adjusted via command-line arguments or environment variables.

    fragmenstein [subcommand] [subcommand-options]
  2. Calculate Combined RMSD (mRMSD)

    master

    The mRMSD submodule provides a multiple RMSD variant that calculates a weighted '2-mean' of RMSDs across multiple hits. Unlike standard RMSD, this implementation does not perform superposition (alignment) and selects atoms based on a provided pairing (by default, atoms that were donors in Fragmenstein).

    Requirements:

    • RDKit is required.
    • pyrosetta is not required.
    • This submodule can be used independently of the Fragmenstein core functionality.
  3. Core capabilities of the Fragmenstein Web UI

    master

    The Web UI provides a graphical interface for the following molecular workflows:

    1. Upload: Import template proteins (PDB format) and hit fragment molecules (SDF, MOL, or PDB formats).
    2. Combine: Perform pairwise merging to combine fragments into new ligand candidates.
    3. Find analogs: Search for analogs using SmallWorld, PubChem, SMILES strings, or by uploading compound libraries (CSV/Excel).
    4. Place: Position analogs within the protein binding site.
    5. Browse results: Use interactive 3D visualization, view outcome charts, and export data via CSV or SDF.
  4. What is Fragmenstein and what are its core tasks?

    master

    Fragmenstein is a tool for merging, linking, and placing compounds by stitching bound compounds together. It performs two primary tasks:

    1. Combine: Merges and links hits based on their atomic overlap.
    2. Place: Places a given follow-up molecule based on one or more parent hits.

    Note on Placement vs. Docking: Unlike traditional docking which uses pre-generated conformers to find a matching pose, Fragmenstein creates a 'monstrous conformer' from the parent(s) and then minimises it (optionally within a protein). This makes it a 'placement' tool rather than a standard docking tool.

  5. Understand the Victor class and its calculation methods

    master

    The Victor class is the primary overarching class for molecular modelling in Fragmenstein. It coordinates several components, including Monster (for calculations) and Igor (for protein neighbourhood awareness).

    Victor follows a specific workflow:

    1. Receives a follow-up test, molecular objects of the inspiration, and a PDB template file.
    2. Calls the Monster class.
    3. Parameterizes the molecule.
    4. Generates constraints.
    5. Calls Igor.
    6. Executes optional extra steps.

    There are two main calculation methods:

    • combine: Used for specific molecular combinations.
    • place: Used to place a molecule into a site.

    Unlike the Monster class, Victor's calculations are dependent on the protein neighbourhood due to its integration with Igor.

  6. Choose a minimization engine

    master

    Fragmenstein supports different engines for energy minimization via the Victor class. You can choose based on your available hardware and required accuracy:

    • PyRosetta (Default): Accessed via the Victor class. Uses Igor for minimization.
    • OpenMM: Accessed via the OpenVictor class. Uses Fritz for minimization (requires a GPU).
    • RDKit: Accessed via the Wictor class. Performs RDKit minimization within a frozen pocket (fastest, ~20s per compound).
    • Quicktor: A variant tailored for speed.

    Note: Igor (PyRosetta) takes approximately 60s per compound on a single core.

  7. Rank Fragmenstein results using custom weights

    master

    Results can be ranked using a ranker function that combines several metrics. A common implementation uses:

    • LE (Ligand Efficiency)
    • comRMSD (Combined RMSD)
    • atom_bonus (based on the number of constrained atoms)
    • novelty_penalty (ratio of unconstrained to constrained atoms)

    Example weights: rank_weights = {'LE': 1., 'comRMSD': 2., 'atom_bonus': 2. , 'novelty_penalty': 5.}

  8. Note on ring merger transitivity and hit order

    master

    The ring merger in Fragmenstein is not transitive. The order in which molecules are passed to the Monster constructor affects the resulting conformation of the positioned_mol. For example, merging [ortho, meta] may produce a different (potentially more distorted) conformation than merging [meta, ortho] for the same compound (e.g., methylcatecol).

    # Example of hit order affecting conformation
    Monster([ortho, meta]).merge().positioned_mol  # decent
    Monster([meta, ortho]).merge().positioned_mol  # indecent
  9. How to handle multiple parent hits for combine or place

    master

    Fragmenstein handles more than two parent fragments by performing iterative operations on pairs of hits. Because the matching approach is exhaustive, inference time increases exponentially with the number of hits.

    Combining multiple fragments

    In the combination route, Fragmenstein:

    1. Identifies overlapping atoms pairwise.
    2. Merges the pair with the most overlaps.
    3. Merges that resulting compound with the next hit, and so on.

    Note: The order of parent compounds matters. It influences priority in ties and determines which element is chosen during a merger (e.g., merging a furan and an unsubstituted benzene will yield one or the other depending on the input order).

    Placing multiple fragments

    In placement, the iteration follows this logic:

    1. Identifies the parent compound with the largest shared substructure.
    2. Iteratively finds the next compound with the most additional substructures consistent with the already mapped structure.

    Tip: If the design history is lost, it is more effective to iterate through pairs and assess results manually, as multiple parents often contribute single atoms while one or two contribute the main scaffold.

  10. Understand merging constraints and edge cases

    master

    Fragmenstein applies several chemical constraints and corrections during the merging process:

    • Warhead Harmonisation: Bonding directly to a warhead is forbidden. When merging hits with different warheads, the system may ignore, keep, or use the first warhead, which can lead to unexpected linkages.
    • Fused Rings: To avoid unlikely chemical structures, bridges are removed, and rings of size 3 or 4 are corrected to size 5 (e.g., cyclopropane-benzene is corrected).
    • Forbidden Structures: Allene structures are forbidden.
    • Perpendicular Rings: If two rings intersect perpendicularly, the system may issue an "emergency bonding" warning and produce unexpected bonding.
    • Spiro Compounds: These are explicitly tolerated.