From 6e3d4c5cf0c9f4b6f468092730e4b6b22f7e5170 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 16 Feb 2024 14:13:39 +0300 Subject: Strip comment lines. --- r_qtl/r_qtl2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index 93ce56c..e4c1894 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -302,3 +302,7 @@ def raw_file_data(zipfilepath: Union[str, Path], wrappedfile = io.TextIOWrapper(innerfile) for line in wrappedfile: yield line.strip() + +def strip_comments(rawdata: Iterator[str], commentchar) -> Iterator[str]: + """Remove comments from raw text.""" + return (line for line in rawdata if not line.startswith(commentchar)) -- cgit v1.2.3