Learn R Programming

gaston (version 1.4.9)

select.snps: Subsetting from a bed.matrix

Description

Return subset of SNPs satisfying a condition.

Usage

select.snps(x, condition)

Arguments

condition
Condition used to select SNPs

Value

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

Details

The conditions can involve global variables, and all variables defined in the data frame x@snps, that is
  • 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.

See Also

select.snps, set.stats, set.hwe

Examples

Run this code
# 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

Run the code above in your browser using DataLab