ncsw_data.storage.cacs.sqlite_db.utility.insert

The ncsw_data.storage.cacs.sqlite_db.utility package insert_ module.

Classes

CaCSSQLiteDatabaseInsertUtility

The computer-assisted chemical synthesis (CaCS) SQLite database insert utility class.

Module Contents

class ncsw_data.storage.cacs.sqlite_db.utility.insert_.CaCSSQLiteDatabaseInsertUtility

The computer-assisted chemical synthesis (CaCS) SQLite database insert utility class.

static insert_and_select_archive_source(db_session: sqlalchemy.orm.Session, as_name: str, as_version: str, as_file_name: str, as_created_by: str) int

Insert and select an archive source from the database.

Parameters:
  • db_session – The session of the database.

  • as_name – The name of the archive source.

  • as_version – The version of the archive source.

  • as_file_name – The file name of the archive source.

  • as_created_by – The user of the database inserting the archive source.

Returns:

The ID of the archive source.

static _insert_and_select_archive_compounds(db_session: sqlalchemy.orm.Session, ac_smiles_strings: Iterable[str], acs_created_by: str) List[int]

Insert and select the archive chemical compounds from the database.

Parameters:
  • db_session – The session of the database.

  • ac_smiles_strings – The SMILES strings of the archive chemical compounds.

  • acs_created_by – The user of the database inserting the archive chemical compounds.

Returns:

The IDs of the archive chemical compounds.

static _insert_archive_compound_sources(db_session: sqlalchemy.orm.Session, ac_ids: Iterable[int], as_id: int) None

Insert the archive chemical compound sources into the database.

Parameters:
  • db_session – The session of the database.

  • ac_ids – The IDs of the archive chemical compounds.

  • as_id – The ID of the archive source.

static insert_archive_compounds(db_session: sqlalchemy.orm.Session, acs: Iterable[str], acs_created_by: str, as_id: int) None

Insert the archive chemical compounds into the database.

Parameters:
  • db_session – The session of the database.

  • acs – The archive chemical compounds: [ ac_smiles, … ].

  • acs_created_by – The user of the database inserting the archive chemical compounds.

  • as_id – The ID of the archive source.

static _insert_and_select_archive_reactions(db_session: sqlalchemy.orm.Session, ar_smiles_strings: Iterable[str], ars_created_by: str) List[int]

Insert and select the archive chemical reactions from the database.

Parameters:
  • db_session – The session of the database.

  • ar_smiles_strings – The SMILES strings of the archive chemical reactions.

  • ars_created_by – The user of the database inserting the archive chemical reactions.

Returns:

The IDs of the archive chemical reactions.

static _insert_archive_reaction_sources(db_session: sqlalchemy.orm.Session, ar_ids: Iterable[int], as_id: int) None

Insert the archive chemical reaction sources into the database.

Parameters:
  • db_session – The session of the database.

  • ar_ids – The IDs of the archive chemical reactions.

  • as_id – The ID of the archive source.

static insert_archive_reactions(db_session: sqlalchemy.orm.Session, ars: Iterable[str], ars_created_by: str, as_id: int) None

Insert the archive chemical reactions into the database.

Parameters:
  • db_session – The session of the database.

  • ars – The archive chemical reactions: [ ar_smiles, … ].

  • ars_created_by – The user of the database inserting the archive chemical reactions.

  • as_id – The ID of the archive source.

static _insert_and_select_archive_compound_patterns(db_session: sqlalchemy.orm.Session, acp_smarts_strings: Iterable[str], acps_created_by: str) List[int]

Insert and select the archive chemical compound patterns from the database.

Parameters:
  • db_session – The session of the database.

  • acp_smarts_strings – The SMARTS strings of the archive chemical compound patterns.

  • acps_created_by – The user of the database inserting the archive chemical compound patterns.

Returns:

The IDs of the archive chemical compound patterns.

static _insert_archive_compound_pattern_sources(db_session: sqlalchemy.orm.Session, acp_ids: Iterable[int], as_id: int) None

Insert the archive chemical compound pattern sources into the database.

Parameters:
  • db_session – The session of the database.

  • acp_ids – The IDs of the archive chemical compound patterns.

  • as_id – The ID of the archive source.

static insert_archive_compound_patterns(db_session: sqlalchemy.orm.Session, acps: Iterable[str], acps_created_by: str, as_id: int) None

Insert the archive chemical compound patterns into the database.

