-
Notifications
You must be signed in to change notification settings - Fork 9
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
Development #130
Development #130
Changes from all commits
c6b3f9e
6a9dae7
d731cd8
dd2010a
5c8757a
0a08181
3992b31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,25 +310,25 @@ def clip_by_precursor_mz_(self): | |
|
||
def calc_precursor_mz(self): | ||
""" | ||
Calculate precursor mz for self._precursor_df, | ||
and clip the self._precursor_df using `self.clip_by_precursor_mz_` | ||
Calculate precursor mz for self._precursor_df | ||
""" | ||
fragment.update_precursor_mz(self._precursor_df) | ||
|
||
def update_precursor_mz(self): | ||
def calc_and_clip_precursor_mz(self): | ||
""" | ||
Calculate precursor mz for self._precursor_df, | ||
and clip the self._precursor_df using `self.clip_by_precursor_mz_` | ||
""" | ||
self.calc_precursor_mz() | ||
self.clip_by_precursor_mz_() | ||
|
||
def calc_precursor_isotope_intensity(self, | ||
multiprocessing : bool=True, | ||
max_isotope = 6, | ||
min_right_most_intensity = 0.001, | ||
mp_batch_size = 10000, | ||
mp_process_num = 8 | ||
): | ||
mp_process_num = 8, | ||
normalize:typing.Literal['mono','sum'] = "sum", | ||
): | ||
""" | ||
Calculate and append the isotope intensity columns into self.precursor_df. | ||
See `alphabase.peptide.precursor.calc_precursor_isotope_intensity` for details. | ||
|
@@ -351,53 +351,70 @@ def calc_precursor_isotope_intensity(self, | |
""" | ||
|
||
if 'precursor_mz' not in self._precursor_df.columns: | ||
self.calc_precursor_mz() | ||
self.clip_by_precursor_mz_() | ||
self.calc_and_clip_precursor_mz() | ||
|
||
if multiprocessing and len(self.precursor_df)>mp_batch_size: | ||
if mp_process_num>1 and len(self.precursor_df)>mp_batch_size: | ||
( | ||
self._precursor_df | ||
) = precursor.calc_precursor_isotope_intensity_mp( | ||
self.precursor_df, | ||
max_isotope = max_isotope, | ||
min_right_most_intensity = min_right_most_intensity, | ||
normalize=normalize, | ||
mp_process_num = mp_process_num, | ||
mp_batch_size=mp_batch_size, | ||
) | ||
else: | ||
( | ||
self._precursor_df | ||
) = precursor.calc_precursor_isotope_intensity( | ||
self.precursor_df, | ||
max_isotope = max_isotope, | ||
normalize=normalize, | ||
min_right_most_intensity = min_right_most_intensity, | ||
) | ||
|
||
|
||
def calc_precursor_isotope(self, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you like we can keep only one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
max_isotope = 6, | ||
min_right_most_intensity = 0.001, | ||
mp_batch_size = 10000, | ||
mp_process_num = 8, | ||
normalize:typing.Literal['mono','sum'] = "sum", | ||
): | ||
return self.calc_precursor_isotope_intensity( | ||
max_isotope=max_isotope, | ||
min_right_most_intensity=min_right_most_intensity, | ||
normalize=normalize, | ||
mp_batch_size=mp_batch_size, | ||
mp_process_num=mp_process_num, | ||
) | ||
|
||
def calc_precursor_isotope(self, | ||
multiprocessing:bool=True, | ||
def calc_precursor_isotope_info(self, | ||
mp_process_num:int=8, | ||
mp_process_bar=None, | ||
min_precursor_num_to_run_mp:int=1000, | ||
mp_batch_size = 10000, | ||
): | ||
""" | ||
Append isotope columns into self.precursor_df. | ||
See `alphabase.peptide.precursor.calc_precursor_isotope` for details. | ||
""" | ||
if 'precursor_mz' not in self._precursor_df.columns: | ||
self.calc_precursor_mz() | ||
self.clip_by_precursor_mz_() | ||
if multiprocessing and len(self.precursor_df)>min_precursor_num_to_run_mp: | ||
self.calc_and_clip_precursor_mz() | ||
if ( | ||
mp_process_num > 1 and | ||
len(self.precursor_df)>mp_batch_size | ||
): | ||
( | ||
self._precursor_df | ||
) = precursor.calc_precursor_isotope_mp( | ||
) = precursor.calc_precursor_isotope_info_mp( | ||
self.precursor_df, | ||
processes=mp_process_num, | ||
process_bar=mp_process_bar, | ||
) | ||
else: | ||
( | ||
self._precursor_df | ||
) = precursor.calc_precursor_isotope( | ||
) = precursor.calc_precursor_isotope_info( | ||
self.precursor_df | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really good, I like that the clipping is mentioned and won't surprise users