Just spent some time scratching my head over an error message in derfinder and wanted to suggest that this is a spot for catching user error and giving guidance about what's going on.
Turns out I called
fullCov <- fullCoverage(files, chrs = c(1:38, 'X'))
where "files" was (unbeknownst to me) a zero-length list. I expected it to contain actual filenames. The error message I got was:
Error: 1 errors; first error: Error in seqlengths(bList[[1]]): error in evaluating the argument 'x' in selecting a method for function 'seqlengths': Error in normalizeDoubleBracketSubscript(i, x, exact = exact, error.if.nomatch = FALSE) : subscript is out of bounds For more information, use bplasterror(). To resume calculation, re-call the function and set the argument 'BPRESUME' to TRUE or wrap the previous call in bpresume(). First traceback: 16: fullCoverage(files, chrs = "1") 15: bplapply(seq_len(length(chrs)), loadChr, files = files, chrs = chrs, bai = bai, chrlens = chrlens, outputs = outputs, cutoff = cutoff, mc.load = mc.cores.load, ..., BPPARAM = BPPARAM) 14: bplapply(seq_len(length(chrs)), loadChr, files = files, chrs = chrs, bai = bai, chrlens = chrlens, outputs = outputs, cutoff = cutoff, mc.load = mc.cores.load, ..., BPPARAM = BPPARAM) 13: lapply(X, FUN, ...) 12: lapply(X, FUN, ...) 11: FUN(1L[[1L]], ...)
I propose that fullCoverage() should check the length of the files vector and return an informative error message if it's zero.
Hope this is helpful and posted in the right place!
Jessica