Entering edit mode
Length of a region is calculated as end - start, instead of end - start + 1.
This causes problems when length of a region equals no_windows.
I also suggest either checking this condition before CPU intensive operations on a bam file, using warnings instead of stop, or solving the problem properly for shorter genes (i.e. by assigning a position to multiple bins)
In cov.bin.R:
setMethod("cov.bin", signature(extend = "missing", no_windows = "numeric", obj = "CoverageBamFile",
chr = "missing", grFromWig = "missing"), function(x, no_windows, obj, offset) {
chr <- as.character(x[[1]])
start.pre <- as.integer(x[[2]])
end.pre <- as.integer(x[[3]])
strand <- as.character(x[[5]])
message("[INFO] processing coords:", chr, " ", start.pre, " ", end.pre)
ceil <- end.pre - start.pre
if (ceil < no_windows) {
errormsg <- paste("[ERROR] nucleotidic interval from start to end coordinates cannot be smaller than the no_windows value. The interval:",
chr, start.pre, end.pre, "is not valid!", sep = " ")
stop(errormsg, call. = FALSE)
}
...