Skip to content

Commit

Permalink
Update _filter_file.py
Browse files Browse the repository at this point in the history
add support for `.bgz` file endings sometimes used by FinaleDB
  • Loading branch information
jamesli124 authored Feb 2, 2025
1 parent ed501be commit c0041c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/finaletoolkit/utils/_filter_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def validate_deprecated_args(old_arg, new_arg, old_name, new_name):
return new_arg

def validate_input_file(input_file):
valid_suffixes = {".gz", ".bam", ".cram"}
valid_suffixes = {".gz", ".bam", ".cram", ".bgz"}
if not any(input_file.endswith(suffix) for suffix in valid_suffixes):
raise ValueError(f"Input file should have one of the following suffixes: {', '.join(valid_suffixes)}")
return next(suffix for suffix in valid_suffixes if input_file.endswith(suffix))
Expand Down Expand Up @@ -201,7 +201,7 @@ def filter_file(
logger=logger
)

elif input_file.endswith('.gz'):
elif input_file.endswith('.gz') or input_file.endswith('.bgz'):
with gzip.open(input_file, 'rt') as infile, open(temp_1, 'w') as outfile:
for line in filter_bed_entries(infile, min_length, max_length, quality_threshold):
outfile.write(line)
Expand Down

0 comments on commit c0041c0

Please sign in to comment.