Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

select.snps

Subsetting from a bed.matrix


Description

Returns subset of SNPs satisfying a condition.

Usage

select.snps(x, condition)

Arguments

x

A bed.matrix

condition

Condition used to select SNPs

Details

The conditions can involve global variables and all variables defined in the data frame x@snps, in particular

  • chr, id, dist, pos, A1, A2

  • If basic stats have been computed (see set.stats), N0, N1, N2, NAs, callrate, maf, hz, etc.

  • If Hardy-Weinberg Equilibrium test has been performed (see set.hwe), hwe.

If some condition evaluate to NA (e.g. maf > 0 when maf is undefined for some SNPs), a warning is issued and the corresponding SNPs are removed.

Value

A bed.matrix similar to x, containing the selected SNPs only

Author(s)

Hervé Perdry and Claire Dandine-Roulland

See Also

Examples

# Load data
data(LCT)
x <- as.bed.matrix(LCT.gen, LCT.fam, LCT.bim)

# Select SNPs with a maf > 5%
y <- select.snps(x, maf > 0.05)
y

gaston

Genetic Data Handling (QC, GRM, LD, PCA) & Linear Mixed Models

v1.5.7
GPL-3
Authors
Hervé Perdry [cre, aut, cph], Claire Dandine-Roulland [aut, cph], Deepak Bandyopadhyay [cph] (C++ gzstream class), Lutz Kettner [cph] (C++ gzstream class)
Initial release
2020-09-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.