I need help debugging an error from the CNVPanelizer package. The code, output, traceback, and sessioninfo are shown below. The version of R is 3.3.3, and the version of R studio is 1.0.136. ScanBam does read in the bam files, so I know that these files are valid. I can also visualize the files in IGV.
I am certain that my packages have been loaded and are up-to-date:
> source("https://bioconductor.org/biocLite.R")
Bioconductor version 3.5 (BiocInstaller 1.26.1), ?biocLite for help
> library("CNVPanelizer")
> BiocInstaller::biocValid()
[1] TRUE
I have read in my bed file and converted it to a GRanges object (partially printed out to confirm):
> bed = read.table("CNS panel/BEDv3.bed",sep = "", skip = 1, header = FALSE)
> colnames(bed) = c("chr", "start", "end", "amplicon", "na1", "na2", "na3", "gene")
> bed[, c("na1", "na2", "na3")] = NULL
> gene = sub(pattern = "GENE_ID=", replacement = "", x = bed$gene)
> gene = sub(pattern = ";Pool=1", replacement = "", x = gene)
> gene = sub(pattern = ";Pool=2", replacement = "", x = gene)
> bed$gene = as.factor(gene)
> ampliconNames = bed$amplicon
> GRbed = makeGRangesFromDataFrame(bed, keep.extra.columns = TRUE)
> head(GRbed)
GRanges object with 6 ranges and 2 metadata columns:
seqnames ranges strand | amplicon gene
<Rle> <IRanges> <Rle> | <factor> <factor>
[1] chr1 [78414940, 78415056] * | AMPL7161868567 FUBP1
[2] chr1 [78420965, 78421056] * | AMPL7161219286 FUBP1
[3] chr1 [78422278, 78422398] * | AMPL7161868565 FUBP1
[4] chr1 [78425840, 78425944] * | AMPL7161219288 FUBP1
[5] chr1 [78426079, 78426195] * | AMPL7160313815 FUBP1
[6] chr1 [78428430, 78428520] * | AMPL7161868564 FUBP1
-------
seqinfo: 20 sequences from an unspecified genome; no seqlengths
I have specified the correct file directories and have correctly obtained the bam file names:
> controlDirectory = "C:/Users/patelsb/Desktop/Control"
> sampleDirectory = "C:/Users/patelsb/Desktop/Samples"
> (controlFileNames = list.files(path = controlDirectory, pattern = ".bam", full.names = TRUE))
[1] "C:/Users/patelsb/Desktop/Control/AF1.bam" "C:/Users/patelsb/Desktop/Control/AF2.bam"
[3] "C:/Users/patelsb/Desktop/Control/AM1.bam" "C:/Users/patelsb/Desktop/Control/AM2.bam"
[5] "C:/Users/patelsb/Desktop/Control/CEPH.bam" "C:/Users/patelsb/Desktop/Control/EA1.bam"
[7] "C:/Users/patelsb/Desktop/Control/EA2.bam" "C:/Users/patelsb/Desktop/Control/EU1.bam"
[9] "C:/Users/patelsb/Desktop/Control/EU2.bam" "C:/Users/patelsb/Desktop/Control/NT05.bam"
[11] "C:/Users/patelsb/Desktop/Control/NT06.bam" "C:/Users/patelsb/Desktop/Control/NT11.bam"
[13] "C:/Users/patelsb/Desktop/Control/NT13.bam" "C:/Users/patelsb/Desktop/Control/NT14.bam"
[15] "C:/Users/patelsb/Desktop/Control/NT15.bam" "C:/Users/patelsb/Desktop/Control/NT17.bam"
[17] "C:/Users/patelsb/Desktop/Control/NT18.bam" "C:/Users/patelsb/Desktop/Control/NT25.bam"
[19] "C:/Users/patelsb/Desktop/Control/NT26.bam" "C:/Users/patelsb/Desktop/Control/SA1.bam"
[21] "C:/Users/patelsb/Desktop/Control/SA2.bam"
> (sampleFileNames = list.files(path = sampleDirectory, pattern = ".bam", full.names = TRUE))
[1] "C:/Users/patelsb/Desktop/Samples/E697.bam" "C:/Users/patelsb/Desktop/Samples/M217.bam"
[3] "C:/Users/patelsb/Desktop/Samples/M448.bam" "C:/Users/patelsb/Desktop/Samples/M533.bam"
[5] "C:/Users/patelsb/Desktop/Samples/N629.bam" "C:/Users/patelsb/Desktop/Samples/N637.bam"
[7] "C:/Users/patelsb/Desktop/Samples/N651.bam" "C:/Users/patelsb/Desktop/Samples/N973.bam"
[9] "C:/Users/patelsb/Desktop/Samples/P270.bam" "C:/Users/patelsb/Desktop/Samples/P308.bam"
[11] "C:/Users/patelsb/Desktop/Samples/P443.bam" "C:/Users/patelsb/Desktop/Samples/P454.bam"
[13] "C:/Users/patelsb/Desktop/Samples/P515.bam" "C:/Users/patelsb/Desktop/Samples/P682.bam"
[15] "C:/Users/patelsb/Desktop/Samples/P792.bam" "C:/Users/patelsb/Desktop/Samples/P794.bam"
[17] "C:/Users/patelsb/Desktop/Samples/P916.bam" "C:/Users/patelsb/Desktop/Samples/P918.bam"
[19] "C:/Users/patelsb/Desktop/Samples/P979.bam" "C:/Users/patelsb/Desktop/Samples/Q059.bam"
[21] "C:/Users/patelsb/Desktop/Samples/Q104.bam"
When I attempt to obtain the reference counts, I get an error:
> referenceReadCounts <- ReadCountsFromBam(bamFilenames = controlFileNames, gr = GRbed, sampleNames = controlFileNames, ampliconNames = ampliconNames, removeDup = FALSE)
Error in { :
task 1 failed - "failed to open BamFile: failed to load BAM index
file: C:/Users/patelsb/Desktop/Control/AF1.bam"
In addition: There were 21 warnings (use warnings() to see them)
Warnings:
> warnings()
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
2: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
3: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
4: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
5: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
6: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
7: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
8: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
9: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
10: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
11: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
12: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
13: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
14: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
15: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
16: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
17: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
18: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
19: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
20: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
21: In doTryCatch(return(expr), name, parentenv, handler) :
[bam_index_load] fail to load BAM index.
Traceback:
> traceback()
4: stop(simpleError(msg, call = expr))
3: e$fun(obj, substitute(ex), parent.frame(), e$data)
2: foreach(i = seq_along(bamFilenames), .combine = cbind) %do% {
countBamInGRanges(bamFilenames[i], gr, remove.dup = removeDup,
min.mapq = 20, get.width = TRUE)
}
1: ReadCountsFromBam(bamFilenames = controlFileNames, gr = GRbed,
sampleNames = controlFileNames, ampliconNames = ampliconNames,
removeDup = FALSE)
session information:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] CNVPanelizer_1.6.0 GenomicRanges_1.28.5 GenomeInfoDb_1.12.2 IRanges_2.10.3
[5] S4Vectors_0.14.4 BiocGenerics_0.22.0 BiocInstaller_1.26.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 exomeCopy_1.22.0 XVector_0.16.0
[4] splines_3.4.1 zlibbioc_1.22.0 BiocParallel_1.10.1
[7] munsell_0.4.3 colorspace_1.3-2 lattice_0.20-35
[10] rlang_0.1.2 foreach_1.4.3 plyr_1.8.4
[13] tools_3.4.1 grid_3.4.1 Biobase_2.36.2
[16] gtable_0.2.0 NOISeq_2.20.0 iterators_1.0.8
[19] lazyeval_0.2.0 tibble_1.3.4 Matrix_1.2-11
[22] GenomeInfoDbData_0.99.0 ggplot2_2.2.1 bitops_1.0-6
[25] codetools_0.2-15 RCurl_1.95-4.8 openxlsx_4.0.17
[28] compiler_3.4.1 Biostrings_2.44.2 Rsamtools_1.28.0
[31] scales_0.5.0
This is my first post to this forum, so I apologize in advance if I failed to conform to any aspect of the posting guidelines.
Thank you,
Snehal Patel, MD, PhD
National Institutes of Health, National Cancer Center