Skip to content

Commit

Permalink
Update documents.
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanyueLi committed Jun 25, 2024
1 parent 7dacce4 commit 41ff239
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions ms_entropy/entropy_search/flash_entropy_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions ms_entropy/entropy_search/flash_entropy_search_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions ms_entropy/entropy_search/flash_entropy_search_core_low_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41ff239

Please sign in to comment.