Convert from build 37 to build 36 SNP coordinates

Description

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.

Usage

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

Arguments

ranges

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

chr

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

pos

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'.

ids

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

Value

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.

Author(s)

Nicholas Cooper nick.cooper@cimr.cam.ac.uk

See Also

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

Examples

1
2
3
4
5
6
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

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.