mendelErr {GWASTools} | R Documentation

## Mendelian Error Checking

### Description

Mendelian and mtDNA inheritance tests.

### Usage

    mendelErr(genoData, mendel.list, snp.exclude=NULL,
              error.by.snp=TRUE, error.by.snp.trio=FALSE,
              verbose=TRUE)

### Arguments

`genoData` | `GenotypeData` object, must have scan variable "sex"
`mendel.list` | A `mendelList` object, to specify trios.
`snp.exclude` | An integer vector with snpIDs of SNPs to exclude. If `NULL` (default), all SNPs are used.
`error.by.snp` | Whether or not to output Mendelian errors per SNP. This will only return the total number of trios checked and the total number of errors for each SNP. The default value is `TRUE`.
`error.by.snp.trio` | Whether or not to output Mendelian errors per SNP for each trio. This will return the total number of trios checked and the total number of errors for each SNP as well as indicators of which SNPs have an error for each trio. The default value is `FALSE`. NOTE: `error.by.snp` must be set to `TRUE` as well in order to use this option. NOTE: Using this option causes the output to be very large that may be slow to load into R.
`verbose` | If `TRUE` (default), will print status updates while the function runs.

### Details

`genoData` must contain the scan annotation variable "sex". Chromosome index: 1..22 autosomes, 23 X, 24 XY, 25 Y, 26 mtDNA, 27 missing.

If a trio has one parent missing, Mendelian errors are still calculated for the available pair. In other words, "trio" here also inludes duos.

### Value

`mendelErr` returns an object of class "mendelClass". The object contains two data frames: "trios" and "all.trios", and a list: "snp" (if `error.by.snp` is specified to be `TRUE`). If there are no duplicate samples in the dataset, "trios" will be the same as "all.trios". Otherwise, "all.trios" contains the results of all combinations of duplicate samples, and "trios" only stores the average values of unique trios. i.e: "trios" averages duplicate samples for each unique subject trio. "trios" and "all.trios" contain the following components:

`fam.id` | Specifying the family ID from the mendel.list object used as input.
`child.id` | Specifying the offspring ID from the mendel.list object used as input.
`child.scanID` | Specifying the offspring scanID from the mendel.list object used as input. (only in "all.trios")
`father.scanID` | Specifying the father scanID from the mendel.list object used as input. (only in "all.trios")
`mother.scanID` | Specifying the mother scanID from the mendel.list object used as input. (only in "all.trios")
`Men.err.cnt` | The number of SNPs with Mendelian errors in this trio.
`Men.cnt` | The total number of SNPs checked for Mendelian errors in this trio. It excludes those cases where the SNP is missing in the offspring and those cases where it is missing in both parents. Hence, Mendelian error rate = `Men.err.cnt` / `Men.cnt`.
`mtDNA.err` | The number of SNPs with mtDNA inheritance errors in this trio.
`mtDNA.cnt` | The total number of SNPs checked for mtDNA inheritance errors in this trio. It excludes those cases where the SNP is missing in the offspring and in the mother. Hence, mtDNA error rate = `mtDNA.err` / `mtDNA.cnt` .
`chr1, ..., chr25` | The number of Mendelian errors in each chromosome for this trio.

"snp" is a list that contains the following components:

`check.cnt` | A vector of integers, indicating the number of trios valid for checking on each SNP.
`error.cnt` | A vector of integers, indicating the number of trios with errors on each SNP.
`familyid.childid` | A vector of indicators (0/1) for whether or not any of the duplicate trios for the unique trio, "familyid.childid", have a Mendelian error on each SNP. (Only if `error.by.snp.trio` is specified to be `TRUE`).

### Author(s)

Xiuwen Zheng, Matthew P. Conomos

### See Also

`mendelList`

### Examples

    library(GWASdata)
    data(illuminaScanADF)
    scanAnnot <- illuminaScanADF

    # generate trio list
    men.list <- mendelList(scanAnnot$family, scanAnnot$subjectID,
      scanAnnot$father, scanAnnot$mother, scanAnnot$sex,
      scanAnnot$scanID)

    # create genoData object
    gdsfile <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
    gds <- GdsGenotypeReader(gdsfile)
    genoData <- GenotypeData(gds, scanAnnot=scanAnnot)

    # Run!
    R <- mendelErr(genoData, men.list, error.by.snp.trio = TRUE)

    names(R)
    # [1] "trios"     "all.trios" "snp"

    names(R$trios)
    #  [1] "fam.id"      "child.id"    "Men.err.cnt" "Men.cnt"     "mtDNA.err"
    #  [6] "mtDNA.cnt"   "chr1"        "chr2"        "chr3"        "chr4"
    # [11] "chr5"        "chr6"        "chr7"        "chr8"        "chr9"
    # [16] "chr10"       "chr11"       "chr12"       "chr13"       "chr14"
    # [21] "chr15"       "chr16"       "chr17"       "chr18"       "chr19"
    # [26] "chr20"       "chr21"       "chr22"       "chrX"        "chrXY"
    # [31] "chrY"

    # Mendelian error rate = Men.err.cnt / Men.cnt
    data.frame(fam.id = R$trios$fam.id, child.id = R$trios$child.id,
               Mendel.err.rate = R$trios$Men.err.cnt / R$trios$Men.cnt)

    names(R$snp)
    summary(R$snp$check.cnt)

    # summary Mendelian error for first family
    summary(R$snp[[1]])

    close(genoData)

[Package GWASTools version 1.38.0 Index]