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

select.inds

Subsetting from a bed.matrix


Description

Returns subset of individuals satisfying a condition.

Usage

select.inds(x, condition)

Arguments

x

A bed.matrix

condition

Condition used to select individuals

Details

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

  • famid, id, father, mother, sex, pheno

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

If some condition evaluate to NA (e.g. sex == 1 when sex is undefined for some individuals), a warning is issued and the corresponding individuals are removed.

Value

A bed.matrix similar to x, containing the selected individuals 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 individuals with a call rate > 95% 
# and more than 5% of heterozygous genotypes
y <- select.inds(x, callrate > 0.95 & N1/(N0+N1+N2) > 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.