From 9e3a7fc8e788cf0eb35abbe79c8f7449b69ea4f2 Mon Sep 17 00:00:00 2001 From: Micha Birklbauer Date: Thu, 11 Jan 2024 12:06:17 +0100 Subject: [PATCH] fdr type check and logging --- msannika_fdr.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/msannika_fdr.py b/msannika_fdr.py index 984c199..b6fa3c3 100644 --- a/msannika_fdr.py +++ b/msannika_fdr.py @@ -195,6 +195,9 @@ def main(argv = None) -> List[pd.DataFrame]: version = __version) args = parser.parse_args(argv) + if args.fdr is not None: + print(f"Using {float(args.fdr) if float(args.fdr) < 1.0 else float(args.fdr) / 100.0} FDR.") + result_list = list() for f, file in enumerate(args.files): @@ -205,10 +208,10 @@ def main(argv = None) -> List[pd.DataFrame]: crosslinks.to_excel(file.rstrip(".xlsx") + "_crosslinks.xlsx", sheet_name = "Crosslinks", index = False) result_list.append(crosslinks) if args.fdr is not None: - validated_csms = MSAnnika_CSM_Validator.validate(df, args.fdr if args.fdr < 1.0 else args.fdr / 100) + validated_csms = MSAnnika_CSM_Validator.validate(df, float(args.fdr) if float(args.fdr) < 1.0 else float(args.fdr) / 100.0) validated_csms.to_excel(file.rstrip(".xlsx") + "_validated.xlsx", sheet_name = "CSMs", index = False) result_list.append(validated_csms) - validated_crosslinks = MSAnnika_Crosslink_Validator.validate(crosslinks, args.fdr if args.fdr < 1.0 else args.fdr / 100) + validated_crosslinks = MSAnnika_Crosslink_Validator.validate(crosslinks, float(args.fdr) if float(args.fdr) < 1.0 else float(args.fdr) / 100.0) validated_crosslinks.to_excel(file.rstrip(".xlsx") + "_crosslinks_validated.xlsx", sheet_name = "Crosslinks", index = False) result_list.append(validated_crosslinks) else: