Skip to content

Commit e9233a1

Browse files
committed
Merge branch '47-openvariant-bug-windows-input-files-not-parsed-properly' of github.com:bbglab/openvariant into 47-openvariant-bug-windows-input-files-not-parsed-properly
2 parents 7139ff8 + 32f2b3b commit e9233a1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

openvariant/variant/variant.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ def _open_file(file_path: str, mode='r+b'):
3838
return mm, file
3939

4040
def _detect_delimiter(line: str):
41-
"""Detects the dominant delimiter in a line"""
42-
counts = {
43-
'\t': line.count('\t'),
44-
',': line.count(','),
45-
';': line.count(';')
46-
}
47-
return max(counts, key=counts.get)
41+
sniffer = csv.Sniffer()
42+
dialect = sniffer.sniff(line, delimiters='\t,;')
43+
return dialect.delimiter
4844

4945
def _base_parser(mm_obj: mmap, file_path: str, delimiter: str, skip_files: bool) -> Generator[int, str, None]:
5046
"""Cleaning comments and irrelevant data"""

0 commit comments

Comments
 (0)