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))
Details
The possible tags for mod_code can be found at https://samtools.github.io/hts-specs/SAMtags.pdf under the 'Base modifications' section.
Examples
out_file <- paste0(tempfile(), ".tsv.bgz")
mbr <- ModBamResult(
methy = ModBamFiles(
samples = "sample1",
paths = system.file("peg3.bam", package = "NanoMethViz")
),
samples = data.frame(
sample = "sample1",
group = "group1"
)
)
modbam_to_tabix(mbr, out_file)
#> ℹ Converting data to TSV
#> ✔ Converting data to TSV [336ms]
#>
#> ℹ Sorting data
#> ✔ Sorting data [24ms]
#>
#> ℹ Compressing data
#> ✔ Compressing data [33ms]
#>
#> ℹ Tabix file created: /tmp/RtmpkcGR9F/file1706484e9415.tsv.bgz
#> ✔ Tabix file created: /tmp/RtmpkcGR9F/file1706484e9415.tsv.bgz [11ms]
#>