Since many softwares (like GATK 4.1.7.0 I'm using now) generate bam index with file name like a.bam and a.bai instead of a.bam.bai, maybe we can change the index matching code from this:
## Index .bam files
- if (!all(file.exists(gsub("$", ".bai", sample.paths)))) {
+ if (!all(file.exists(gsub("$", ".bai", sample.paths)) | file.exists(gsub("\\.bam$", ".bai", sample.paths)))) {
if (file.access(".", 2) == -1) {
stop(.wrap("The .bam files are not indexed and you do not have",
"write permission in (one of) the folder(s) where the",
".bam files are located."))
}
IndexBam <- function(sample.paths) {
indexBam(sample.paths)
paste0("indexBam(\"", sample.paths, "\")")
}
to.log <- bplapply(sample.paths, IndexBam, BPPARAM = bp.param)
lapply(to.log, flog.info)
}
Since many softwares (like GATK 4.1.7.0 I'm using now) generate bam index with file name like
a.bam
anda.bai
instead ofa.bam.bai
, maybe we can change the index matching code from this: