File tree Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -1435,7 +1435,7 @@ def check_is_fasta(in_file):
1435
1435
1436
1436
def check_fastq_entries (in_file ):
1437
1437
"""
1438
- Check how many reads are in the input fastq. Requires zcat.
1438
+ Check how many reads are in the input fastq.
1439
1439
1440
1440
Parameters
1441
1441
----------
@@ -1450,24 +1450,12 @@ def check_fastq_entries(in_file):
1450
1450
1451
1451
with open (in_file , 'rb' ) as f :
1452
1452
is_gzip = f .read (2 ) == b'\x1f \x8b '
1453
-
1454
1453
if is_gzip :
1455
- n_lines = sp .run (
1456
- "zcat < {f} | wc -l" .format (f = in_file ),
1457
- stdout = sp .PIPE ,
1458
- stderr = sp .PIPE ,
1459
- shell = True ,
1460
- encoding = 'utf-8'
1461
- ).stdout [:- 2 ].split (" " )[0 ]
1454
+ with gzip .open (in_file , "rt" ) as input_fastq :
1455
+ n_lines = sum (1 for line in input_fastq )
1462
1456
else :
1463
- n_lines = sp .run (
1464
- "wc -l {f}" .format (f = in_file ),
1465
- stdout = sp .PIPE ,
1466
- stderr = sp .PIPE ,
1467
- shell = True ,
1468
- encoding = 'utf-8'
1469
- ).stdout [:- 2 ].split (" " )[0 ]
1470
-
1457
+ with open (in_file , "r" ) as input_fastq :
1458
+ n_lines = sum (1 for line in input_fastq )
1471
1459
n_reads = int (n_lines )/ 4
1472
1460
return n_reads
1473
1461
Original file line number Diff line number Diff line change @@ -886,6 +886,7 @@ def _out_file(fname):
886
886
pairs_idx = input1
887
887
888
888
# Perform genome alignment
889
+ nreads_input1 = 0
889
890
if start_stage == 0 :
890
891
891
892
# Check number of reads in both fastqs
@@ -895,7 +896,7 @@ def _out_file(fname):
895
896
if (nreads_input1 != nreads_input2 ):
896
897
logger .error ("Fastq files do not have the same number of reads." )
897
898
else :
898
- logger .info ("{n} reads found in each fastq file." .format (n = nreads_input1 ))
899
+ logger .info ("{n} reads found in each fastq file." .format (n = int ( nreads_input1 ) ))
899
900
900
901
# Define mapping choice (default normal):
901
902
if mapping == "normal" :
You can’t perform that action at this time.
0 commit comments