Skip to main content

benchling.utils.write_molecule

function create_molecule_obj

Create a molecule object to create in Benchling

Parameters

entity_name : str
        Name of the molecule to create
folder_id : str
        ID of the folder to create the molecule in
input_schema_id : str
        ID of the molecule schema to use
registry_id : str
        ID of the registry to use
fields : dict | None
        Dictionary of fields to add to the molecule
author_id : str | None
        ID of the author to assign to the molecule
naming_strategy : NamingStrategy
        Naming strategy to use for the molecule, by default NamingStrategy.NEW_IDS

Returns

molecule_item : MoleculeCreate
        Molecule object to create in Benchling

function create_molecule

Creates a new molecule in Benchling.

Args:
        molecule_service (MoleculeServce): The initiated MoleculeService.
        molecule_obj (MoleculeCreate): The molecule object to create.

Returns:
        dict: A dictionary containing the name and ID of the newly created molecule.

function create_molecules_bulk

Sends an async task to Benchling to start creating a list of molecules.

Args:
        benchling_context (BenchlingContext): The Benchling context object.
        molecule_objs (List): A list of molecule objects to create.
        molecule_service (MoleculeService): The initiated MoleculeService.
        wait (bool, optional): Whether to wait for the task to complete. Defaults to True.
        error_on_fail (bool, optional): Whether to raise an error if the task fails. Defaults to True.

Returns:
        list[str]: A list of task IDs for each bulk create request.

function update_molecules_bulk

Update a list of molecules in bulk on Benchling.

Args:
        benchling_context (BenchlingContext): The Benchling context object.
        molecule_objs (List): A list of molecule objects to update.
        molecule_service (MoleculeService): The initiated MoleculeService.
        wait (bool, optional): Whether to wait for the task to complete. Defaults to True.
        error_on_fail (bool, optional): Whether to raise an error if the task fails. Defaults to True.

Returns:
        List: A list of task IDs for the molecule update tasks.

function update_molecule

Updates a molecule object in Benchling.

Args:
        benchling_context (BenchlingContext): The Benchling context object.
        molecule_obj (MoleculeUpdate): The molecule object to update.

Returns:
        dict: A dictionary containing the updated molecule's name and ID.

function update_molecule_obj

Create a molecule update object to update in Benchling

Parameters

existing_molecule : Molecule
        Molecule to update
folder_id : str
        ID of the folder to create the entity in
input_schema_id : str
        ID of the schema to use for the entity
fields : dict | None
        Dictionary of fields to add to the entity, by default None
author_id : str | None
        ID of the author to assign to the entity, by default None
bulk_update : bool
        Whether to return a MoleculeBulkUpdate object instead of a MoleculeUpdate object

Returns

dict[str, str]
        Dictionary containing the name and ID of the created entity