This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CoverageView package_Error in 1:nrow(grDF) : argument of length 0

Hi,

I am trying to use cov.matrix() from CoverageView package and getting following error:

>mybed <- read.table("mybed.bed", sep='\t', header = FALSE)
>mybed
      V1     V2     V3     V4     V5    V6
1   chr1    468    558 AMPL1 strand gene1
2   chr1   1558   1609  AMPL2 strand gene2
3   chr1   3768   3817  AMPL3 strand gene3
4   chr3     10     59  AMPL4 strand gene3
5   chr3   1067   1128  AMPL5 strand gene4

>trm <- CoverageBamFile("mybam.bam", reads_mapped=11906)
>trm
class: CoverageBamFile 
path: mybam.bam
index: mybam.bam.bai
isOpen: FALSE 
yieldSize: NA 
obeyQname: FALSE 
asMates: FALSE 
qnamePrefixEnd: NA 
qnameSuffixStart: NA 
reads_mapped: 11906 
run_type: single 

>df <- cov.matrix(trm, coordfile = mybed, ctl = NULL, extend = 10, num_cores=1)    
[INFO] A coverage matrix will be generated by calculating the 'log2ratio' of the coverages.
[INFO] processing:mybam.bam
Error in 1:nrow(grDF) : argument of length 0

>traceback()
4: lapply(X, FUN, ...)
3: mclapply(1:nrow(grDF), loopfun, mc.cores = num_cores, obj = tr)
2: cov.matrix(trm, coordfile = mybed, ctl = NULL, extend = 10, num_cores = 1)
1: cov.matrix(trm, coordfile = mybed, ctl = NULL, extend = 10, num_cores = 1)

Kindly guide.

Thanks!

coverageview r bioconductor mclapply

1 answer

I had the same issue, but for me it worked when I specified the path to the bed file instead of the object to which I have saved it in before. Try:

>df <- cov.matrix(trm, coordfile = "mybed.bed", ctl = NULL, extend = 10, num_cores=1)

instead of

>df <- cov.matrix(trm, coordfile = mybed, ctl = NULL, extend = 10, num_cores=1)

Log in to answer this question.