View source: R/bioinfo_sequences.R
chromNames2integers | R Documentation |
Rename chromosomes into integers, especially useful with FImpute, GEMMA, qqman, SNPRelate, etc.
chromNames2integers(
x,
basic = FALSE,
prefix = "chr",
toreplace2 = "_random",
prefix2 = NULL,
thresh.max.chr.int = +Inf
)
x |
vector of chromosome names (if factor, will be converted to character) |
basic |
if TRUE, the unique chromosome identifiers will be sorted alphanumerically (which requires gtools), and will be renamed as 1, ..., nb of chromosomes (for SNPRelate) |
prefix |
characters to be removed at the start of each chromosome name (case will be ignored) |
toreplace2 |
second set of characters to be removed in chromosome names (start or end), especially useful for "random" chromosomes (case will be ignored) |
prefix2 |
second prefix to be removed at the start of each chromosome name for those for which "prefix" didn't work (case will be ignored) |
thresh.max.chr.int |
threshold on the maximum chromosome integer, above which the renaming will simply be the sequence from 1 to the number of chromosomes |
data frame with the same length as x
, and two columns named "original" and "renamed"
Timothee Flutre
## Not run: ## example from grapevine
chroms <- c("chr1", "chr1_random", "chr10", "chr10_random", "chrUn", "chr2")
chromNames2integers(x=chroms)
## example from apple
chroms <- c("Chr15", "Chr01", "Chr02", "Chr00", "Chr02")
chromNames2integers(x=chroms)
## example from cherry
chroms <- c("Super-Scaffold_14", "Super-Scaffold_4374", "Super-Scaffold_27")
chromNames2integers(x=chroms, prefix="Super-Scaffold_",
thresh.max.chr.int=500)
## example from apricot
chroms <- c("Pp08", "scaffold_51", "Pp02", "Pp01", "scaffold_23")
chromNames2integers(x=chroms, prefix="Pp", toreplace2=NULL,
prefix2="scaffold_")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.