This function will determine if all input ranges objects have the same chromosome naming convention. Input objects can be GenomicRanges, BSgenome or Biostrings object with seqlevel information.

has_consistentSeqlevels(..., verbose = TRUE)

Arguments

...

Two or more objects with seqlevels information

verbose

Whether to print out message

Value

Logical value as to whether all objects have consistent seqlevel styles

Author

Fursham Hamid

Examples

## ---------------------------------------------------------------------
## EXAMPLE USING TOY DATASET
## ---------------------------------------------------------------------
require(GenomicRanges)

## Create toy GRanges objects
gr1 <- GRanges("1", IRanges(start = c(1, 101), width = c(20, 20)), "+")
gr2 <- GRanges("chr1", IRanges(start = c(1, 101), width = c(20, 20)), "+")

## Test for seqlevels consistency
has_consistentSeqlevels(gr1, gr2)
#> Warning: Try running: gr1 <- matchChromosomes(gr1, gr2)
#> [1] FALSE

## Input can be a Biostrings object with seqlevels information
x0 <- c("chr2" = "CTCACCAGTAT", "chr3" = "TGTCAGTCGA")
dna <- Biostrings::DNAStringSet(x0)

## Test for seqlevels consistency
has_consistentSeqlevels(gr1, dna)
#> Warning: Try running: gr1 <- matchChromosomes(gr1, dna)
#> [1] FALSE
has_consistentSeqlevels(gr2, dna)
#> Warning: 1 seqlevel(s) in `gr2` are not found in `dna`
#> [1] TRUE