diff --git a/pybedlite/bed_source.py b/pybedlite/bed_source.py index ee8eb13..49f2f29 100644 --- a/pybedlite/bed_source.py +++ b/pybedlite/bed_source.py @@ -125,7 +125,7 @@ def parse_rgb(x: str) -> Tuple[int, int, int]: continue if line.strip() == "": continue - fields = line.strip().split("\t") + fields = line.strip().split() assert len(fields) >= 3, ( "BED records must conform to specifications, which requires at least 3 input " + f"fields. On line {i} in {self._path} had only {len(fields)} fields" diff --git a/pybedlite/tests/test_pybedlite.py b/pybedlite/tests/test_pybedlite.py index 1843538..b996c3b 100644 --- a/pybedlite/tests/test_pybedlite.py +++ b/pybedlite/tests/test_pybedlite.py @@ -14,9 +14,15 @@ # Test header, with a line with whitespace below it. # More header + +# BED record with tabs as a separator 1 100 150 test_record1 100 + 100 100 0,0,0 1 50 0 -1 200 300 test_record2 100 - 210 290 0,0,0 1 100 0 -2 200 300 test_record3 . . . . . . . . + +# BED record with spaces as a separator +1 200 300 test_record2 100 - 210 290 0,0,0 1 100 0 + +# BED record with a mix of spaces and tabs as a separator +2 200 300 test_record3 . . . . . . . . """