Skip to content

Commit

Permalink
Merge pull request #3 from hgb-bin-proteomics/develop
Browse files Browse the repository at this point in the history
Fix filename handling
  • Loading branch information
michabirklbauer authored Jan 24, 2024
2 parents 3bd5eaf + f4c81d6 commit 8051b39
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions msannika_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# micha.birklbauer@gmail.com

# version tracking
__version = "1.1.0"
__version = "1.1.1"
__date = "2024-01-24"

# REQUIREMENTS
Expand Down Expand Up @@ -132,7 +132,8 @@ def main(argv = None) -> Dict[str, pd.DataFrame]:
"Crosslinks": None, "Crosslinks_validated": None}

if args.output is not None:
merged_df.to_excel(".xlsx".join(args.output.split(".xlsx")[:-1]) + "_merged.xlsx", sheet_name = "CSMs", index = False)
o = args.output if ".xlsx" not in args.output else ".xlsx".join(args.output.split(".xlsx")[:-1])
merged_df.to_excel(o + "_merged.xlsx", sheet_name = "CSMs", index = False)
else:
merged_df.to_excel("CSMs_merged.xlsx", sheet_name = "CSMs", index = False)

Expand Down Expand Up @@ -162,12 +163,13 @@ def main(argv = None) -> Dict[str, pd.DataFrame]:
result_dict["Crosslinks_validated"] = validated_crosslinks

if args.output is not None:
o = args.output if ".xlsx" not in args.output else ".xlsx".join(args.output.split(".xlsx")[:-1])
if result_dict["CSMs_merged_validated"] is not None:
result_dict["CSMs_merged_validated"].to_excel(".xlsx".join(args.output.split(".xlsx")[:-1]) + "_merged_validated.xlsx", sheet_name = "CSMs", index = False)
result_dict["CSMs_merged_validated"].to_excel(o + "_merged_validated.xlsx", sheet_name = "CSMs", index = False)
if result_dict["Crosslinks"] is not None:
result_dict["Crosslinks"].to_excel(".xlsx".join(args.output.split(".xlsx")[:-1]) + "_crosslinks.xlsx", sheet_name = "Crosslinks", index = False)
result_dict["Crosslinks"].to_excel(o + "_crosslinks.xlsx", sheet_name = "Crosslinks", index = False)
if result_dict["Crosslinks_validated"] is not None:
result_dict["Crosslinks_validated"].to_excel(".xlsx".join(args.output.split(".xlsx")[:-1]) + "_crosslinks_validated.xlsx", sheet_name = "Crosslinks", index = False)
result_dict["Crosslinks_validated"].to_excel(o + "_crosslinks_validated.xlsx", sheet_name = "Crosslinks", index = False)
else:
if result_dict["CSMs_merged_validated"] is not None:
result_dict["CSMs_merged_validated"].to_excel("CSMs_merged_validated.xlsx", sheet_name = "CSMs", index = False)
Expand Down

0 comments on commit 8051b39

Please sign in to comment.