snpgdsLDpair: Linkage Disequilibrium (LD)

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/LD.R

Description

Return a LD value between snp1 and snp2.

Usage

1
snpgdsLDpair(snp1, snp2, method = c("composite", "r", "dprime", "corr"))

Arguments

snp1

a vector of SNP genotypes (0 – BB, 1 – AB, 2 – AA)

snp2

a vector of SNP genotypes (0 – BB, 1 – AB, 2 – AA)

method

"composite", "r", "dprime", "corr", see details

Details

Four methods can be used to calculate linkage disequilibrium values: "composite" for LD composite measure, "r" for R coefficient (by EM algorithm assuming HWE, it could be negative), "dprime" for D', and "corr" for correlation coefficient. The method "corr" is equivalent to "composite", when SNP genotypes are coded as: 0 – BB, 1 – AB, 2 – AA.

Value

Return a numeric vector:

ld

a measure of linkage disequilibrium

if method = "r" or "dprime",

pA_A

haplotype frequency of AA, the first locus is A and the second locus is A

pA_B

haplotype frequency of AB, the first locus is A and the second locus is B

pB_A

haplotype frequency of BA, the first locus is B and the second locus is A

pB_B

haplotype frequency of BB, the first locus is B and the second locus is B

Author(s)

Xiuwen Zheng

References

Weir B: Inferences about linkage disequilibrium. Biometrics 1979; 35: 235-254.

Weir B: Genetic Data Analysis II. Sunderland, MA: Sinauer Associates, 1996.

Weir BS, Cockerham CC: Complete characterization of disequilibrium at two loci; in Feldman MW (ed): Mathematical Evolutionary Theory. Princeton, NJ: Princeton University Press, 1989.

See Also

snpgdsLDMat, snpgdsLDpruning

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())

snp1 <- read.gdsn(index.gdsn(genofile, "genotype"), start=c(1,1), count=c(1,-1))
snp2 <- read.gdsn(index.gdsn(genofile, "genotype"), start=c(2,1), count=c(1,-1))

snpgdsLDpair(snp1, snp2, method = "composite")
snpgdsLDpair(snp1, snp2, method = "r")
snpgdsLDpair(snp1, snp2, method = "dprime")
snpgdsLDpair(snp1, snp2, method = "corr")

# close the genotype file
snpgdsClose(genofile)

Example output

Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
       ld 
0.5924122 
       ld      pA_A      pA_B      pB_A      pB_B 
0.5068685 0.3779293 0.1215179 0.1250558 0.3754970 
       ld      pA_A      pA_B      pB_A      pB_B 
0.5104677 0.3779293 0.1215179 0.1250558 0.3754970 
       ld 
0.5924122 

SNPRelate documentation built on Nov. 8, 2020, 5:31 p.m.