Length of a region incorrectly calculated
Entering edit mode
balwierz ▴ 40
Last seen 2.3 years ago
United Kingdom

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)
coverageview bug • 607 views

Login before adding your answer.

Traffic: 350 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6