Skip to content

matching bam index with file name pattern like "a.bam" and "a.bai" #32

Description

@MajoroMask

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)
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions