Skip to content

Commit

Permalink
feature: MRMTransitionGroupPicker minimal_quality param + print param…
Browse files Browse the repository at this point in the history
…eters function

add a function to print parameters

add the minimal_quality to the set of valid parameters to set,
-auto set compute_peak_quality to true if minimal_quality is set
  • Loading branch information
jcharkow committed Apr 5, 2024
1 parent 100a00b commit 9736ba4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion massdash/peakPickers/MRMTransitionGroupPicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ def setGeneralParameters(self, **kwargs):
background_subtraction (str): Background subtraction
use_precursors (bool): Use precursors
signal_to_noise (float): Signal to noise
minimal_quality (float): Minimal quality (if set, automatically sets compute_peak_quality to true)
'''

valid_params = ['stop_after_feature', 'stop_after_intensity_ratio', 'min_peak_width', 'recalculate_peaks_max_z', 'resample_boundary', 'recalculate_peaks', 'background_subtraction', 'use_precursors']
valid_params = ['stop_after_feature', 'stop_after_intensity_ratio', 'min_peak_width', 'recalculate_peaks_max_z', 'resample_boundary', 'recalculate_peaks', 'background_subtraction', 'use_precursors', 'minimal_quality']
mrmParams = ['signal_to_noise']
bools_to_str = ['recalculate_peaks'] # these parameters require a "true" or "false" string
valid_params = valid_params + mrmParams + bools_to_str
Expand All @@ -110,10 +111,19 @@ def setGeneralParameters(self, **kwargs):
self.params.setValue(bytes(k, encoding='utf-8'), 'true')
else:
self.params.setValue(bytes(k, encoding='utf-8'), 'false')
elif k == 'minimal_quality':
self.params.setValue(bytes(k, encoding='utf-8'), val)
self.params.setValue(bytes('compute_peak_quality', encoding='utf-8'), 'true')
else:
self.params.setValue(bytes(k, encoding='utf-8'), val)
self.picker.setParameters(self.params)

def printParameters(self):
''' Print the current parameters including hidden parameters '''
lst = list(zip(self.params.keys(), self.params.values()))
for i in lst:
print(f'{i[0]}: {i[1]}')

def pick(self, transitionGroup: TransitionGroup) -> List[TransitionGroupFeature]:
''' Performs Peak Picking, Should return a TransitionGroupFeatureList object '''
pyopenmsTransitionGroup = transitionGroup.to_pyopenms()
Expand Down

0 comments on commit 9736ba4

Please sign in to comment.