Tests: Evaluation of a condition on SNPS or individuals in a...

TestsR Documentation

Evaluation of a condition on SNPS or individuals in a bed.matrix

Description

Evaluate a condition and return logical vector or indices

Usage

 test.snps(x, condition, na.to.false = TRUE) 
        test.inds(x, condition, na.to.false = TRUE) 
        which.snps(x, condition) 
        which.inds(x, condition) 

Arguments

x

A bed.matrix

condition

Condition used to select SNPs

na.to.false

If TRUE, NAs are replaced by FALSE

Details

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

  • 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.

and for test.inds and which.inds

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

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

Value

test.snps and test.inds return a logical vector of length ncol(x) and nrow(x) respectively. which.snps(x, condition) is equivalent to which(test.snps(x, condition)) and which.inds(x, condition) to which(test.inds(x, condition)).

See Also

select.snps, select.inds, set.stats, set.hwe

Examples

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

# SNPs and individuals with a callrate < 100%
w <- test.snps(x, callrate < 1)
table(w)
which.snps(x, callrate < 1)
which.inds(x, callrate < 1)

gaston documentation built on Dec. 28, 2022, 1:30 a.m.