snpgdsApartSelection {SNPRelate} | R Documentation

## Select SNPs with a basepair distance

### Description

Randomly selects SNPs for which each pair is at least as far apart as the specified basepair distance.

### Usage

    snpgdsApartSelection(chromosome, position, min.dist=100000,
        max.n.snp.perchr=-1, verbose=TRUE)

### Arguments

`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

### Value

A logical vector indicating which SNPs were selected.

### Author(s)

Xiuwen Zheng

### See Also

`snpgdsLDpruning`

### Examples

    # 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)

[Package SNPRelate version 1.12.2 Index]