ncsw_data.storage.cacs.sqlite_db¶
The ncsw_data.storage.cacs.sqlite_db package initialization module.
Submodules¶
Attributes¶
|
|
|
|
|
Classes¶
The computer-assisted chemical synthesis (CaCS) SQLite database class. |
Package Contents¶
- class ncsw_data.storage.cacs.sqlite_db.CaCSSQLiteDatabase(db_url: str = 'sqlite:///', logger: logging.Logger | None = None, **kwargs)¶
Bases:
ncsw_data.storage.base.base.DataStorageBaseThe computer-assisted chemical synthesis (CaCS) SQLite database class.
The __init__ method of the class.
- Parameters:
db_url – The URL of the database. The value sqlite:/// indicates that the SQLite database should be created in memory.
logger – The logger. The value None indicates that the logger should not be utilized.
kwargs – The keyword arguments for the adjustment of the following underlying functions: { sqlalchemy.engine.create.create_engine }.
- create_tables(**kwargs) None¶
Create the tables of the database.
- Parameters:
kwargs – The keyword arguments for the adjustment of the following underlying functions: { sqlalchemy.sql.schema.MetaData.create_all }.
- drop_tables(**kwargs) None¶
Drop the tables of the database.
- Parameters:
kwargs – The keyword arguments for the adjustment of the following underlying functions: { sqlalchemy.sql.schema.MetaData.drop_all }.
- execute_select_statement(select_statement_text: str) sqlalchemy.engine.Result¶
Execute a select statement.
- Parameters:
select_statement_text – The text of the select statement.
- Returns:
The result of the select statement.
- 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.
- Parameters:
ac_smiles_strings – The SMILES strings of the archive chemical compounds.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- select_archive_compounds(db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundTuple]], None, None]¶
Select the archive chemical compounds from the database.
- Parameters:
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical compounds from the database.
- select_archive_compounds_from_sources(as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundFromSourceTuple]], None, None]¶
Select the archive chemical compounds from sources in the database.
- Parameters:
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical compounds from sources in the database.
- 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.
- Parameters:
ar_smiles_strings – The SMILES strings of the archive chemical reactions.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- select_archive_reactions(db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionTuple]], None, None]¶
Select the archive chemical reactions from the database.
- Parameters:
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical reactions from the database.
- select_archive_reactions_from_sources(as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionFromSourceTuple]], None, None]¶
Select the archive chemical reactions from sources in the database.
- Parameters:
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical reactions from sources in the database.
- 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.
- Parameters:
acp_smarts_strings – The SMARTS strings of the archive chemical compound patterns.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- 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.
- Parameters:
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical compound patterns from the database.
- select_archive_compound_patterns_from_sources(as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveCompoundPatternFromSourceTuple]], None, None]¶
Select the archive chemical compound patterns from sources in the database.
- Parameters:
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical compound patterns from sources in the database.
- 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.
- Parameters:
arp_smarts_strings – The SMARTS strings of the archive chemical reaction patterns.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- 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.
- Parameters:
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical reaction patterns from the database.
- select_archive_reaction_patterns_from_sources(as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseArchiveReactionPatternFromSourceTuple]], None, None]¶
Select the archive chemical reaction patterns from sources in the database.
- Parameters:
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the archive chemical reaction patterns from sources in the database.
- 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: Iterable[Tuple[str, str, str]] | None, db_user: str = 'user', db_chunk_limit: int = 10000) None¶
Migrate the chemical compounds from the archive to the workbench tables of the database.
- Parameters:
ac_standardization_function – The standardization function of the archive chemical compounds.
wcs_are_building_blocks – The indicator of whether the workbench chemical compounds are building blocks.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- select_workbench_compounds(wcs_are_building_blocks: bool | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundTuple]], None, None]¶
Select the workbench chemical compounds from the database.
- Parameters:
wcs_are_building_blocks – The indicator of whether the workbench chemical compounds are building blocks.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical compounds from the database.
- select_workbench_compounds_from_sources(wcs_are_building_blocks: bool | None, as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundFromSourceTuple]], None, None]¶
Select the workbench chemical compounds from sources in the database.
- Parameters:
wcs_are_building_blocks – The indicator of whether the workbench chemical compounds are building blocks.
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical compounds from sources in the database.
- migrate_archive_to_workbench_reactions(ar_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveReactionStandardizationCallable, as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_user: str = 'user', db_chunk_limit: int = 10000) None¶
Migrate the chemical reactions from the archive to the workbench tables of the database.
- Parameters:
ar_standardization_function – The standardization function of the archive chemical reactions.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- select_workbench_reactions(wrrc_smiles_strings: Iterable[str] | None, wrsc_smiles_strings: Iterable[str] | None, wrpc_smiles_strings: Iterable[str] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionTuple]], None, None]¶
Select the workbench chemical reactions from the database.
- Parameters:
wrrc_smiles_strings – The SMILES strings of the workbench chemical reaction reactant compounds.
wrsc_smiles_strings – The SMILES strings of the workbench chemical reaction spectator compounds.
wrpc_smiles_strings – The SMILES strings of the workbench chemical reaction product compounds.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical reactions from the database.
- select_workbench_reactions_from_sources(wrrc_smiles_strings: Iterable[str] | None, wrsc_smiles_strings: Iterable[str] | None, wrpc_smiles_strings: Iterable[str] | None, as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionFromSourceTuple]], None, None]¶
Select the workbench chemical reactions from sources of the database.
- Parameters:
wrrc_smiles_strings – The SMILES strings of the workbench chemical reaction reactant compounds.
wrsc_smiles_strings – The SMILES strings of the workbench chemical reaction spectator compounds.
wrpc_smiles_strings – The SMILES strings of the workbench chemical reaction product compounds.
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical reactions from sources of the database.
- migrate_archive_to_workbench_compound_patterns(acp_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveCompoundPatternStandardizationCallable, as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, 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.
- Parameters:
acp_standardization_function – The standardization function of the archive chemical compound patterns.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- 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.
- Parameters:
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical compound patterns from the database.
- select_workbench_compound_patterns_from_sources(as_names_versions_and_file_names: Sequence[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchCompoundPatternFromSourceTuple]], None, None]¶
Select the workbench chemical compound patterns from sources in the database.
- Parameters:
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical compound patterns from sources in the database.
- migrate_archive_to_workbench_reaction_patterns(arp_standardization_function: ncsw_data.storage.cacs.sqlite_db.typing.CaCSSQLiteDatabaseArchiveReactionPatternStandardizationCallable, as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, 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.
- Parameters:
arp_standardization_function – The standardization function of the archive chemical reaction patterns.
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.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- select_workbench_reaction_patterns(wrrcp_smarts_strings: Iterable[str] | None, wrscp_smarts_strings: Iterable[str] | None, wrpcp_smarts_strings: Iterable[str] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionPatternTuple]], None, None]¶
Select the workbench chemical reaction patterns from the database.
- Parameters:
wrrcp_smarts_strings – The SMARTS strings of the workbench chemical reaction reactant compound patterns.
wrscp_smarts_strings – The SMARTS strings of the workbench chemical reaction spectator compound patterns.
wrpcp_smarts_strings – The SMARTS strings of the workbench chemical reaction product compound patterns.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical reaction patterns from the database.
- select_workbench_reaction_patterns_from_sources(wrrcp_smarts_strings: Iterable[str] | None, wrscp_smarts_strings: Iterable[str] | None, wrpcp_smarts_strings: Iterable[str] | None, as_names_versions_and_file_names: Iterable[Tuple[str, str, str]] | None, db_chunk_limit: int = 10000) Generator[Sequence[sqlalchemy.engine.Row[CaCSSQLiteDatabaseWorkbenchReactionPatternFromSourceTuple]], None, None]¶
Select the workbench chemical reaction patterns from sources in the database.
- Parameters:
wrrcp_smarts_strings – The SMARTS strings of the workbench chemical reaction reactant compound patterns.
wrscp_smarts_strings – The SMARTS strings of the workbench chemical reaction spectator compound patterns.
wrpcp_smarts_strings – The SMARTS strings of the workbench chemical reaction product compound patterns.
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.
db_chunk_limit – The chunk limit of the database.
- Returns:
The generator of the workbench chemical reaction patterns from sources in the database.
- 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.
- Parameters:
wrp_extraction_function – The extraction function of the workbench chemical reaction patterns.
db_user – The user of the database.
db_chunk_limit – The chunk limit of the database.
- select_reversed_synthesis_routes(wc_smiles: str, reversed_sr_maximum_depth: int = 10) Sequence[sqlalchemy.engine.Row[Tuple[int, int, str, bool, bool, int | None, int | None, str | None]]]¶
Select the reversed chemical synthesis routes from the database.
- Parameters:
wc_smiles – The SMILES string of the workbench chemical compound.
reversed_sr_maximum_depth – The maximum depth of the reversed chemical synthesis routes.
- Returns:
The reversed chemical synthesis routes from the database.
- 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¶