#' Find chromosome
#'
#' Find the chromosome and position on that chromosome corresponding to a given ID5.
#'
#' @param pos an ID5
#'
#' @return the chromosome and position on the chromosome corresponding to that ID5
#' @export
#'
#' @examples
findChr = function(pos) {
hg19chr = paste0( 'chr', c(1:22, 'X', 'Y', 'M') )
hg19len = c( 249250621, 243199373, 198022430, 191154276, 180915260, 171115067, 159138663, 146364022, 141213431, 135534747,
135006516, 133851895, 115169878, 107349540, 102531392, 90354753, 81195210, 78077248, 59128983, 63025520,
48129895, 51304566, 155270560, 59373566, 16571)
chrOffsets = cumsum(as.numeric(c(0, hg19len)))
chrOffsets = chrOffsets[1:length(chrOffsets)-1]
names(chrOffsets) = hg19chr
m = min(which( chrOffsets > abs(pos) ))-1
paste0(names(chrOffsets)[m], ":", prettyNum(abs(pos)-chrOffsets[m], big.mark=",", scientific=FALSE))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.