Post date: Oct 16, 2013 8:49:11 PM
I finished summarizing LD for the 129 exceptional change loci on Ceanothus. The mean LD across locus pairs and experimental populations was 0.0048 (similar to the mean LD for SNPs on different contigs from the paper). The mean maximum LD for these SNPs (that is the maximum LD between each of these SNPs and any of the other exceptional change SNPs) was 0.0223. Finally, the absolute maximum LD between any pair of exceptional change SNPs was 0.0896. The R code for this analysis is in projects/timema_mortality_experiment/ and is pasted below.
makeSym<-function(mat=NA){
N<-dim(mat)[1]
for(i in 1:N){
for(j in i:N){
mat[j,i]<-mat[i,j]
}
}
diag(mat)<-0
return(mat)
}
nl<-114
## 1A
ld1A<-as.matrix(read.table("sub_ld_tim1A",header=FALSE,sep=","))
ld1A<-abs(ld1A)
ld1A<-makeSym(ld1A)
maxLd1A<-apply(ld1A,1,max)
## 1C
ld1C<-as.matrix(read.table("sub_ld_tim1C",header=FALSE,sep=","))
ld1C<-abs(ld1C)
ld1C<-makeSym(ld1C)
maxLd1C<-apply(ld1C,1,max)
## 2A
ld2A<-as.matrix(read.table("sub_ld_tim2A",header=FALSE,sep=","))
ld2A<-abs(ld2A)
ld2A<-makeSym(ld2A)
maxLd2A<-apply(ld2A,1,max)
## 2C
ld2C<-as.matrix(read.table("sub_ld_tim2C",header=FALSE,sep=","))
ld2C<-abs(ld2C)
ld2C<-makeSym(ld2C)
maxLd2C<-apply(ld2C,1,max)
## 3A
ld3A<-as.matrix(read.table("sub_ld_tim3A",header=FALSE,sep=","))
ld3A<-abs(ld3A)
ld3A<-makeSym(ld3A)
maxLd3A<-apply(ld3A,1,max)
## 3C
ld3C<-as.matrix(read.table("sub_ld_tim3C",header=FALSE,sep=","))
ld3C<-abs(ld3C)
ld3C<-makeSym(ld3C)
maxLd3C<-apply(ld3C,1,max)
## 4A
ld4A<-as.matrix(read.table("sub_ld_tim4A",header=FALSE,sep=","))
ld4A<-abs(ld4A)
ld4A<-makeSym(ld4A)
maxLd4A<-apply(ld4A,1,max)
## 4C
ld4C<-as.matrix(read.table("sub_ld_tim4C",header=FALSE,sep=","))
ld4C<-abs(ld4C)
ld4C<-makeSym(ld4C)
maxLd4C<-apply(ld4C,1,max)
## 5A
ld5A<-as.matrix(read.table("sub_ld_tim5A",header=FALSE,sep=","))
ld5A<-abs(ld5A)
ld5A<-makeSym(ld5A)
maxLd5A<-apply(ld5A,1,max)
## 5C
ld5C<-as.matrix(read.table("sub_ld_tim5C",header=FALSE,sep=","))
ld5C<-abs(ld5C)
ld5C<-makeSym(ld5C)
maxLd5C<-apply(ld5C,1,max)
mnLD<-mean(c(as.vector(ld1A),as.vector(ld2A),as.vector(ld3A),as.vector(ld4A),as.vector(ld5A),as.vector(ld1C),as.vector(ld2C),as.vector(ld3C),as.vector(ld4C),as.vector(ld5C)),na.rm=TRUE)
maxLD<-mean(c(as.vector(maxLd1A),as.vector(maxLd2A),as.vector(maxLd3A),as.vector(maxLd4A),as.vector(maxLd5A),as.vector(maxLd1C),as.vector(maxLd2C),as.vector(maxLd3C),as.vector(maxLd4C),as.vector(maxLd5C)),na.rm=TRUE)