From cac0f4e588714b03609ad1d29a8290eeab0dc7de Mon Sep 17 00:00:00 2001 From: Joshua Klein Date: Mon, 25 Mar 2024 14:04:40 -0400 Subject: [PATCH] Allow csv to handle all newlines (#316) * Add 9-species model weights link to FAQ (#303) * Add model weights link * Generate new screengrabs with rich-codex * Clarify that these weights should only be used for benchmarking --------- Co-authored-by: github-actions[bot] Co-authored-by: Wout Bittremieux * Add FAQ entry about antibody sequencing (#304) * Add FAQ entry about antibody sequencing * Generate new screengrabs with rich-codex --------- Co-authored-by: github-actions[bot] Co-authored-by: Melih Yilmaz <32707537+melihyilmaz@users.noreply.github.com> * Allow csv to handle all newlines The `csv` module tries to handle newlines itself. On Windows, this leads to line endings of `\r\r\n` instead of `\r\n`. Setting `newline=''` produces the intended output on both platforms. * Update CHANGELOG.md * Fix linting issue * Delete docs/images/help.svg --------- Co-authored-by: Melih Yilmaz <32707537+melihyilmaz@users.noreply.github.com> Co-authored-by: github-actions[bot] Co-authored-by: Wout Bittremieux Co-authored-by: William Stafford Noble Co-authored-by: Wout Bittremieux --- CHANGELOG.md | 1 + casanovo/data/ms_io.py | 2 +- docs/images/help.svg | 59 ------------------------------------------ 3 files changed, 2 insertions(+), 60 deletions(-) delete mode 100644 docs/images/help.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 38b4f869..55fed034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Fixed - Fix beam search caching failure when multiple beams have an equal predicted peptide score by breaking ties randomly. +- The mzTab output file now has proper line endings regardless of platform, fixing the extra `\r` found when run on Windows. ## [4.1.0] - 2024-02-16 diff --git a/casanovo/data/ms_io.py b/casanovo/data/ms_io.py index 7be6ea8c..de69592e 100644 --- a/casanovo/data/ms_io.py +++ b/casanovo/data/ms_io.py @@ -147,7 +147,7 @@ def save(self) -> None: """ Export the spectrum identifications to the mzTab file. """ - with open(self.filename, "w") as f: + with open(self.filename, "w", newline="") as f: writer = csv.writer(f, delimiter="\t", lineterminator=os.linesep) # Write metadata. for row in self.metadata: diff --git a/docs/images/help.svg b/docs/images/help.svg deleted file mode 100644 index baf2e237..00000000 --- a/docs/images/help.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - $ casanovo --help - - - -