Bioconjugate Modeler ==================== Creating a Bioconjugate Modeler Project --------------------------------------- The Bioconjugate Modeler helper builds one or more conjugated sets from: * component 1: a completed PDB Reader project, usually an antibody or protein. * linker: a predefined linker, uploaded SDF/SMILES, or search result. * component 2: a predefined payload, uploaded SDF/SMILES, or a PDB Reader project. Before creating the Bioconjugate Modeler project, prepare a completed PDB Reader project for component 1. The force field type is automatically set based on the force field type of the component 1 project. :py:meth:`create_project() ` options: * title (str): Project title. * project_id (str): Completed component 1 PDB Reader project id. Example:: from molcube.bioconjugate import LigandForceField, SearchMethod, SearchSort component_1_project_id = "completed-pdbreader-project-id" project = molcube.create_bioconjugate_project() project.create_project( title="bioconjugate_example", project_id=component_1_project_id, ) Base Workflow ------------- The basic flow follows the same staged selection model as the application: 1. Select and confirm component 1 residues. 2. Search or upload a linker. 3. Select and confirm linker sites. 4. Prepare a component 2 candidate by search, upload, or optional PDB Reader residue selection. 5. Select and confirm component 2 sites. 6. Check and confirm the conjugated structure. 7. Submit all confirmed conjugated sets. Example:: project.select_component1(resname="CYS", chain="PROT_A", resid=9) project.confirm_component1() linkers = project.search_linker("SMPT", topK=5) linker = linkers[0] project.show_linker_site_options(linker) project.select_linker( linker, component_1_site_name="Disulfide", component_2_site_name="Activated Ester", ) project.confirm_linker() payloads = project.search_component2("DGN462", topK=5) payload = payloads[0] project.show_component2_site_options(payload) project.select_component2(payload) project.confirm_component2() project.selection_summary() preview = project.check_structure() project.show_structure(title="Checked bioconjugate structure") project.confirm_structure( bc_id="BC1", ligand_ff_type=LigandForceField.OPENFF_FAST, ) project.create_bioconjugate() Component 1 Selection --------------------- Use :py:meth:`search_component1() ` to filter residues from the source PDB Reader project, and :py:meth:`select_component1() ` to add one residue at a time. ``resid`` can be an ``int`` or ``str``. You can select multiple residues in the same working set as long as they share the same ``resname`` and differ by ``chain`` and/or ``resid``. All selected component 1 residues in the current set must have the same ``resname``. The helper validates that ``resname``, ``chain``, and ``resid`` exist in the component 1 PDB Reader project. Example:: residues = project.search_component1("CYS", topK=10) project.select_component1(resname="CYS", chain="PROT_A", resid=9) project.select_component1(resname="CYS", chain="PROT_B", resid="9") project.confirm_component1() To discard the current working selection, use:: project.clear_selections() Searching Linkers And Component 2 --------------------------------- ``search_linker()`` and ``search_component2()`` support ID/name, SMILES, MCS, and SDF input. The search result order follows the service response for SMILES and MCS searches. ID/name searches use the bundled predefined catalog. Search prints a compact text summary even when ``visual="none"``. Structure details are attached only after the result list is sorted and limited by ``topK``. For the fastest text-only lookup, pass ``visual="none"`` and ``include_structure=False``. To print the available search-filter values before searching, use :py:meth:`show_linker_filter_options() `:: project.show_linker_filter_options() project.show_linker_filter_options(contains="disulfide", max_items=20) :py:meth:`show_component2_filter_options() `:: project.show_component2_filter_options() project.show_component2_filter_options(contains="hela", max_items=20) Text filter values are matched leniently. Case, spaces, and common punctuation differences are ignored for text-based filters such as ``release_mechanism``, ``cleavage_trigger_type``, ``target``, and ``cell_line``. For example, ``"Cleavable"``, ``"cleavable"``, and ``"clea-vable"`` are treated the same. :py:meth:`search_linker() ` options include: * query (str | PathLike): ID/name text, SMILES text, or SDF path. * topK (int): Maximum number of results to return. * method (SearchMethod | str): ``ID_NAME``, ``SMILES``, or ``MCS``. The helper infers whether the input is ID/name text, SMILES text, or an SDF path. * include_structure (bool): Attach SVG/SDF structure payloads to returned hits. * structural_compatibility (bool): Filter by currently selected component 1 or component 2 compatibility. * release_mechanism, cleavage_trigger_type, logp_range, pegylated: Linker filters. * visual (SearchVisualization | str): ``"gallery"``, ``"selected"``, or ``"none"``. * sort_by (SearchSort | str | None): Optional sort order. Prefer ``SearchSort.BEST_MATCH``, ``SearchSort.NAME``, ``SearchSort.LIGHTEST``, or ``SearchSort.HEAVIEST``. Friendly aliases such as ``"best_match"``, ``"name"``, ``"lightest"``, and ``"heaviest"`` also work. The internal values ``"rank"``, ``"name_asc"``, ``"weight_asc"``, and ``"weight_desc"`` are also accepted. :py:meth:`search_component2() ` options include: * query (str | PathLike): ID/name text, SMILES text, or SDF path. * topK (int): Maximum number of results to return. * method (SearchMethod | str): ``ID_NAME``, ``SMILES``, or ``MCS``. The helper infers whether the input is ID/name text, SMILES text, or an SDF path. * include_structure (bool): Attach SVG/SDF structure payloads to returned hits. * structural_compatibility (bool): Filter by currently selected linker compatibility. * cell_line, ic50_range, target: Component 2 filters. * visual (SearchVisualization | str): ``"gallery"``, ``"selected"``, or ``"none"``. * sort_by (SearchSort | str | None): Optional sort order. Prefer ``SearchSort.BEST_MATCH``, ``SearchSort.NAME``, ``SearchSort.LIGHTEST``, or ``SearchSort.HEAVIEST``. Friendly aliases such as ``"best_match"``, ``"name"``, ``"lightest"``, and ``"heaviest"`` also work. The internal values ``"rank"``, ``"name_asc"``, ``"weight_asc"``, and ``"weight_desc"`` are also accepted. * project_id, resname, chain, resid: Optional PDB Reader residue inputs for component 2 search. * use_existing_coordinate (bool): Optional coordinate-handling flag for PDB Reader component 2 mode. Examples:: # ID/name search linkers = project.search_linker("SMPT", topK=5) payloads = project.search_component2("DGN462", topK=5) # SMILES search linkers = project.search_linker( "C1=CC=CC=C1", method=SearchMethod.SMILES, topK=10, sort_by=SearchSort.BEST_MATCH, ) # MCS search payloads = project.search_component2( "C1=CC=CC=C1", method=SearchMethod.MCS, topK=5, ) # SDF path search linkers = project.search_linker("linker.sdf", method=SearchMethod.MCS) payloads = project.search_component2("payload.sdf", method=SearchMethod.MCS) # Fast text-only search linkers = project.search_linker( "C1=CC=CC=C1", method=SearchMethod.SMILES, topK=4, visual="none", include_structure=False, ) Selecting Sites --------------- The linker has two selected sites: * ``component_1_site_name``: Site facing component 1. * ``component_2_site_name``: Site facing component 2. Component 2 has one selected site: * ``linker_site_name``: Site facing the linker. Site names are matched case-insensitively with light normalization. If a site has multiple atom groups, pass a one-based ``*_site_group`` argument. If the site name is ``Any``, pass a zero-based atom index with ``*_atom_index``. ``select_linker()`` and ``select_component2()`` always create pending selections. This is true even after a linker or component 2 has already been confirmed. Calling ``select_linker()`` or ``select_component2()`` again clears the previous confirmed selection for that component, so you must call ``confirm_linker()`` or ``confirm_component2()`` again before checking the structure. Examples:: project.show_linker_site_options(linker) project.select_linker( linker, component_1_site_name="Disulfide", component_2_site_name="Aldehyde/Ketone", component_2_site_group=1, ) project.confirm_linker() project.show_component2_site_options(payload) project.select_component2( payload, linker_site_name="Secondary Amine", ) project.confirm_component2() To preview highlighted sites without changing selection, use:: project.show_linker_site( linker, component1_site="Disulfide", component2_site="Activated Ester", ) project.show_component2_site(payload, linker_site_name="Secondary Amine") ``show_linker_site()`` uses display-only argument names: * ``component1_site`` * ``component2_site`` * ``component1_site_group`` * ``component2_site_group`` * ``component1_atom_index`` * ``component2_atom_index`` ``show_component2_site()`` uses: * ``linker_site`` * ``linker_site_group`` * ``linker_atom_index`` If you omit the ``hit`` argument, the helper displays the currently selected or pending linker/component 2 state in the working conjugated set:: project.show_linker_site() project.show_component2_site() This is especially useful after ``select_linker()`` / ``confirm_linker()`` or ``select_component2()`` / ``confirm_component2()`` because the saved functional group, atom group, and ``Any`` atom index selection are restored automatically. Upload Linker Or Component 2 ---------------------------- Use upload methods when you want to bypass the predefined catalog. Provide either an SDF path or SMILES string. Example:: uploaded_linker = project.upload_linker(sdf_path="linker.sdf") project.select_linker( uploaded_linker, component_1_site_name="Disulfide", component_2_site_name="Activated Ester", ) project.confirm_linker() uploaded_component2 = project.upload_component2( sdf_path="payload.sdf", ) project.select_component2(uploaded_component2) project.confirm_component2(resname="PAY1") Component 2 residue names are finalized in ``confirm_component2()``. They must be 1-4 uppercase alphanumeric characters, for example ``PAY1``. If omitted, a unique ``PAY1``, ``PAY2``, ... value is assigned automatically. Using PDB Reader As Component 2 ------------------------------- ``search_component2()`` can also return a single component 2 candidate from a PDB Reader project by passing ``project_id``, ``chain``, and ``resid``. ``resname`` is optional and is used only as an expected residue-name check. Component 2 PDB Reader mode supports exactly one residue and returns one ``dict`` instead of a list. The returned hit is displayed as ``PDB Reader`` in search output; the actual residue identity is kept in fields such as ``resname``, ``chain``, ``resid``, and ``pdbReaderResidues``. Example:: component2_from_pdb = project.search_component2( project_id="component-2-pdbreader-project-id", resname="CYS", chain="PROT_A", resid=9, ) # search output label: "PDB Reader" project.show_component2_site_options(component2_from_pdb) project.select_component2(component2_from_pdb) project.confirm_component2(resname="PAY2") Checking And Confirming Structure --------------------------------- ``check_structure()`` creates a preview of the current component 1, linker, and component 2 selection. If the preview contains disconnected fragments, ``confirm_structure()`` is blocked until you either upload a fixed SDF or choose to ignore the fragment warning. Pass ``bc_id`` to choose the final Bioconjugate ID. If omitted, a unique ``BC1``, ``BC2``, ... value is assigned. Examples:: preview = project.check_structure() project.show_structure(title="Checked bioconjugate structure") project.confirm_structure(bc_id="BC1") ``show_structure()`` also accepts an explicit structure payload, but if you omit the argument it shows the current working set structure. The helper prefers the latest checked structure and falls back to the current preview when available. If you edited the checked structure externally, pass the edited SDF back in:: preview = project.check_structure(conjugated_sdf="structure.sdf") project.confirm_structure( bc_id="BC2", conjugated_sdf="structure.sdf", ) To proceed with known multi-fragment structures:: project.set_ignore_fragment_warning(True) project.confirm_structure(bc_id="BC3") Managing Multiple Conjugated Sets --------------------------------- After confirming a structure, the set is stored on the project. You can then create a new set, inspect existing sets, update ligand force fields, or delete sets before submission. Example:: project.confirm_structure(bc_id="BC1") confirmed_sets = project.list_conjugated_sets() project.new_conjugated_set() project.select_component1(resname="CYS", chain="PROT_A", resid=10) # repeat linker/component 2 selection... project.confirm_structure(bc_id="BC2") project.conjugated_set_summary(set_number=1) project.show_conjugated_set_structure(set_number=1) project.set_ligand_force_field( LigandForceField.GAFF_FAST, set_number=1, ) project.delete_conjugated_set(set_number=2) To inspect the currently applied working selections before confirming, use:: project.selection_summary() project.show_selected_linker() project.show_selected_component2() Utility Methods --------------- The helper includes a few convenience methods for structure conversion and download. Examples:: smiles = project.sdf_to_smiles("payload.sdf") sdf = project.smiles_to_sdf("CCO") project.smiles_to_sdf("CCO", output_path="ethanol.sdf") project.download_project("bioconjugate.tar.gz") project.download_pdb("bioconjugate.pdb")