Parameters:
  • db_session – The session of the database.

  • acps – The archive chemical compound patterns: [ acp_smarts, … ].

  • acps_created_by – The user of the database inserting the archive chemical compound patterns.

  • as_id – The ID of the archive source.

static _insert_and_select_archive_reaction_patterns(db_session: sqlalchemy.orm.Session, arp_smarts_strings: Iterable[str], arps_created_by: str) List[int]

Insert and select the archive chemical reaction patterns from the database.

Parameters:
  • db_session – The session of the database.

  • arp_smarts_strings – The SMARTS strings of the archive chemical reaction patterns.

  • arps_created_by – The user of the database inserting the archive chemical reaction patterns.

Returns:

The IDs of the archive chemical reaction patterns.

static _insert_archive_reaction_pattern_sources(db_session: sqlalchemy.orm.Session, arp_ids: Iterable[int], as_id: int) None

Insert the archive chemical reaction pattern sources into the database.

Parameters:
  • db_session – The session of the database.

  • arp_ids – The IDs of the archive chemical reaction patterns.

  • as_id – The ID of the archive source.

static insert_archive_reaction_patterns(db_session: sqlalchemy.orm.Session, arps: Iterable[str], arps_created_by: str, as_id: int) None

Insert the archive chemical reaction patterns into the database.

Parameters:
  • db_session – The session of the database.

  • arps – The archive chemical reaction patterns: [ arp_smarts, … ].

  • arps_created_by – The user of the database inserting the archive chemical reaction patterns.

  • as_id – The ID of the archive source.

static _insert_and_select_workbench_compounds(db_session: sqlalchemy.orm.Session, wc_smiles_strings: Iterable[str], wcs_are_building_blocks: bool | None, wcs_created_by: str) Dict[str, int]

Insert and select the workbench chemical compounds from the database.

Parameters:
  • db_session – The session of the database.

  • wc_smiles_strings – The SMILES strings of the workbench chemical compounds.

  • wcs_are_building_blocks – The indicator of whether the workbench chemical compounds are building blocks.

  • wcs_created_by – The user of the database inserting the workbench chemical compounds.

Returns:

The SMILES string to ID dictionary of the workbench chemical compounds.

static _insert_workbench_compound_archives(db_session: sqlalchemy.orm.Session, ac_ids_and_wc_smiles_strings: Iterable[Tuple[int, str]], wcs_smiles_to_id: Dict[str, int]) None

Insert the workbench chemical compound archives into the database.

Parameters:
  • db_session – The session of the database.

  • ac_ids_and_wc_smiles_strings – The IDs of the archive chemical compounds and SMILES strings of the workbench chemical compounds.

  • wcs_smiles_to_id – The SMILES string to ID dictionary of the workbench chemical compounds.

static insert_workbench_compounds(db_session: sqlalchemy.orm.Session, wcs: Iterable[Tuple[int, str]], wcs_are_building_blocks: bool | None, wcs_created_by: str) None

Insert the workbench chemical compounds into the database.

Parameters:
  • db_session – The session of the database.

  • wcs – The workbench chemical compounds: [ ( ac_id, wc_smiles, ), … ].

  • wcs_are_building_blocks – The indicator of whether the workbench chemical compounds are building blocks.

  • wcs_created_by – The user of the database inserting the workbench chemical compounds.

static _insert_and_select_workbench_reactions(db_session: sqlalchemy.orm.Session, wr_smiles_strings: Iterable[str], wrs_created_by: str) Dict[str, int]

Insert and select the workbench chemical reactions from the database.

Parameters:
  • db_session – The session of the database.

  • wr_smiles_strings – The SMILES strings of the workbench chemical reactions.

  • wrs_created_by – The user of the database inserting the workbench chemical reactions.

Returns:

The workbench chemical reaction SMILES string to ID dictionary.

