hg38: Hg38 Chromosome Lengths and Centromere Locations

Description Usage Format Value Author(s) Source Examples

Description

A data set containing lengths and centromere locations for each of the 24 chromosomes, according to Hg38.

Usage

1

Format

A data set with 24 rows and 5 columns:

Value

a data set.

Author(s)

Frederic Commo

Source

These data derived from the Hg38 gap UCSC table, freely available at: UCSC
Access date: 10-10-2015
Within the browser, select:
group: All Tables
database: hg38
table: gap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# For users convenience, we provide a prebuilt dataset
# containing the Hg38 chr lengths, and centromeres location.
hg38

# The same dataset can be obtained as follow:
## Not run: 
library(BSgenome)
library(rtracklayer)

getChrLength <- function(genome){
    genome <- sprintf("BSgenome.Hsapiens.UCSC.
    g <- getBSgenome(genome, masked=FALSE)
    data.frame(chrom=1:24, length=seqlengths(g)[1:24])
}
.chrAsNum <- function(tbl){
    tbl$chrom <- gsub("chr", "", tbl$chrom)
    tbl$chrom[tbl$chrom=="X"] <- 23
    tbl$chrom[tbl$chrom=="Y"] <- 24
    tbl$chrom <- as.numeric(tbl$chrom)
    tbl[order(tbl$chrom),]
}
getCentromeres <- function(genome){
    mySession <- try(browserSession("UCSC"), silent=TRUE)
    # In case it fails, use another mirror
    if(inherits(mySession, "try-error"))
        mySession <- browserSession("UCSC",
                                    url="http://genome-euro.ucsc.edu/cgi-bin/")
    genome(mySession) <- genome
    obj <- ucscTableQuery(mySession, table="gap")
    tbl <- getTable(obj)
    if(!"centromere" 
        return(NULL)
    tbl <- tbl[tbl$type=="centromere", c("chrom", "chromStart", "chromEnd")]
    colnames(tbl)[2:3] <- c("centromerStart", "centromerEnd")
    .chrAsNum(tbl)
}
makeHg <- function(genome){
    chrL <- getChrLength(genome)
    ctm <- getCentromeres(genome)
    # Notice that, in case of Hg38, centromeres locations are in Hg19.
    if(is.null(ctm))
        ctm <- getCentromeres("hg19")
    tbl <- merge(chrL, ctm, by="chrom")
    cumlen <- c(0, cumsum(as.numeric(tbl$length))[-nrow(tbl)])
    cbind.data.frame(tbl, cumlen=cumlen)    
}
hg38 <- makeHg("hg38")
hg38

## End(Not run)

rCGH documentation built on Nov. 8, 2020, 8:30 p.m.