Find the gene(s) overlapping a chromosome location

Share:

Description

Allows retrieval of genes intersected by a chromosome and position, which can be entered using chr, pos/start/end vectors, or a RangedData or GRanges object

Usage

1
2
Gene.pos(chr = NA, pos = NA, start = NA, end = NA, ranges = NULL,
  build = NULL, dir = NULL, bioC = FALSE, one.to.one = TRUE)

Arguments

chr

character, an optional vector of chromosomes to combine with 'pos' or 'start'+'end' (enter in ...) to describe positions to retrieve the possible overlapping gene(s)

pos

integer, an optional vector of chromosome positions (for SNPs), no need to enter start or end if this is entered, and vice-versa

start

integer, an optional vector of start points for chromosome ranges

end

integer, an optional vector of end points for chromosome ranges

ranges

optional GRanges or RangedData object describing positions for which we want genes, removing the need to enter chr, pos, start or end

build

character, "hg18" or "hg19" (or 36/37) to show which reference to retrieve. The default when build is NULL is to use the build from the current ChipInfo annotation

dir

character, 'dir' is the location to download gene annotation information to; if left as NULL, depending on the value of getOption("save.annot.in.current"), the annotation will either be saved in the working directory to speed-up subsequent lookups, or deleted after use.

bioC

logical, if true then return position information as a GRanges object, or RangedData if 'ranges' is RangedData, else a data.frame

one.to.one

logical, whether to concatenate multiple hits for the same range into one result, or spread the result over multiple lines, one for each gene overlapped

Value

Returns a set of genes separated by semicolons (if more than one) for each range entered. If bioC=TRUE, returns the equivalent as a GRanges object, unless a RangedData object was used for the ranges parameter, in which case a RangedData object would be returned. If one.to.one is FALSE, then instead of concatenating multiple genes into one line per range, each is listed separately as a new row, with an index added to correspond to the original input order of ranges, if bioC=TRUE; or just adds additional elements to the resulting vector if bioC=FALSE.

Author(s)

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

See Also

Chr, Pos, Pos.band, Band, Band.gene, Band.pos, Gene.pos

Examples

1
2
3
4
5
6
7
8
setwd(tempdir())
Gene.pos(chr=6, start=31459636, end=31462760)
Gene.pos(chr=22, pos=3452345) # no gene here
Gene.pos(Chr("rs689"),Pos("rs689")) # combine with Chr() and Pos() to find gene(s) for SNP rs689
Gene.pos(chr=1,start=114000000,end=115000000,build="hg19") # multiple genes in range
Gene.pos(chr=1,start=114000000,end=115000000,one.to.one=FALSE) # list separately
ii <- Pos.gene(c("CTLA4","PTPN22"))
Gene.pos(ii$chr,ii$start,ii$end,bioC=FALSE) # returns same genes inputted on line above

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