Start with the lead SNP and keep expanding the window until you reach the desired number of SNPs. dat should only contain one locus from one chromosome.

limit_snps(dat, max_snps = 500, verbose = TRUE)

Arguments

dat

A data.frame that contains at least the following columns:

SNP

RSID for each SNP.

POS

Each SNP's genomic position (in basepairs).

max_snps

The maximum number of SNPs to keep in the resulting data.table.

verbose

Print messages.

Value

A filtered data.table.

See also

Other SNP filters: filter_snps(), gene_trimmer()

Examples

dat2 <- echodata::limit_snps(dat = echodata::BST1)
#> Limiting to only 500 SNPs.
#> + Reduced number of SNPs: 6,216 ==> 500