snpgdsApartSelection {SNPRelate} | R Documentation |
Randomly selects SNPs for which each pair is at least as far apart as the specified basepair distance.
snpgdsApartSelection(chromosome, position, min.dist=100000, max.n.snp.perchr=-1, verbose=TRUE)
chromosome |
chromosome codes |
position |
SNP positions in base pair |
min.dist |
A numeric value to specify minimum distance required (in basepairs) |
max.n.snp.perchr |
A numeric value specifying the maximum number of SNPs to return per chromosome, "-1" means no number limit |
verbose |
if TRUE, show information |
A logical vector indicating which SNPs were selected.
Xiuwen Zheng
# open an example dataset (HapMap) genofile <- snpgdsOpen(snpgdsExampleFileName()) genofile chr <- read.gdsn(index.gdsn(genofile, "snp.chromosome")) pos <- read.gdsn(index.gdsn(genofile, "snp.position")) set.seed(1000) flag <- snpgdsApartSelection(chr, pos, min.dist=250000, verbose=TRUE) table(flag) # close the genotype file snpgdsClose(genofile)