syndirella.slipper.Slipper ========================== .. py:module:: syndirella.slipper.Slipper .. autoapi-nested-parse:: syndirella.slipper.Slipper.py This module contains the Slipper class. A slipper in this metaphor is the set of molecules that is the scaffold of a reaction. Classes ------- .. autoapisummary:: syndirella.slipper.Slipper.Slipper Module Contents --------------- .. py:class:: Slipper(*, library: syndirella.route.Library.Library, template: str = None, hits_path: str = None, hits_names: List[str] = None, batch_num: int = None, atoms_ids_expansion: dict = None, additional_info: dict = None, scaffold_placements: Dict[rdkit.Chem.Mol, str | None] = None) This class is instantiated to represent all products for a step in a route. .. py:attribute:: products :type: pandas.DataFrame :value: None .. py:attribute:: library :type: syndirella.route.Library.Library .. py:attribute:: route_uuid :type: str .. py:attribute:: output_dir :type: str .. py:attribute:: final_products_pkl_path :type: str :value: None .. py:attribute:: final_products_csv_path :type: str :value: None .. py:attribute:: scaffold_placements :type: Dict[rdkit.Chem.Mol, str | None] :value: None .. py:attribute:: template :type: str :value: None .. py:attribute:: hits_path :type: str :value: None .. py:attribute:: hits_names :type: List[str] :value: None .. py:attribute:: batch_num :type: int :value: None .. py:attribute:: atoms_ids_expansion :type: dict :value: None .. py:attribute:: placements :type: pandas.DataFrame :value: None .. py:attribute:: output_path :type: str :value: None .. py:attribute:: additional_info :type: dict :value: None .. py:attribute:: logger .. py:attribute:: num_placed :type: int | None :value: None .. py:attribute:: num_successful :type: int | None :value: None .. py:attribute:: to_hippo_path :type: str | None :value: None .. py:attribute:: num_unique_products :type: int | None :value: None .. py:attribute:: num_products_enumstereo :type: int | None :value: None .. py:method:: get_products() -> pd.DataFrame and str Main entry to the Slipper class. This function is used to get the products the self.library object. .. py:method:: place_products() This function is used to place the products with Fragmenstein. .. py:method:: write_products_to_hippo() -> str Writes a dataframe that contains the values needed for HIPPO db input. :returns: str : the path to the saved dataframe :rtype: path .. py:method:: check_scaffold_in_hippo(hippo_df: pandas.DataFrame, hippo_path: str) Checks if there is a scaffold in the scaffold names of the HIPPO output. .. py:method:: _load_products_dfs(products_files: List[str]) -> Dict[int, pandas.DataFrame] Load the products dataframes from the files in the /extra directory and putting into dict where key is step. .. py:method:: _structure_products_for_hippo(placements_df: pandas.DataFrame, product_dfs: Dict[int, pandas.DataFrame]) -> pandas.DataFrame Structures the placements or products df for HIPPO output. .. py:method:: calculate_inchi_similarity(smiles1: str, smiles2: str) -> int .. py:method:: find_matches(row, step, df_previous_step: pandas.DataFrame) -> List[str] .. py:method:: _put_hippo_dfs_together(hippo_dfs: Dict[int, pandas.DataFrame]) -> pandas.DataFrame Puts the HIPPO dataframes together by matching on each reaction scaffold to the correct previous step's reactant. .. py:method:: _structure_step_for_hippo(step: int, products_df: pandas.DataFrame) -> pandas.DataFrame Structures the products df for HIPPO output. .. py:method:: which_reactant_was_previous_product(r1_is_previous_product: bool, r2_is_previous_product: bool) -> int | None Determine which reactant was the scaffold of the previous step. .. py:method:: _delete_file_or_directory(path) Delete a file or directory at the given path. .. py:method:: _should_delete_file(file, suffixes_to_keep) Determine if a file should be deleted based on its suffix. .. py:method:: clean_up_placements() This function is used to remove extra files that are generated by Fragmenstein. .. py:method:: get_placements_df() -> pandas.DataFrame | None This function is used to get the placements dataframe which is the merged df with the products.