diff --git a/ms2rescore/core.py b/ms2rescore/core.py index 40ab46a..2b25d7d 100644 --- a/ms2rescore/core.py +++ b/ms2rescore/core.py @@ -175,12 +175,8 @@ def _fill_missing_precursor_info(psm_list, config): get_missing_values(psm_list, config, rt_required=rt_required, im_required=im_required) # Check if values are now present - for value_name, required in zip( - ["retention_time", "ion_mobility"], [rt_required, im_required] - ): - if not required: - continue - if ( + for value_name, required in [("retention_time", rt_required), ("ion_mobility", im_required)]): + if required and ( 0.0 in psm_list[value_name] or None in psm_list[value_name] or np.isnan(psm_list[value_name]).any() diff --git a/ms2rescore/report/generate.py b/ms2rescore/report/generate.py index 400fb15..d74399e 100644 --- a/ms2rescore/report/generate.py +++ b/ms2rescore/report/generate.py @@ -180,13 +180,12 @@ def _get_stats_context(confidence_before, confidence_after): if not before or not after: continue increase = (after - before) / before * 100 - diff = after - before stats.append( { "item": level_name, "card_color": card_color, "number": after, - "diff": f"({diff:+})", + "diff": f"({after - before:+})", "percentage": f"{increase:.1f}%", "is_increase": increase > 0, "bar_percentage": before / after * 100 if increase > 0 else after / before * 100,