Skip to content

Commit

Permalink
Remove gunzip -c and replace with zcat
Browse files Browse the repository at this point in the history
  • Loading branch information
Colelyman committed Aug 29, 2024
1 parent 3eba615 commit ca92dd0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CRISPResso2/CRISPRessoCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def check_program(binary_name, download_url=None, version_flag=None, version_reg
check_fastp = lambda: check_program('fastp', download_url='http://opengene.org/fastp/fastp', version_flag='--version', version_regex=r'fastp (\d+)\.(\d+)\.(\d+)', version=(0, 19, 8))

def get_avg_read_length_fastq(fastq_filename):
cmd = 'gunzip -c' if fastq_filename.endswith('.gz') else 'cat' + \
cmd = 'zcat' if fastq_filename.endswith('.gz') else 'cat' + \
' < \"%s\"' % fastq_filename + \
r''' | awk 'BN {n=0;s=0;} NR%4 == 2 {s+=length($0);n++;} END { printf("%d\n",s/n)}' '''
p = sb.Popen(cmd, shell=True, stdout=sb.PIPE)
Expand Down
2 changes: 1 addition & 1 deletion CRISPResso2/CRISPRessoShared.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def get_command_output(command):

def get_n_reads_fastq(fastq_filename):
"""Count the number of reads from fastq_filename."""
p = sb.Popen('gunzip -c' if fastq_filename.endswith('.gz') else 'cat' + ' < "%s" | wc -l' % fastq_filename, shell=True, stdout=sb.PIPE)
p = sb.Popen('zcat' if fastq_filename.endswith('.gz') else 'cat' + ' < "%s" | wc -l' % fastq_filename, shell=True, stdout=sb.PIPE)
return round(float(p.communicate()[0]) / 4.0)


Expand Down

0 comments on commit ca92dd0

Please sign in to comment.