View source: R/utility_functions.R
gap_snps | R Documentation |
Selects one SNPs every n bases. This can be used to filter for SNPs in tight LD, such as when only one SNP per RAD-tag is desired.
gap_snps(x, facet = NULL, n)
x |
snpRdata object |
facet |
character, default NULL. SNP facet specifying chromosomes or scaffolds. SNP positions will be independently considered depending on the facet level. |
n |
Integer. Specifies the minimum distance between selected SNPs. |
Note that this approach takes the first SNP every n bases, and so is
non-random. filter_snps
can be used beforehand to ensure that
the selected SNPs are above a desired quality threshold to ensure that poor
SNPs are not selected over loci with more robust genotyping data.
It is strongly recommended to provide a SNP facet to the facet argument. This will define "chromosomes" for the purpose of selecting SNPs. If not set, snpR will assume that all SNPs are on the same chromosome, which may produce undesired results.
A snpRdata object containing the selected SNPs.
William Hemstrom
# put large gaps inbetween the example data
gapped <- gap_snps(stickSNPs, "chr", 100000)
# filter first to grab only very good SNPs
vgood <- filter_snps(stickSNPs, min_ind = .8)
gapped <- gap_snps(vgood, "chr", 100000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.