I have run a very large bam (186 G) file through the countBam function from the Rsamtools package, and got an unexpected error:
> library(Rsamtools) > countBam(large.bam.file) Error in value[[3L]](cond) : 'countBam' failed: record: -2023186199 error: 0 file: /home/NFS/research_projects/combat_cancer/Lung_cancer_data_set/Mouse/FVB_NJ.bam index:
At first I thought that there was an error in the bam file, but we have checked the integrity of the bam file compared to the source using md5, and additionally running samtools from the command line on the same file just works fine:
$ samtools view -c ./large_bam_file.bam 2271781097
Also, I have used countBam successfully for other smaller bam files. Does anyone have any suggestions as to where this error stems from?
Here's my sessionInfo():
> sessionInfo() R version 3.3.0 (2016-05-03) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.1 LTS locale:  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C  LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8  LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8  LC_PAPER=en_US.UTF-8 LC_NAME=C  LC_ADDRESS=C LC_TELEPHONE=C  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages:  parallel stats4 stats graphics grDevices utils datasets  methods base other attached packages:  snow_0.4-1 futile.logger_1.4.1  CopyhelpeR_1.4.0 DNAcopy_1.46.0  chipseq_1.22.0 ShortRead_1.30.0  GenomicAlignments_1.8.0 SummarizedExperiment_1.2.2  Biobase_2.32.0 Rsamtools_1.24.0  Biostrings_2.40.0 XVector_0.12.0  BiocParallel_1.6.2 GenomicRanges_1.24.0  GenomeInfoDb_1.8.1 IRanges_2.6.0  S4Vectors_0.10.0 BiocGenerics_0.18.0  data.table_1.9.6 gtools_3.5.0  matrixStats_0.50.2 loaded via a namespace (and not attached):  zlibbioc_1.18.0 lattice_0.20-33 hwriter_1.3.2  tools_3.3.0 grid_3.3.0 latticeExtra_0.6-28  lambda.r_1.1.7 RColorBrewer_1.1-2 futile.options_1.0.0  bitops_1.0-6 chron_2.3-47