static _insert_workbench_reaction_archives(db_session: sqlalchemy.orm.Session, ar_ids_and_wr_smiles_strings: Iterable[Tuple[int, str]], wrs_smiles_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction archives into the database.

Parameters:
  • db_session – The session of the database.

  • ar_ids_and_wr_smiles_strings – The IDs of the archive chemical reactions and SMILES strings of the workbench chemical reactions.

  • wrs_smiles_to_id – The SMILES string to ID mapping of the workbench chemical reactions.

static _insert_workbench_reaction_reactant_compounds(db_session: sqlalchemy.orm.Session, wr_smiles_strings_and_wrrc_smiles_strings: Iterable[Tuple[str, str]], wrrcs_created_by: str, wrs_smiles_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction reactant compounds into the database.

Parameters:
  • db_session – The session of the database.

  • wr_smiles_strings_and_wrrc_smiles_strings – The SMILES strings of the workbench chemical reactions and SMILES strings of the workbench chemical reaction reactant compounds.

  • wrrcs_created_by – The user of the database inserting the workbench chemical reaction reactant compounds.

  • wrs_smiles_to_id – The SMILES string to ID mapping of the workbench chemical reactions.

static _insert_workbench_reaction_spectator_compounds(db_session: sqlalchemy.orm.Session, wr_smiles_strings_and_wrsc_smiles_strings: Iterable[Tuple[str, str]], wrscs_created_by: str, wrs_smiles_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction spectator compounds into the database.

Parameters:
  • db_session – The session of the database.

  • wr_smiles_strings_and_wrsc_smiles_strings – The SMILES strings of the workbench chemical reactions and SMILES strings of the workbench chemical reaction spectator compounds.

  • wrscs_created_by – The user of the database inserting the workbench chemical reaction spectator compounds.

  • wrs_smiles_to_id – The SMILES string to ID mapping of the workbench chemical reactions.

static _insert_workbench_reaction_product_compounds(db_session: sqlalchemy.orm.Session, wr_smiles_strings_and_wrpc_smiles_strings: Iterable[Tuple[str, str]], wrpcs_created_by: str, wrs_smiles_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction product compounds into the database.

Parameters:
  • db_session – The session of the database.

  • wr_smiles_strings_and_wrpc_smiles_strings – The SMILES strings of the workbench chemical reactions and SMILES strings of the workbench chemical reaction product compounds.

  • wrpcs_created_by – The user of the database inserting the workbench chemical reaction product compounds.

  • wrs_smiles_to_id – The SMILES string to ID mapping of the workbench chemical reactions.

static insert_workbench_reactions(db_session: sqlalchemy.orm.Session, wrs: Iterable[Tuple[int, str, Iterable[str], Iterable[str], Iterable[str]]], wrs_created_by: str) None

Insert the workbench chemical reactions into the database.

Parameters:
  • db_session – The session of the database.

  • wrs – The workbench chemical reactions: [ ( ar_id, wr_smiles, wrrc_smiles_strings, wrsc_smiles_strings, wrpc_smiles_strings, ), … ].

  • wrs_created_by – The user of the database inserting the workbench chemical reactions.

static _insert_and_select_workbench_compound_patterns(db_session: sqlalchemy.orm.Session, wcp_smarts_strings: Iterable[str], wcps_created_by: str) Dict[str, int]

Insert and select the workbench chemical compound patterns from the database.

Parameters:
  • db_session – The session of the database.

  • wcp_smarts_strings – The SMARTS strings of the workbench chemical compound patterns.

  • wcps_created_by – The user of the database inserting the workbench chemical compound patterns.

Returns:

The SMARTS string to ID dictionary of the workbench chemical compound patterns.

static _insert_workbench_compound_pattern_archives(db_session: sqlalchemy.orm.Session, acp_ids_and_wcp_smarts_strings: Iterable[Tuple[int, str]], wcps_smarts_to_id: Mapping[str, int]) None

Insert the workbench chemical compound pattern archives into the database.

Parameters:
  • db_session – The session of the database.

  • acp_ids_and_wcp_smarts_strings – The IDs of the archive chemical compound patterns and SMARTS strings of the workbench chemical compound patterns.

  • wcps_smarts_to_id – The SMARTS string to ID dictionary of the workbench chemical compound patterns.

static insert_workbench_compound_patterns(db_session: sqlalchemy.orm.Session, wcps: Iterable[Tuple[int, str]], wcps_created_by: str) None

Insert the workbench chemical compound patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wcps – The workbench chemical compound patterns: [ ( acp_id, wcp_smarts, ), … ].

  • wcps_created_by – The user of the database inserting the workbench chemical compound patterns.

static _insert_and_select_workbench_reaction_patterns(db_session: sqlalchemy.orm.Session, wrp_smarts_strings: Iterable[str], wrps_created_by: str) Dict[str, int]

Insert and select the workbench chemical reaction patterns from the database.

Parameters:
  • db_session – The session of the database.

  • wrp_smarts_strings – The SMARTS strings of the workbench chemical reaction patterns.

  • wrps_created_by – The user of the database inserting the workbench chemical reaction patterns.

Returns:

The SMARTS string to ID dictionary of the workbench chemical reaction patterns.

static _insert_workbench_reaction_pattern_archives(db_session: sqlalchemy.orm.Session, arp_ids_and_wrp_smarts_strings: Iterable[Tuple[int, str]], wrps_smarts_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction pattern archives into the database.

Parameters:
  • db_session – The session of the database.

  • arp_ids_and_wrp_smarts_strings – The IDs of the archive chemical reaction patterns and SMARTS strings of the workbench chemical reaction patterns.

  • wrps_smarts_to_id – The SMARTS string to ID dictionary of the workbench chemical reaction patterns.

static _insert_workbench_reaction_reactant_compound_patterns(db_session: sqlalchemy.orm.Session, wrp_smarts_strings_and_wrrcp_smarts_strings: Iterable[Tuple[str, str]], wrrcps_created_by: str, wrps_smarts_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction reactant compound patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wrp_smarts_strings_and_wrrcp_smarts_strings – The SMARTS strings of the workbench chemical reaction patterns and SMARTS strings of the workbench chemical reaction reactant compound patterns.

  • wrrcps_created_by – The user of the database inserting the workbench chemical reaction reactant compound patterns.

  • wrps_smarts_to_id – The SMARTS string to ID dictionary of the workbench chemical reaction patterns.

static _insert_workbench_reaction_spectator_compound_patterns(db_session: sqlalchemy.orm.Session, wrp_smarts_strings_and_wrscp_smarts_strings: Iterable[Tuple[str, str]], wrscps_created_by: str, wrps_smarts_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction spectator compound patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wrp_smarts_strings_and_wrscp_smarts_strings – The SMARTS strings of the workbench chemical reaction patterns and SMARTS strings of the workbench chemical reaction spectator compound patterns.

  • wrscps_created_by – The user of the database inserting the workbench chemical reaction spectator compound patterns.

  • wrps_smarts_to_id – The SMARTS string to ID dictionary of the workbench chemical reaction patterns.

static _insert_workbench_reaction_product_compound_patterns(db_session: sqlalchemy.orm.Session, wrp_smarts_strings_and_wrpcp_smarts_strings: Iterable[Tuple[str, str]], wrpcps_created_by: str, wrps_smarts_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction product compound patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wrp_smarts_strings_and_wrpcp_smarts_strings – The SMARTS strings of the workbench chemical reaction patterns and SMARTS strings of the workbench chemical reaction product compound patterns.

  • wrpcps_created_by – The user of the database inserting the workbench chemical reaction product compound patterns.

  • wrps_smarts_to_id – The SMARTS string to ID dictionary of the workbench chemical reaction patterns.

static insert_workbench_reaction_patterns(db_session: sqlalchemy.orm.Session, wrps: Iterable[Tuple[int, str, Iterable[str], Iterable[str], Iterable[str]]], wrps_created_by: str) None

Insert the workbench chemical reaction patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wrps – The workbench chemical reaction patterns: [ ( arp_id, wrp_smarts, wrrcp_smarts_strings, wrscp_smarts_strings, wrpcp_smarts_strings, ), … ].

  • wrps_created_by – The user of the database inserting the workbench chemical reaction patterns.

static _insert_workbench_reaction_transformation_patterns(db_session: sqlalchemy.orm.Session, wr_ids_and_wrp_smarts_strings: Iterable[Tuple[int, str]], wrps_smarts_to_id: Mapping[str, int]) None

Insert the workbench chemical reaction transformation patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wr_ids_and_wrp_smarts_strings – The IDs of the workbench chemical reactions and SMARTS strings of the workbench chemical reaction patterns.

  • wrps_smarts_to_id – The SMARTS string to ID dictionary of the workbench chemical reaction patterns.

static insert_workbench_reaction_transformation_patterns(db_session: sqlalchemy.orm.Session, wrtps: Iterable[Tuple[int, str, Iterable[str], Iterable[str], Iterable[str]]], wrtps_created_by: str) None

Insert the workbench chemical reaction transformation patterns into the database.

Parameters:
  • db_session – The session of the database.

  • wrtps – The workbench chemical reaction transformation patterns: [ ( wr_id, wrp_smarts, wrrcp_smarts_strings, wrscp_smarts_strings, wrpcp_smarts_strings, ), … ].

  • wrtps_created_by – The user of the database inserting the workbench chemical reaction transformation patterns.