ensure_snp_quality: Ensure SNP Quality

Description Usage Arguments Value Examples

View source: R/ensure_snp_quality.R

Description

ensure_snp_quality applies quality checks to SNP data

Usage

1
2
3
ensure_snp_quality(snp, callfreq_check = TRUE, callfreq_threshold = 0.95,
  maf_check = TRUE, maf_threshold = 0.05, any_missing = TRUE,
  missing_value = NA_character_, remove_duplicated = TRUE)

Arguments

snp

A matrix. Genotype names are stored in rows whereas marker names are stored in columns.

callfreq_check

Logical scalar. Shall markers with a low call frequency (*i.e.* a high number of missing marker genotypes) be removed?

callfreq_threshold

Numeric scalar. Minimum level of non-missing genotypes per locus.

maf_check

Logical scalar. Shall markers with a low minor allele frequency be removed?

maf_threshold

Numeric scalar. Minimum frequency of the minor allele at each locus.

any_missing

Logical scalar. Does the input matrix snp contain any missing values? If this is the case, they will be replaced with the major genotype at this locus.

missing_value

Specify the encoding of missing genotypes.

remove_duplicated

Logical scalar. Should only unique marker loci be returned?

Value

Depending on the choice of parameters callfreq_check and maf_check, respectively, ensure_snp_quality will return a matrix with marker genotypes that have passed important quality checks.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 # Load a matrix with SNP genotypes encoded as numeric values
 data(marker_numeric)

 # Add a duplicated marker locus to the data.
 snp <- marker_numeric
 snp <- cbind(snp, snp[, 1])

 # Return markers without missing values, a call frequency greater or equal
 # to 0.95 and a minor allele frequency greater or equal to 0.6. Finally,
 # remove all duplicated markers.
 ensure_snp_quality(snp, maf_threshold = 0.1, missing_value = NA_real_)

 # Load a matrix with SNP genotypes encoded as character values
 data(marker_character)

 # Return markers without missing values and a call frequency equal to or
 # greater than 0.9. Keep duplicated markers if present.
 ensure_snp_quality(marker_character, callfreq_threshold = 0.9,
                    maf_check = FALSE, missing_value = "??",
                    remove_duplicated = FALSE)

mwesthues/sspredr documentation built on May 23, 2019, 10:56 a.m.