2.1. General Database
- class pharmaforge.recipes.GeneralDatabase.GeneralRecipe(database_name, client, input_dir=None, **kwargs)[source]
Bases:
object
A class to represent a recipe for generating a database of molecules
- Parameters:
database_name (str) – The name of the database to create
client (MongoClient) – The MongoDB client to use
input_dir (str) – The directory containing the HDF5 files to process
kwargs (dict) – Additional keyword arguments to pass to the recipe. These are one-for-one keypairs that get added to ALL the database entries.
Methods
add_field
(collection, field_name, field_value)Add a field to the recipe :param field_name: The name of the field to add :type field_name: str :param field_value: The value of the field to add :type field_value: any
Add a field to the recipe from the kwargs :param field_name: The name of the field to add :type field_name: str :param field_value: The value of the field to add :type field_value: any
clear_db
()Clear the database :param database_name: The name of the database to clear.
open_client
(client)Add the recipe to the client :param client: The MongoDB client to add the recipe to :type client: MongoClient
Pretty print one entry from the database :param None:
process_hdf5
(input_dir)Process the HDF5 files in the input directory :param input_dir: The directory containing the HDF5 files to process :type input_dir: str
check_collections
- add_field(collection, field_name, field_value)[source]
Add a field to the recipe :param field_name: The name of the field to add :type field_name: str :param field_value: The value of the field to add :type field_value: any
- Return type:
None
- add_field_from_kwargs()[source]
Add a field to the recipe from the kwargs :param field_name: The name of the field to add :type field_name: str :param field_value: The value of the field to add :type field_value: any
- Return type:
None
- clear_db()[source]
Clear the database :param database_name: The name of the database to clear. If None, the current database is cleared. :type database_name: str
- Return type:
None
- open_client(client)[source]
Add the recipe to the client :param client: The MongoDB client to add the recipe to :type client: MongoClient
- Return type:
None
- process_hdf5(input_dir)[source]
Process the HDF5 files in the input directory :param input_dir: The directory containing the HDF5 files to process :type input_dir: str
- Return type:
None
- Raises:
FileNotFoundError – If the input directory does not exist
ValueError – If the level_of_theory or data_source is not specified