Dear Günter,
When running getReadCountsFromBAM(BAMFiles), I got the following error:
Error in if (WL >= sl[i]) { : missing value where TRUE/FALSE needed
I think I understand why the error comes up, since my reference has over 2000 scaffolds, instead of chromosomes, and you have a line in the function where you do this:
sl <- as.integer(unique(sl))
Since some scaffolds have the same length, when you do this "unique", the length of the object "sl" will be different from the length of "sn".
So, the "for" loop is running from "1:m", with "m" being the length of "sn", and since "m" is bigger then the length of "sl", at some point, "sl[i]" will be inexistent, originating this error.
Is there any way to fix this? Can I just remove the "unique" line? Or will it influence the rest of the function causing downstream errors?
I encountered the same error too running cn.mops on a BAM file obtained mapping sequence reads to hg38 reference.
Was removing "unique" a good solution to the problem?
I just recently used the cn.mops on a BAM file obtained by mapping sequence reads to the bovine reference and got the same error. Is there fix for this that has been discovered?