ncsw_data.storage.cacs.sqlite_db ================================ .. py:module:: ncsw_data.storage.cacs.sqlite_db .. autoapi-nested-parse:: The ``ncsw_data.storage.cacs.sqlite_db`` package initialization module. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ncsw_data/storage/cacs/sqlite_db/model/index /autoapi/ncsw_data/storage/cacs/sqlite_db/sqlite_db/index /autoapi/ncsw_data/storage/cacs/sqlite_db/typing/index /autoapi/ncsw_data/storage/cacs/sqlite_db/utility/index Attributes ---------- .. autoapisummary:: ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabaseArchiveCompoundPatternStandardizationCallable ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabaseArchiveCompoundStandardizationCallable ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabaseArchiveReactionPatternStandardizationCallable ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabaseArchiveReactionStandardizationCallable ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabaseWorkbenchReactionPatternExtractionCallable Classes ------- .. autoapisummary:: ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabase Package Contents ---------------- .. py:class:: CaCSSQLiteDatabase(db_url: str = 'sqlite:///', logger: Optional[logging.Logger] = None, **kwargs) Bases: :py:obj:`ncsw_data.storage.base.base.DataStorageBase` The computer-assisted chemical synthesis (CaCS) SQLite database class. The `__init__` method of the class. :parameter db_url: The URL of the database. The value `sqlite:///` indicates that the SQLite database should be created in memory. :parameter logger: The logger. The value `None` indicates that the logger should not be utilized. :parameter kwargs: The keyword arguments for the adjustment of the following underlying functions: { `sqlalchemy.engine.create.create_engine` }. .. py:method:: create_tables(**kwargs) -> None Create the tables of the database. :parameter kwargs: The keyword arguments for the adjustment of the following underlying functions: { `sqlalchemy.sql.schema.MetaData.create_all` }. .. py:method:: drop_tables(**kwargs) -> None Drop the tables of the database. :parameter kwargs: The keyword arguments for the adjustment of the following underlying functions: { `sqlalchemy.sql.schema.MetaData.drop_all` }. .. py:method:: execute_select_statement(select_statement_text: str) -> sqlalchemy.engine.Result Execute a select statement. :parameter select_statement_text: The text of the select statement. :returns: The result of the select statement. .. py:method:: insert_archive_compounds(ac_smiles_strings: Collection[str], as_name: str, as_version: str, as_file_name: str, db_user: str = 'user', db_chunk_limit: int = 10000) -> None Insert the archive chemical compounds into the database. :parameter ac_smiles_strings: The SMILES strings of the archive chemical compounds. :parameter as_name: The name of the archive source. :parameter as_version: The version of the archive source. :parameter as_file_name: The file name of the archive source. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_archive_compounds(db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundTuple]], None, None] Select the archive chemical compounds from the database. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical compounds from the database. .. py:method:: select_archive_compounds_from_sources(as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundFromSourceTuple]], None, None] Select the archive chemical compounds from sources in the database. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical compounds should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical compounds from sources in the database. .. py:method:: insert_archive_reactions(ar_smiles_strings: Sequence[str], as_name: str, as_version: str, as_file_name: str, db_user: str = 'user', db_chunk_limit: int = 10000) -> None Insert the archive chemical reactions into the database. :parameter ar_smiles_strings: The SMILES strings of the archive chemical reactions. :parameter as_name: The name of the archive source. :parameter as_version: The version of the archive source. :parameter as_file_name: The file name of the archive source. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_archive_reactions(db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionTuple]], None, None] Select the archive chemical reactions from the database. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical reactions from the database. .. py:method:: select_archive_reactions_from_sources(as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionFromSourceTuple]], None, None] Select the archive chemical reactions from sources in the database. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical reactions should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical reactions from sources in the database. .. py:method:: insert_archive_compound_patterns(acp_smarts_strings: Sequence[str], as_name: str, as_version: str, as_file_name: str, db_user: str = 'user', db_chunk_limit: int = 10000) -> None Insert the archive chemical compound patterns into the database. :parameter acp_smarts_strings: The SMARTS strings of the archive chemical compound patterns. :parameter as_name: The name of the archive source. :parameter as_version: The version of the archive source. :parameter as_file_name: The file name of the archive source. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_archive_compound_patterns(db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundPatternTuple]], None, None] Select the archive chemical compound patterns from the database. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical compound patterns from the database. .. py:method:: select_archive_compound_patterns_from_sources(as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundPatternFromSourceTuple]], None, None] Select the archive chemical compound patterns from sources in the database. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical compound patterns should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical compound patterns from sources in the database. .. py:method:: insert_archive_reaction_patterns(arp_smarts_strings: Sequence[str], as_name: str, as_version: str, as_file_name: str, db_user: str = 'user', db_chunk_limit: int = 10000) -> None Insert the archive chemical reaction patterns into the database. :parameter arp_smarts_strings: The SMARTS strings of the archive chemical reaction patterns. :parameter as_name: The name of the archive source. :parameter as_version: The version of the archive source. :parameter as_file_name: The file name of the archive source. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_archive_reaction_patterns(db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionPatternTuple]], None, None] Select the archive chemical reaction patterns from the database. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical reaction patterns from the database. .. py:method:: select_archive_reaction_patterns_from_sources(as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionPatternFromSourceTuple]], None, None] Select the archive chemical reaction patterns from sources in the database. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical reaction patterns should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the archive chemical reaction patterns from sources in the database. .. py:method:: migrate_archive_to_workbench_compounds(ac_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveCompoundStandardizationCallable, wcs_are_building_blocks: bool, as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_user: str = 'user', db_chunk_limit: int = 10000) -> None Migrate the chemical compounds from the archive to the workbench tables of the database. :parameter ac_standardization_function: The standardization function of the archive chemical compounds. :parameter wcs_are_building_blocks: The indicator of whether the workbench chemical compounds are building blocks. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical compounds should be retrieved. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_workbench_compounds(wcs_are_building_blocks: Optional[bool], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundTuple]], None, None] Select the workbench chemical compounds from the database. :parameter wcs_are_building_blocks: The indicator of whether the workbench chemical compounds are building blocks. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical compounds from the database. .. py:method:: select_workbench_compounds_from_sources(wcs_are_building_blocks: Optional[bool], as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundFromSourceTuple]], None, None] Select the workbench chemical compounds from sources in the database. :parameter wcs_are_building_blocks: The indicator of whether the workbench chemical compounds are building blocks. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the workbench chemical compounds should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical compounds from sources in the database. .. py:method:: migrate_archive_to_workbench_reactions(ar_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveReactionStandardizationCallable, as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_user: str = 'user', db_chunk_limit: int = 10000) -> None Migrate the chemical reactions from the archive to the workbench tables of the database. :parameter ar_standardization_function: The standardization function of the archive chemical reactions. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical reactions should be retrieved. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_workbench_reactions(wrrc_smiles_strings: Optional[Iterable[str]], wrsc_smiles_strings: Optional[Iterable[str]], wrpc_smiles_strings: Optional[Iterable[str]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionTuple]], None, None] Select the workbench chemical reactions from the database. :parameter wrrc_smiles_strings: The SMILES strings of the workbench chemical reaction reactant compounds. :parameter wrsc_smiles_strings: The SMILES strings of the workbench chemical reaction spectator compounds. :parameter wrpc_smiles_strings: The SMILES strings of the workbench chemical reaction product compounds. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical reactions from the database. .. py:method:: select_workbench_reactions_from_sources(wrrc_smiles_strings: Optional[Iterable[str]], wrsc_smiles_strings: Optional[Iterable[str]], wrpc_smiles_strings: Optional[Iterable[str]], as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionFromSourceTuple]], None, None] Select the workbench chemical reactions from sources of the database. :parameter wrrc_smiles_strings: The SMILES strings of the workbench chemical reaction reactant compounds. :parameter wrsc_smiles_strings: The SMILES strings of the workbench chemical reaction spectator compounds. :parameter wrpc_smiles_strings: The SMILES strings of the workbench chemical reaction product compounds. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the workbench chemical reactions should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical reactions from sources of the database. .. py:method:: migrate_archive_to_workbench_compound_patterns(acp_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveCompoundPatternStandardizationCallable, as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_user: str = 'user', db_chunk_limit: int = 10000) -> None Migrate the chemical compound patterns from the archive to the workbench tables of the database. :parameter acp_standardization_function: The standardization function of the archive chemical compound patterns. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical compound patterns should be retrieved. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_workbench_compound_patterns(db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundPatternTuple]], None, None] Select the workbench chemical compound patterns from the database. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical compound patterns from the database. .. py:method:: select_workbench_compound_patterns_from_sources(as_names_versions_and_file_names: Optional[Sequence[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundPatternFromSourceTuple]], None, None] Select the workbench chemical compound patterns from sources in the database. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the workbench chemical compound patterns should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical compound patterns from sources in the database. .. py:method:: migrate_archive_to_workbench_reaction_patterns(arp_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveReactionPatternStandardizationCallable, as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_user: str = 'user', db_chunk_limit: int = 10000) -> None Migrate the chemical reaction patterns from the archive to the workbench tables of the database. :parameter arp_standardization_function: The standardization function of the archive chemical reaction patterns. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the archive chemical reaction patterns should be retrieved. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_workbench_reaction_patterns(wrrcp_smarts_strings: Optional[Iterable[str]], wrscp_smarts_strings: Optional[Iterable[str]], wrpcp_smarts_strings: Optional[Iterable[str]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionPatternTuple]], None, None] Select the workbench chemical reaction patterns from the database. :parameter wrrcp_smarts_strings: The SMARTS strings of the workbench chemical reaction reactant compound patterns. :parameter wrscp_smarts_strings: The SMARTS strings of the workbench chemical reaction spectator compound patterns. :parameter wrpcp_smarts_strings: The SMARTS strings of the workbench chemical reaction product compound patterns. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical reaction patterns from the database. .. py:method:: select_workbench_reaction_patterns_from_sources(wrrcp_smarts_strings: Optional[Iterable[str]], wrscp_smarts_strings: Optional[Iterable[str]], wrpcp_smarts_strings: Optional[Iterable[str]], as_names_versions_and_file_names: Optional[Iterable[Tuple[str, str, str]]], db_chunk_limit: int = 10000) -> Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionPatternFromSourceTuple]], None, None] Select the workbench chemical reaction patterns from sources in the database. :parameter wrrcp_smarts_strings: The SMARTS strings of the workbench chemical reaction reactant compound patterns. :parameter wrscp_smarts_strings: The SMARTS strings of the workbench chemical reaction spectator compound patterns. :parameter wrpcp_smarts_strings: The SMARTS strings of the workbench chemical reaction product compound patterns. :parameter as_names_versions_and_file_names: The names, versions, and file names of the archive sources from which the workbench chemical reaction patterns should be retrieved. :parameter db_chunk_limit: The chunk limit of the database. :returns: The generator of the workbench chemical reaction patterns from sources in the database. .. py:method:: extract_workbench_reaction_transformation_patterns(wrp_extraction_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseWorkbenchReactionPatternExtractionCallable, db_user: str = 'user', db_chunk_limit: int = 10000) -> None Extract the workbench chemical reaction transformation patterns of the database. :parameter wrp_extraction_function: The extraction function of the workbench chemical reaction patterns. :parameter db_user: The user of the database. :parameter db_chunk_limit: The chunk limit of the database. .. py:method:: select_reversed_synthesis_routes(wc_smiles: str, reversed_sr_maximum_depth: int = 10) -> Sequence[sqlalchemy.engine.Row[Tuple[int, int, str, bool, bool, Optional[int], Optional[int], Optional[str]]]] Select the reversed chemical synthesis routes from the database. :parameter wc_smiles: The SMILES string of the workbench chemical compound. :parameter reversed_sr_maximum_depth: The maximum depth of the reversed chemical synthesis routes. :returns: The reversed chemical synthesis routes from the database. .. py:data:: CaCSSQLiteDatabaseArchiveCompoundPatternStandardizationCallable .. py:data:: CaCSSQLiteDatabaseArchiveCompoundStandardizationCallable .. py:data:: CaCSSQLiteDatabaseArchiveReactionPatternStandardizationCallable .. py:data:: CaCSSQLiteDatabaseArchiveReactionStandardizationCallable .. py:data:: CaCSSQLiteDatabaseWorkbenchReactionPatternExtractionCallable