samtools_sort_index {FLAMES} | R Documentation

## Samtools Sort and Index

### Description

Sort and index the given BAM file, using Rsamtools.

### Usage

    samtools_sort_index(bam_in, bam_out)

### Arguments

`bam_in` | the file path to the BAM file to sort and index
`bam_out` | path to the output indexed BAM file.

### Value

file path to the created BAM

### Examples

    temp_path <- tempfile()
    bfc <- BiocFileCache::BiocFileCache(temp_path, ask = FALSE)
    file_url <-
        "https://raw.githubusercontent.com/OliverVoogd/FLAMESData/master/data"
    genome_bam <- paste0(temp_path, "/align2genome.bam")
    file.rename(bfc[[names(BiocFileCache::bfcadd(bfc, "Genome BAM", paste(file_url, "align2genome.bam", sep = "/")))]], genome_bam)

    samtools_sort_index(genome_bam, tempfile(fileext = ".bam"))

[Package FLAMES version 1.0.2 Index]