nearest.snp: Retrieve the 'n' closest SNP ids or positions near specified...

Description Usage Arguments Value See Also Examples

View source: R/humarray.R

Description

Retrieve the 'n' closest SNP ids or positions near specified locus

Usage

1
2
nearest.snp(chr, pos, n = 1, side = c("either", "left", "right"),
  ids = TRUE, limit = NULL, build = NULL)

Arguments

chr

integer, chromosome, should be a number from 1 to 25, where 23,24,25 are X,Y,MT

pos

integer, genomic position, should be between 1 and the length of the chromosome 'chr'

n

integer, the number of nearest SNPs to seek, if there aren't enough in the annotation then NAs will fill the gaps to force the return value length to equal 'n'

side

character, can be 'either', 'left' or 'right' and specifies which side of the 'pos' to look for nearest snps (where left is decreasing genomic position and right is increasing)

ids

logical, if TRUE will return snp ids (chip ids, for rs-ids, use id.to.rs on the output), or if FALSE will return the chromosome positions of the SNPs.

limit

integer, a limit on the maximum distance from the position 'pos' can be specified

build

integer whether to use build 36/37 parameters, 36/37 is preferred, but can enter using any form recognised by ucsc.sanitizer()

Value

Set of SNP ids (when ids=TRUE), or otherwise genomic positions within chromosome 'chr'. If the number of SNPs on the chromosome or the bounds of the 'side' and 'limit' parameters restrict the number returned to less than 'n' then the return value will be padded with NAs.

See Also

expand.nsnp, nearest.gene

Examples

1
2
3
4
5
6
7
nearest.snp(1,159000000,n=10) # return ids
nearest.snp(1,159000000,n=10,build=37)
nearest.snp(1,159000000,n=10,build=36,ids=FALSE) # return positions

nearest.snp(1,159000000,n=10,build=37,ids=FALSE)
nearest.snp(6,25000000,n=10,build=37,ids=FALSE,side="left")  # only SNPs to the left of the locus
nearest.snp(6,25000000,n=10,build=37,ids=FALSE,side="right") # only SNPs to the right of the locus

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