Runs and evaluates results from plink --missing (missing genotype rates
per individual) and plink --het (heterozygosity rates per individual).
Non-systematic failures in genotyping and outlying heterozygosity (hz) rates
per individual are often proxies for DNA sample quality. Larger than expected
heterozygosity can indicate possible DNA contamination.
The mean heterozygosity in PLINK is computed as hz_mean = (N-O)/N, where
N: number of non-missing genotypes and O:observed number of homozygous
genotypes for a given individual.
Mean heterozygosity can differ between populations and SNP genotyping panels.
Within a population and genotyping panel, a reduced heterozygosity rate can
indicate inbreeding - these individuals will then likely be returned by
check_relatedness
as individuals that fail the relatedness
filters. check_het_and_miss
creates a scatter plot with the
individuals' missingness rates on x-axis and their heterozygosity rates on
the y-axis.
check_het_and_miss(indir, name, qcdir = indir, imissTh = 0.03,
hetTh = 3, run.check_het_and_miss = TRUE, label = TRUE,
interactive = FALSE, verbose = FALSE, path2plink = NULL,
showPlinkOutput = TRUE)
[character] /path/to/directory containing the basic PLINK data files name.bim, name.bed, name.fam files.
[character] Prefix of PLINK files, i.e. name.bed, name.bim, name.fam, name.het and name.imiss.
[character] /path/to/directory where name.het as returned by plink --het and name.imiss as returned by plink --missing will be saved. Per default qcdir=indir. If run.check_het_and_miss is FALSE, it is assumed that plink --missing and plink --het have been run and qcdir/name.imiss and qcdir/name.het are present. User needs writing permission to qcdir.
[double] Threshold for acceptable missing genotype rate per individual; has to be proportion between (0,1)
[double] Threshold for acceptable deviation from mean heterozygosity per individual. Expressed as multiples of standard deviation of heterozygosity (het), i.e. individuals outside mean(het) +/- hetTh*sd(het) will be returned as failing heterozygosity check; has to be larger than 0.
[logical] Should plink --missing and plink
--het be run to determine genotype missingness and heterozygosity rates; if
FALSE, it is assumed that plink --missing and plink --het have been run and
qcdir/name.imiss and qcdir/name.het are present;
check_het_and_miss
will fail with missing file error otherwise.
[logical] Set TRUE, to add fail IDs as text labels in scatter plot.
[logical] Should plots be shown interactively? When choosing this option, make sure you have X-forwarding/graphical interface available for interactive plotting. Alternatively, set interactive=FALSE and save the returned plot object (p_het_imiss) via ggplot2::ggsave(p=p_het_imiss , other_arguments) or pdf(outfile) print(p_het_imiss) dev.off().
[logical] If TRUE, progress info is printed to standard out.
[character] Absolute path to PLINK executable
(https://www.cog-genomics.org/plink/1.9/) i.e.
plink should be accesible as path2plink -h. The full name of the executable
should be specified: for windows OS, this means path/plink.exe, for unix
platforms this is path/plink. If not provided, assumed that PATH set-up works
and PLINK will be found by exec_wait
('plink').
[logical] If TRUE, plink log and error messages are printed to standard out.
Named [list] with i) fail_imiss [data.frame] containing FID (Family ID), IID (Within-family ID), MISS_PHENO (Phenotype missing? (Y/N)), N_MISS (Number of missing genotype call(s), not including obligatory missings), N_GENO (Number of potentially valid call(s)), F_MISS (Missing call rate) of individuals failing missing genotype check and ii) fail_het [data.frame] containing FID (Family ID), IID (Within-family ID), O(HOM) (Observed number of homozygotes), E(HOM) (Expected number of homozygotes), N(NM) (Number of non-missing autosomal genotypes), F (Method-of-moments F coefficient estimate) of individuals failing outlying heterozygosity check and iii) p_het_imiss, a ggplot2-object 'containing' a scatter plot with the samples' missingness rates on x-axis and their heterozygosity rates on the y-axis, which can be shown by print(p_het_imiss).
check_het_and_miss
wraps around
run_check_missingness
,
run_check_heterozygosity
and
evaluate_check_het_and_miss
.
If run.check_het_and_miss is TRUE, run_check_heterozygosity
and
run_check_missingness
are executed ; otherwise it is assumed
that plink --missing and plink --het have been run externally and
qcdir/name.het and qcdir/name.imiss exist. check_het_and_miss
will fail with missing file error otherwise.
For details on the output data.frame fail_imiss and fail_het, check the original description on the PLINK output format page: https://www.cog-genomics.org/plink/1.9/formats#imiss and https://www.cog-genomics.org/plink/1.9/formats#het
# NOT RUN {
# }
# NOT RUN {
indir <- system.file("extdata", package="plinkQC")
name <- "data"
fail_het_miss <- check_het_and_miss(indir=indir, name=name,
run.check_het_and_miss=FALSE, interactive=FALSE)
# }
Run the code above in your browser using DataLab