R/extendedMapSeqlevels.R
extendedMapSeqlevels.Rd
If available, use the information from GenomeInfoDb for your species of
interest to map the sequence names from the style currently used to another
valid style. For example, for Homo sapiens map '2' (NCBI style) to 'chr2'
(UCSC style). If the information from GenomeInfoDb is not available, the
original sequence names will be returned. To disable this functionality
specify set chrsStyle
to NULL
.
A character vector with the sequence names.
A single character vector specifying the naming style to use for renaming the sequence names.
A single character vector with the species of interest: it has
to match the valid species names supported in GenomeInfoDb. See
names(GenomeInfoDb::genomeStyles())
. If species = NULL
,
a guess will be made using the available information in GenomeInfoDb.
A single character vector with the currently used
naming style. If NULL
, a guess will be made from the naming styles
supported by species
.
Arguments passed to other methods and/or advanced arguments. Advanced arguments:
If TRUE
basic status updates will be printed along
the way.
The naming style of the chromosomes. By default,
UCSC
. See seqlevelsStyle. Set to NULL
to
disable this function. This is used when style
is missing, which is
normally the case when extendedMapSeqlevels
is called by other
functions.
A vector of sequence names using the specified naming style
.
This function is inspired from mapSeqlevels with the difference that it will return the original sequence names if the species, current naming style or target naming style are not supported in GenomeInfoDb.
If you want to disable this function, set chrsStyle
to NULL
.
From other functions in derfinder that pass the
...
argument to this function, use chrsStyle = NULL
.
This can be useful when working
with organisms that are absent from GenomeInfoDb as documented in
https://support.bioconductor.org/p/95521/.
## Without guessing any information
extendedMapSeqlevels("2", "UCSC", "Homo sapiens", "NCBI")
#> [1] "chr2"
## Guessing the current naming style
extendedMapSeqlevels("2", "UCSC", "Homo sapiens")
#> extendedMapSeqlevels: sequence names mapped from NCBI to UCSC for species homo_sapiens
#> [1] "chr2"
## Guess species and current style
extendedMapSeqlevels("2", "NCBI")
#> [1] "2"
## Guess species while supplying the current style.
## Probably an uncommon use-case
extendedMapSeqlevels("2", "NCBI", currentStyle = "TAIR10")
#> extendedMapSeqlevels: the 'currentStyle' TAIR10 is currently not supported for the 'species' homo_sapiens in GenomeInfoDb. Check valid naming styles by running GenomeInfoDb::genomeStyles(species). If it's not present, consider adding your genome by following the information at http://www.bioconductor.org/packages/release/bioc/vignettes/GenomeInfoDb/inst/doc/Accept-organism-for-GenomeInfoDb.pdf
#> [1] "2"
## Sequence names are unchanged when using an unsupported species
extendedMapSeqlevels("seq2", "NCBI", "toyOrganism")
#> extendedMapSeqlevels: the 'seqnames' you supplied are currently not supported in GenomeInfoDb. Consider adding your genome by following the information at http://www.bioconductor.org/packages/release/bioc/vignettes/GenomeInfoDb/inst/doc/Accept-organism-for-GenomeInfoDb.pdf
#> [1] "seq2"
## Disable extendedMapSeqlevels. This can be useful when working with
## organisms that are not supported by GenomeInfoDb
chrs <- c(
"I", "II", "III", "IV", "IX", "V", "VI", "VII", "VIII", "X",
"XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII"
)
extendedMapSeqlevels(chrs, chrsStyle = NULL)
#> [1] "I" "II" "III" "IV" "IX" "V" "VI" "VII" "VIII" "X"
#> [11] "XI" "XII" "XIII" "XIV" "XV" "XVI" "XVII"
if (FALSE) {
## Set global species and style option
options("chrsStyle" = "UCSC")
options("species" = "homo_sapiens")
## Run using global options
extendedMapSeqlevels("2")
}