From 41ff2396fb41e643632c0c0512af80627c3be687 Mon Sep 17 00:00:00 2001 From: Yuanyue Li Date: Tue, 25 Jun 2024 13:54:50 -0700 Subject: [PATCH] Update documents. --- ms_entropy/entropy_search/flash_entropy_search.py | 1 + .../entropy_search/flash_entropy_search_core.py | 1 + .../flash_entropy_search_core_low_memory.py | 11 +++++++++++ .../flash_entropy_search_core_medium_memory.py | 11 +++++++++++ 4 files changed, 24 insertions(+) diff --git a/ms_entropy/entropy_search/flash_entropy_search.py b/ms_entropy/entropy_search/flash_entropy_search.py index 2835420..18fba89 100644 --- a/ms_entropy/entropy_search/flash_entropy_search.py +++ b/ms_entropy/entropy_search/flash_entropy_search.py @@ -19,6 +19,7 @@ def __init__( ): """ Initialize the EntropySearch class. + :param max_ms2_tolerance_in_da: The maximum MS2 tolerance in Da. :param mz_index_step: The step size for the m/z index. :param low_memory: The memory usage mode, can be 0, 1, or 2. 0 means normal mode, 1 means low memory mode, and 2 means medium memory mode. diff --git a/ms_entropy/entropy_search/flash_entropy_search_core.py b/ms_entropy/entropy_search/flash_entropy_search_core.py index a4bc51b..7da2fc0 100644 --- a/ms_entropy/entropy_search/flash_entropy_search_core.py +++ b/ms_entropy/entropy_search/flash_entropy_search_core.py @@ -18,6 +18,7 @@ def __init__( ) -> None: """ Initialize the EntropySearch class. + :param path_array: The path array of the index files. :param max_ms2_tolerance_in_da: The maximum MS2 tolerance used when searching the MS/MS spectra, in Dalton. Default is 0.024. :param mz_index_step: The step size of the m/z index, in Dalton. Default is 0.0001. diff --git a/ms_entropy/entropy_search/flash_entropy_search_core_low_memory.py b/ms_entropy/entropy_search/flash_entropy_search_core_low_memory.py index 7f8c8fe..c7fd0ac 100644 --- a/ms_entropy/entropy_search/flash_entropy_search_core_low_memory.py +++ b/ms_entropy/entropy_search/flash_entropy_search_core_low_memory.py @@ -7,6 +7,17 @@ class FlashEntropySearchCoreLowMemory(FlashEntropySearchCore): def __init__(self, path_data, max_ms2_tolerance_in_da=0.024, mz_index_step=0.0001, intensity_weight="entropy") -> None: + """ + Initialize the EntropySearch class. + This class use file.read function to read the data from the file, which is suitable for very low memory usage. + + :param path_data: The path to save the index data. + :param max_ms2_tolerance_in_da: The maximum MS2 tolerance in Da. + :param mz_index_step: The step size for the m/z index. + :param intensity_weight: The weight for the intensity in the entropy calculation, can be "entropy" or None. Default is "entropy". + - None: The intensity will not be weighted, then the unweighted similarity will be calculated. + - "entropy": The intensity will be weighted by the entropy, then the entropy similarity will be calculated. + """ super().__init__(max_ms2_tolerance_in_da=max_ms2_tolerance_in_da, mz_index_step=mz_index_step, intensity_weight=intensity_weight) self.path_data = Path(str(path_data)) self.path_data.mkdir(parents=True, exist_ok=True) diff --git a/ms_entropy/entropy_search/flash_entropy_search_core_medium_memory.py b/ms_entropy/entropy_search/flash_entropy_search_core_medium_memory.py index cbb65de..cc2cb5e 100644 --- a/ms_entropy/entropy_search/flash_entropy_search_core_medium_memory.py +++ b/ms_entropy/entropy_search/flash_entropy_search_core_medium_memory.py @@ -7,6 +7,17 @@ class FlashEntropySearchCoreMediumMemory(FlashEntropySearchCore): def __init__(self, path_data, max_ms2_tolerance_in_da=0.024, mz_index_step=0.0001, intensity_weight="entropy") -> None: + """ + Initialize the EntropySearch class. + This class is use memmap function to read data from the disk, which is suitable for most of the cases, unless the data is super large. + + :param path_data: The path to save the index data. + :param max_ms2_tolerance_in_da: The maximum MS2 tolerance in Da. + :param mz_index_step: The step size for the m/z index. + :param intensity_weight: The weight for the intensity in the entropy calculation, can be "entropy" or None. Default is "entropy". + - None: The intensity will not be weighted, then the unweighted similarity will be calculated. + - "entropy": The intensity will be weighted by the entropy, then the entropy similarity will be calculated. + """ super().__init__(max_ms2_tolerance_in_da=max_ms2_tolerance_in_da, mz_index_step=mz_index_step, intensity_weight=intensity_weight) self.path_data = Path(str(path_data)) self.path_data.mkdir(parents=True, exist_ok=True)