conv.37.36: Convert from build 37 to build 36 SNP coordinates

Description Usage Arguments Value Author(s) See Also Examples

View source: R/humarray.R


Convert range or SNP coordinates between builds using a chain file. Depending on the chain file this can do any conversion, but the default will use the hg19 to hg18 (37–>36) chain file built into this package. The positions to convert can be entered using using chr, pos vectors, or a RangedData or GRanges object. This function is a wrapper for liftOver() from rtracklayer, providing more control of input and output and 'defensive' preservation of order and length of the output versus the input ranges/SNPs.


conv.37.36(ranges = NULL, chr = NULL, pos = NULL, ..., ids = NULL)



optional GRanges or RangedData object describing positions for which conversion should be performed. No need to enter chr, pos if using ranges


character, an optional vector of chromosomes to combine with 'pos' to describe positions to convert from build hg19 to hg18


integer, an optional vector of chromosome positions (for SNPs), no need to enter a ranges object if this is provided along with 'chr'


additional arguments to makeGRanges(), so in other words, can use 'start' and 'end' to specify ranges instead of 'pos'.


if the ranges have ids (e.g, SNP ids, CNV ids), then by including this parameter when using chr, pos input, the output object will have these ids as rownames. For ranges input these ids would already be in the rownames of the GRanges or RangedData object, so use of this parameter should be unnecessary


Returns positions converted from build 37 to 36. If using the 'ranges' parameter for position input, the object returned will be of the same format. If using chr and pos to input, then the object returned will be a data.frame with columns, chr and pos with rownames 'ids'. Output will be the same length as the input, which is not necessarily the case for liftOver() which does the core part of this conversion. Using vector or GRanges input will give a resulting data.frame or GRanges object respectively that has the same order of rownames as the original input. Using RangedData will result in an output that is sorted by genome order, regardless of the original order.


Nicholas Cooper [email protected]

See Also

conv.36.37, conv.37.38, conv.38.37, convTo37, convTo36


gene.labs <- c("CTLA4","IL2RA","HLA-C")
pp <- Pos.gene(gene.labs,build=37)
gg <- GRanges(ranges=IRanges(start=pp$start,end=pp$end),seqnames=pp$chr)
conv.37.36(gg) # order of output is preserved   ### HERE!!! ###
rr <- as(gg,"RangedData")
conv.37.36(rr) # note the result is same as GRanges, but in genome order

humarray documentation built on Nov. 20, 2017, 1:05 a.m.