modbam_to_tabix: Convert BAM with modifications to tabix format

View source: R/modbam_to_tabix.R

modbam_to_tabixR Documentation

Convert BAM with modifications to tabix format

Description

The modbam_to_tabix function takes a ModBamResult object and converts it into a tabix file format, which is efficient for indexing and querying large datasets.

Usage

modbam_to_tabix(x, out_file, mod_code = NanoMethViz::mod_code(x))

Arguments

x

the ModBamResult object.

out_file

the path of the output tabix.

mod_code

the modification code to use, defaults to 'm' for 5mC methylation.

Details

The possible tags for mod_code can be found at https://samtools.github.io/hts-specs/SAMtags.pdf under the 'Base modifications' section.

Value

invisibly returns the name of the created tabix file.

Examples

out_file <- paste0(tempfile(), ".tsv.bgz")
mbr <- ModBamResult(
    methy = ModBamFiles(
        samples = "sample1",
        paths = system.file("peg3.bam", package = "NanoMethViz",
        mustWork = FALSE)
    ),
    samples = data.frame(
        sample = "sample1",
        group = "group1"
    )
)

modbam_to_tabix(mbr, out_file)


Shians/NanoMethViz documentation built on Dec. 17, 2024, 8:56 a.m.