Skip to content

Commit 069f036

Browse files
committed
do not throw error if input paired end files are empty when doing --detect-adapter.
1 parent d615d10 commit 069f036

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
- Feature: multiple primer trimming.
66
- Feature: UMI trimming.
77

8+
## v4.1.2
9+
10+
- Fix: do not throw error if input paired end files are empty when doing `--detect-adapter`.
11+
812
## v4.1.1
913

1014
- Fix: `-z NUM -Z NUM` error when length to trim < 0.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Atria"
22
uuid = "226cbef3-b485-431c-85c2-d8bd8da14025"
33
authors = ["Jiacheng Chuan <jiacheng_chuan@outlook.com>"]
4-
version = "4.1.1"
4+
version = "4.1.2"
55

66
[deps]
77
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"

src/FqRecords/thread_input.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ function load_fqs_threads!(
9292
n_r2 = append_loop!(r2s, vr2s, tasks2; remove_first_n=n_remove_r2)
9393
# @info "load_fqs_threads! StringChunk2FqRecord! - stop - R2"
9494

95-
(n_r1 == 0 || n_r2 == 0) && throw(error("Numbers of reads in R1 and R2 not the same!"))
95+
if n_r1 == n_r2 == 0 # input r1.fastq and r2.fastq are empty (no reads)
96+
elseif n_r1 == 0 || n_r2 == 0
97+
throw(error("Numbers of reads in R1 and R2 not the same!"))
98+
end
9699

97100
return n_r1, n_r2, r1s, r2s, ncopyed
98101
end
@@ -280,7 +283,10 @@ function load_fqs_threads!(
280283

281284
n_r2 = FqRecords.append_loop!(r2s, vr2s, tasks2; remove_first_n=n_remove_r2)
282285

283-
(n_r1 == 0 || n_r2 == 0) && throw(error("Numbers of reads in R1 and R2 not the same!"))
286+
if n_r1 == n_r2 == 0 # input r1.fastq and r2.fastq are empty (no reads)
287+
elseif n_r1 == 0 || n_r2 == 0
288+
throw(error("Numbers of reads in R1 and R2 not the same!"))
289+
end
284290

285291
return n_r1, n_r2, r1s, r2s, in1bytes_nremain, in2bytes_nremain, ncopyed
286292
end
@@ -446,6 +452,10 @@ Return (chunk_size1, chunk_size2):Tuple{Int,Int}
446452
n_r1_read = n_r1 - n_r1_before
447453
n_r2_read = n_r2 - n_r2_before
448454

455+
if n_r1_read == n_r2_read == 0 # input r1.fastq and r2.fastq are empty (no reads)
456+
return length(in1bytes), length(in2bytes)
457+
end
458+
449459
avg_length_r1 = length(in1bytes) / n_r1_read
450460
avg_length_r2 = length(in2bytes) / n_r2_read
451461

0 commit comments

Comments
 (0)