Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

53 docs init pattern #66

Merged
merged 5 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions alpharaw/ms_data_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
class MSData_Base:
"""
The base data structure for MS RAW Data, other MSData loaders inherit this class.

Parameters
----------
centroided : bool, optional
If centroiding the peak data, by default True
save_as_hdf : bool, optional
If automatically save the data into HDF5 format, by default False
"""

column_dtypes = {
Expand Down Expand Up @@ -76,6 +69,14 @@ class MSData_Base:
"""

def __init__(self, centroided: bool = True, save_as_hdf: bool = False, **kwargs):
"""
Parameters
----------
centroided : bool, optional
If centroiding the peak data, by default True
save_as_hdf : bool, optional
If automatically save the data into HDF5 format, by default False
"""
# A spectrum contains peaks
self.spectrum_df: pd.DataFrame = pd.DataFrame()
# A peak contains mz, intensity, and ...
Expand Down
33 changes: 17 additions & 16 deletions alpharaw/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ class ThermoRawData(MSData_Base):
Loading Thermo Raw data as MSData_Base data structure.
This class is registered "thermo" and "thermo_raw" in
:obj:`alpharaw.ms_data_base.ms_reader_provider`.

Parameters
----------
centroided : bool, optional
If peaks will be centroided after loading. By defaults True.
process_count : int, optional
Number of processes to load RAW data, by default 10.
mp_batch_size : int, optional
Number of spectra to load in each batch, by default 5000.
save_as_hdf : bool, optional
Automatically save hdf after load raw data, by default False.
dda : bool, optional
Is DDA data, by default False.
auxiliary_items : list, optional
Additional spectrum items, candidates are in :data:`auxiliary_item_dtypes`.
By default [].
"""

def __init__(
Expand All @@ -82,6 +66,23 @@ def __init__(
auxiliary_items: list = [],
**kwargs,
):
"""
Parameters
----------
centroided : bool, optional
If peaks will be centroided after loading. By defaults True.
jalew188 marked this conversation as resolved.
Show resolved Hide resolved
process_count : int, optional
Number of processes to load RAW data, by default 10.
mp_batch_size : int, optional
Number of spectra to load in each batch, by default 5000.
save_as_hdf : bool, optional
Automatically save hdf after load raw data, by default False.
dda : bool, optional
Is DDA data, by default False.
auxiliary_items : list, optional
Additional spectrum items, candidates are in :data:`auxiliary_item_dtypes`.
By default [].
"""
super().__init__(centroided, save_as_hdf=save_as_hdf, **kwargs)
self.file_type = "thermo"
self.process_count = process_count
Expand Down
33 changes: 17 additions & 16 deletions alpharaw/wrappers/alphatims_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,26 @@ def import_raw(self, burker_d_folder: str):
class AlphaTimsWrapper(TimsTOF):
"""Create a AlphaTims object that contains
all data in-memory (or memory mapping).

Parameters
----------
msdata : MSData_Base
The AlphaRaw data object.

dda : bool
If DDA, precursor indices will be equal to scan numbers.
If not DDA (i.e. DIA), precursor indices will be equal to the
scan number within a DIA cycle.

slice_as_dataframe : bool
If True, slicing returns a pd.DataFrame by default.
If False, slicing provides a np.int64[:] with raw indices.
This value can also be modified after creation.
Default is True.
"""

def __init__(self, msdata: MSData_Base, dda: bool, slice_as_dataframe: bool = True):
"""
Parameters
----------
msdata : MSData_Base
The AlphaRaw data object.

dda : bool
If DDA, precursor indices will be equal to scan numbers.
If not DDA (i.e. DIA), precursor indices will be equal to the
scan number within a DIA cycle.

slice_as_dataframe : bool
jalew188 marked this conversation as resolved.
Show resolved Hide resolved
If True, slicing returns a pd.DataFrame by default.
If False, slicing provides a np.int64[:] with raw indices.
This value can also be modified after creation.
jalew188 marked this conversation as resolved.
Show resolved Hide resolved
Default is True.
"""
self._use_calibrated_mz_values_as_default = False
self._import_alpharaw_object(msdata, dda)
self.thermo_raw_file_name = msdata.raw_file_path
Expand Down
Loading