row.summary: Summarize rows or columns of a snp matrix

Description Usage Arguments Value Note Author(s) Examples

View source: R/misc.R

Description

These function calculates summary statistics of each row or column of call rates and heterozygosity for each row of a an object of class "SnpMatrix" or "XSnpMatrix"

Usage

1
2
row.summary(object)
col.summary(object, rules = NULL, uncertain = TRUE)

Arguments

object

genotype data as a SnpMatrix-class or XSnpMatrix-class object

rules

An object of class "ImputationRules". If supplied, the rules coded in this object are used, together with the snp genotype data in object, to generate imputed SNPs. The column summary of these imputed data are then returned

uncertain

If TRUE uncertain genotypes are used in calculation of allele and genotype frequencies (by scoring as posterior expectations). Otherwise, and for Hardy-Weinberg tests, they are ignored

Value

row.summary

returns a data frame with rows corresponding to rows of the input object and with columns/elements:

  • Call.rate: Proportion of SNPs called

  • Certain.calls: Proportion of called SNPs with certain calls

  • Heterozygosity: Proportion of called SNPs which are heterozygous

Uncertain calls are ignored for calculating the heterozygosity.

col.summary

returns a data frame with rows corresponding to columns of the input object and with columns/elements:

  • Calls: The number of valid calls

  • Call.rate: The proportion of genotypes called

  • Certain.calls: Proportion of called SNPs with certain calls

  • RAF: The "risk" allele (allele B) frequency

  • MAF: The minor allele frequency

  • P.AA: The frequency of homozygous genotype 1 (A/A)

  • P.AB: The frequency of heterozygous genotype 2 (A/B)

  • P.BB: The frequency of homozygous genotype 3 (B/B)

  • z.HWE: A z-test for Hardy-Weinberg equilibrium

For objects of class "XSnpMatrix", the following additional columns are returned:

  • P.AY: The frequency of allele A in males

  • P.BY: The frequency of allele B in males

  • Calls.female: The number of valid calls in females (only these calls are used in the z-test for HWE)

Note

The current version of row.summary does not deal with the X chromosome differently, so that males are counted as homozygous.

Author(s)

David Clayton dc208@cam.ac.uk

Examples

1
2
3
4
5
6
7

Example output

Loading required package: survival
Loading required package: Matrix
   Call.rate      Certain.calls Heterozygosity  
 Min.   :0.6577   Min.   :1     Min.   :0.2182  
 1st Qu.:0.6963   1st Qu.:1     1st Qu.:0.2550  
 Median :0.9455   Median :1     Median :0.2599  
 Mean   :0.8657   Mean   :1     Mean   :0.2598  
 3rd Qu.:0.9628   3rd Qu.:1     3rd Qu.:0.2642  
 Max.   :0.9781   Max.   :1     Max.   :0.2820  
     Calls         Call.rate      Certain.calls      RAF        
 Min.   :  0.0   Min.   :0.0000   Min.   :1     Min.   :0.0000  
 1st Qu.:265.0   1st Qu.:0.6625   1st Qu.:1     1st Qu.:0.1610  
 Median :394.0   Median :0.9850   Median :1     Median :0.4775  
 Mean   :346.3   Mean   :0.8657   Mean   :1     Mean   :0.4882  
 3rd Qu.:398.0   3rd Qu.:0.9950   3rd Qu.:1     3rd Qu.:0.8166  
 Max.   :400.0   Max.   :1.0000   Max.   :1     Max.   :1.0000  
                                  NA's   :43    NA's   :43      
      MAF              P.AA              P.AB              P.BB        
 Min.   :0.0000   Min.   :0.00000   Min.   :0.00000   Min.   :0.00000  
 1st Qu.:0.0325   1st Qu.:0.03275   1st Qu.:0.06172   1st Qu.:0.02506  
 Median :0.1713   Median :0.26984   Median :0.28444   Median :0.22822  
 Mean   :0.1920   Mean   :0.38189   Mean   :0.25975   Mean   :0.35836  
 3rd Qu.:0.3289   3rd Qu.:0.70551   3rd Qu.:0.43609   3rd Qu.:0.66582  
 Max.   :0.5000   Max.   :1.00000   Max.   :1.00000   Max.   :1.00000  
 NA's   :43       NA's   :43        NA's   :43        NA's   :43       
     z.HWE         
 Min.   :-19.9499  
 1st Qu.: -0.5980  
 Median :  0.0754  
 Mean   : -0.0197  
 3rd Qu.:  0.6803  
 Max.   : 16.2481  
 NA's   :1254      
     Calls         Call.rate      Certain.calls      RAF         
 Min.   :  0.0   Min.   :0.0000   Min.   :1     Min.   :0.00000  
 1st Qu.:264.0   1st Qu.:0.6600   1st Qu.:1     1st Qu.:0.08831  
 Median :389.0   Median :0.9725   Median :1     Median :0.45126  
 Mean   :333.8   Mean   :0.8345   Mean   :1     Mean   :0.46021  
 3rd Qu.:397.0   3rd Qu.:0.9925   3rd Qu.:1     3rd Qu.:0.83244  
 Max.   :400.0   Max.   :1.0000   Max.   :1     Max.   :1.00000  
                                  NA's   :2     NA's   :2        
      MAF                P.AA              P.AB              P.BB         
 Min.   :0.000000   Min.   :0.00000   Min.   :0.00000   Min.   :0.000000  
 1st Qu.:0.007812   1st Qu.:0.03226   1st Qu.:0.01081   1st Qu.:0.005405  
 Median :0.113990   Median :0.30811   Median :0.18852   Median :0.195652  
 Mean   :0.174095   Mean   :0.42316   Mean   :0.23098   Mean   :0.345855  
 3rd Qu.:0.313218   3rd Qu.:0.83607   3rd Qu.:0.43784   3rd Qu.:0.655462  
 Max.   :0.496552   Max.   :1.00000   Max.   :0.72283   Max.   :1.000000  
 NA's   :2          NA's   :2         NA's   :2         NA's   :2         
      P.A              P.B              z.HWE          Calls.diploid  
 Min.   :0.0000   Min.   :0.00000   Min.   :-3.60226   Min.   :  0.0  
 1st Qu.:0.1619   1st Qu.:0.07729   1st Qu.:-0.55347   1st Qu.:122.0  
 Median :0.5461   Median :0.45390   Median : 0.13749   Median :184.0  
 Mean   :0.5430   Mean   :0.45699   Mean   : 0.06628   Mean   :157.5  
 3rd Qu.:0.9227   3rd Qu.:0.83810   3rd Qu.: 0.51360   3rd Qu.:186.0  
 Max.   :1.0000   Max.   :1.00000   Max.   : 7.67702   Max.   :186.0  
 NA's   :2        NA's   :2         NA's   :36                        

snpStats documentation built on Nov. 8, 2020, 10:59 p.m.