numericCHR: Conversion of chromosome IDs between numeric and character

Description Usage Arguments Value Author(s) Examples

View source: R/quantsmoothplot.R

Description

The function converts chromosomal ids to their numeric form, and the sex chromosomes to values between 98 and 100. This simplifies sorting on chromosome ID

Usage

1
2
numericCHR(CHR, prefix="chr")
characterCHR(CHR, prefix="")

Arguments

CHR

character/numeric vector for both functions the mode of the input is not forced. For numericCHR strings "X","Y" and "XY" are converted to 98,99 and 100 respectively.

prefix

character, string is excluded from (numericCHR) or prepended to (characterCHR) all items of the output

Value

numericCHR returns a numeric vector of same length as CHR characterCHR returns a character vector of same length as CHR

Author(s)

Jan Oosting

Examples

1
2
3
4
   chroms<-c("3","2","8","X","7","Y","5","1","9","10","11","12","4","6")
   sort(chroms)
   sort(numericCHR(chroms))
   characterCHR(sort(numericCHR(chroms)),prefix="chr")

quantsmooth documentation built on Nov. 8, 2020, 8:27 p.m.