How can find LD between rows (SNPs) two by two?
0
0
Entering edit mode
8.2 years ago
star ▴ 350

I like to find linkage Disequilibrium (LD) between my positions (rows). I have used SNPRelate package for finding LD as below but I want compare each row with others as I show in out put.

snp1<-as.numeric(c("0","1","1","2"))
snp2<-as.numeric(c("NA","1","2","1"))
Warning message:
NAs introduced by coercion

LD<-snpgdsLDpair(snp1,snp2,"dprime")

LD
ld pA_A pA_B pB_A pB_B
9.999998e-01 3.333334e-01 3.333333e-01 3.333333e-01 2.554527e-08

Input:

pos sample1 sample2 sample3 sample4
SNP1 0 1 1 2
SNP2 NA 1 2 1
SNP3 2 2 0 1
SNP4 0 1 1 2

Each samples code as(NA = no read data , 0 = Homozygous Reference genotype , 1 = Heterozygous genotype and 2 = Homozygous Alternative genotype )

Output:

ld
SNP1 SNP2 0.25
SNP1 SNP3 0.36
SNP1 SNP4 0.54
SNP2 SNP3 0.33
SNP2 SNP4 0.36
SNP3 SNP4 0.69

Value of ld in above in output is not accurate.

linkage-Disequilibrium genomics R • 2.1k views
ADD COMMENT
1
Entering edit mode

I usually use the genetics package. The input is similar to yours, but you have to specify a genotype explicitly (i.e. A/A, A/T, T/T) instead of 0,1,2. However, the manual is rather exhaustive. In genetics, using LD(mydata) will perform all the pairwise comparisons.

ADD REPLY
0
Entering edit mode

Dear Fabio,

Thanks for your help.

ADD REPLY

Login before adding your answer.

Traffic: 1577 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6