Skip to content

Commit

Permalink
Improve fastq file type guessing Fixes #284
Browse files Browse the repository at this point in the history
  • Loading branch information
rafelafrance committed Mar 27, 2020
1 parent 0841239 commit 6c50455
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ def fasta_file_is_empty(fasta_path):
def is_fastq_file(args, file_name):
"""Check if this a FASTQ file."""
if args.get('fasta'):
is_fastq = False
elif args.get('fastq'):
is_fastq = True
else:
is_fastq = file_name.lower().endswith('q')
return is_fastq
return False
if args.get('fastq'):
return True

parts = file_name.lower().split('.')
index = -2 if re.search(r'[zp2]$', parts[-1]) and len(parts) > 2 else -1
return parts[index].startswith('f') and parts[index].endswith('q')


def shard_file_size(args, file_name):
Expand Down

0 comments on commit 6c50455

Please sign in to comment.