FPSim2.io.backends package¶
Submodules¶
FPSim2.io.backends.base module¶
-
class
FPSim2.io.backends.base.BaseStorageBackend(fp_filename)¶ Bases:
abc.ABC-
abstract
append_fps(io_source, mol_id_prop)¶ Appends FPs to the file.
- Parameters
mols_source (str or iterable) – .smi or .sdf filename or iterable.
- Returns
- Return type
None
-
static
calc_popcnt_bins(fps: numpy.ndarray) → list¶ Calcs popcount bins.
- Parameters
fps (numpy array) – numpy array with the fingerprints of the database.
- Returns
popcnt_bins – list with the ranges of the popcount bins.
- Return type
list
-
abstract
delete_fps(ids_list)¶ Delete FPs given a list of ids.
- Parameters
ids_list (list) – ids to delete.
- Returns
- Return type
None
-
abstract
get_fps_chunk(chunk_range)¶ Loads a contiguous chunk of data from the storage into memory
-
abstract
load_fps(in_memory_fps, fps_sort) → None¶ Loads the whole fp db file into memory
-
abstract
load_popcnt_bins()¶ Loads popcnt bins info
-
abstract
read_parameters()¶ Reads fp file info
-
abstract
FPSim2.io.backends.pytables module¶
-
class
FPSim2.io.backends.pytables.PyTablesStorageBackend(fp_filename: str, in_memory_fps: bool = True, fps_sort: bool = False)¶ Bases:
FPSim2.io.backends.base.BaseStorageBackend-
append_fps(mols_source: Union[str, Iterable], mol_id_prop: str = 'mol_id') → None¶ Appends FPs to the file.
- Parameters
mols_source (str or iterable) – .smi or .sdf filename or iterable.
- Returns
- Return type
None
-
delete_fps(ids_list: List[int]) → None¶ Delete FPs given a list of ids.
- Parameters
ids_list (list) – ids to delete.
- Returns
- Return type
None
-
get_fps_chunk(chunk_range: Tuple[int, int]) → numpy.asarray¶ Loads a contiguous chunk of data from the storage into memory
-
load_fps(in_memory_fps, fps_sort) → None¶ Loads FP db file into memory.
- Parameters
in_memory_fps (bool) – Whether if the FPs should be loaded into memory or not.
fps_sort (bool) – Whether if the FPs should be sorted or not.
- Returns
fps – Numpy array with the fingerprints.
- Return type
numpy array
-
load_popcnt_bins(fps_sort) → None¶ Loads popcnt bins info
-
read_parameters() → Tuple[str, Dict[str, Dict[str, dict]], str]¶ Reads fingerprint parameters
-
-
FPSim2.io.backends.pytables.calc_popcnt_bins_pytables(fps: Any, fp_length: int) → list¶
-
FPSim2.io.backends.pytables.create_db_file(mols_source: Union[str, Iterable], filename: str, fp_type: str, fp_params: dict = {}, mol_id_prop: str = 'mol_id', gen_ids: bool = False, sort_by_popcnt: bool = True) → None¶ Creates FPSim2 FPs db file from .smi, .sdf files or from an iterable.
- Parameters
mols_source (str) – .smi/.sdf filename or iterable.
filename (float) – Fingerprint database filename.
fp_type (str) – Fingerprint type used to create the fingerprints.
fp_params (dict) – Parameters used to create the fingerprints.
mol_id_prop (str) – Name of the .sdf property to read the molecule id.
gen_ids (bool) – Autogenerate FP ids.
sort_by_popcnt (bool) – Whether if the FPs should be sorted or not.
- Returns
- Return type
None
-
FPSim2.io.backends.pytables.create_schema(fp_length: int) → Any¶
-
FPSim2.io.backends.pytables.sort_db_file(filename: str) → None¶ Sorts the FPs db file.