Skip to content

Commit

Permalink
Catch length-2 filtering arguments when processing single-end data
Browse files Browse the repository at this point in the history
And provide an informative error message to help users fix the function
call.

Fixes benjjneb#388
  • Loading branch information
benjjneb committed Mar 20, 2019
1 parent 905dc8f commit 3b6bec5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions R/filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ fastqFilter <- function(fn, fout, truncQ = 2, truncLen = 0, maxLen = Inf, minLen
ompthreads <- .Call(ShortRead:::.set_omp_threads, 1L)
on.exit(.Call(ShortRead:::.set_omp_threads, ompthreads))
}
if(any(sapply(list(truncQ, truncLen, maxLen, minLen, trimLeft, trimRight, maxN, minQ, maxEE), length) > 1)) {
stop("Filtering and trimming arguments should be of length 1 when processing single-end (rather than paired-end) data.")
}

start <- max(1, trimLeft + 1, na.rm=TRUE)
end <- truncLen
Expand Down
4 changes: 2 additions & 2 deletions man/fastqFilter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/fastqPairedFilter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions man/filterAndTrim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b6bec5

Please sign in to comment.