harmonize_seqlengths: harmonize_seqlengths

View source: R/functions_fetch_bam.R

harmonize_seqlengthsR Documentation

harmonize_seqlengths

Description

ensures compatibility between seqlength of gr and bam_file based on header

Usage

harmonize_seqlengths(query_gr, bam_file, force_fix = FALSE)

Arguments

query_gr

GRanges, object to harmonize seqlengths for

bam_file

character, a path to a valid bam file

force_fix

Logical, if TRUE incompatible seqnames are removed from the query_gr. Default is FALSE.

Value

GRanges with seqlengths matching bam_file

Examples

library(GenomicRanges)
query_gr = GRanges("chr1", IRanges(1, 100))
#seqlengths has not been set
seqlengths(query_gr)
bam = system.file("extdata/test.bam", package = "seqsetvis")
gr2 = harmonize_seqlengths(query_gr, bam)
#seqlengths now set
seqlengths(gr2)

jrboyd/seqsetvis documentation built on Dec. 10, 2024, 11:23 a.m.