
Last chance! 50% off unlimited learning
Sale ends in
Retrieve the 'n' closest SNP ids or positions near specified locus
nearest.snp(chr, pos, n = 1, side = c("either", "left", "right"),
ids = TRUE, limit = NULL, build = NULL)
integer, chromosome, should be a number from 1 to 25, where 23,24,25 are X,Y,MT
integer, genomic position, should be between 1 and the length of the chromosome 'chr'
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'
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)
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.
integer, a limit on the maximum distance from the position 'pos' can be specified
integer whether to use build 36/37 parameters, 36/37 is preferred, but can enter using any form recognised by ucsc.sanitizer()
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.
# NOT RUN {
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
# }
# NOT RUN {
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
# }
Run the code above in your browser using DataLab