idxstatsBam
is failing when used on a remote (http) bam file. The corresponding .bai index file is definitely there on the server (from bash samtools idxstats
works fine). The bam file and index also seem to be fine; if downloaded to my laptop, idxstatsBam
works fine.
Other RSamtools functions, such as scanBam
seem to find the remote just fine, as shown below.
Would really like to use idxstatsBam with http-hosted bam files for quick way to count all reads in a file. Any thoughts?
# does not find remote index
idxstatsBam("http://plantsmallrnagenes.science.psu.edu/ccm-b0.32/alignments/SRR3977128_ca.bam")
Error in idxstatsBam(bam, ...) : file.exists(index(file)) is not TRUE
# but scanBam can find and use the remote index
which <- IRangesList(Ccam0.32_scaffold111 = IRanges(801256, 801507))
what <- scanBamWhat()
param <- ScanBamParam(which=which, what=what)
scanBam("http://plantsmallrnagenes.science.psu.edu/ccm-b0.32/alignments/SRR3977128_ca.bam",
param = param)
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rsamtools_2.4.0 Biostrings_2.56.0 XVector_0.28.0 GenomicRanges_1.40.0 GenomeInfoDb_1.24.2
[6] IRanges_2.22.2 S4Vectors_0.26.1 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] crayon_1.4.1 digest_0.6.27 bitops_1.0-6 evaluate_0.14
[5] zlibbioc_1.34.0 rlang_0.4.10 rstudioapi_0.13 rmarkdown_2.7
[9] BiocParallel_1.22.0 tools_4.0.2 tinytex_0.30 RCurl_1.98-1.3
[13] xfun_0.22 yaml_2.2.1 compiler_4.0.2 htmltools_0.5.1.1
[17] knitr_1.31 GenomeInfoDbData_1.2.3
Thanks Martin. Yes, that works.