heterosis SCA 和gd 关系

# -----
Com.ave.gd<-read.csv("Com.SCA.gd.csv")
hete<-as.matrix(Com.ave.gd[,-c(1:3)])
a<-rcorr(hete, type="pearson") 
write.csv(a$r,"corr_SCA_gd.csv")
write.csv(a$P,"corr_SCA_gd_pvalue.csv")

# ----匹配heterosis SCA 和gd
gd<-read.csv("gd.nei between parents.csv")
gd$com1<-paste0(gd$p1,gd$p2)
gd$com2<-paste0(gd$p2,gd$p1)

# 1 heterosis 和gd
hete<-read.csv("heterosis_growth.csv")
names(hete)
hete<-hete[,-11]

for(i in 1:dim(hete)[1]){
  for(j in 1:dim(gd)[1]){
    if(hete$X[i]==gd$com1[j])(hete$GD[i]<-gd$GD[j])
  }
}

for(i in 1:dim(hete)[1]){
  for(j in 1:dim(gd)[1]){
    if(hete$X[i]==gd$com2[j])(hete$GD[i]<-gd$GD[j])
  }
}
# 2 SCA 和gd
sca<-read.csv("Com.SCA.gd.csv")
sca$com2<-paste0(sca$Mum,sca$Dad)

for(i in 1:dim(sca)[1]){
  for(j in 1:dim(gd)[1]){
    if(sca$com2[i]==gd$com1[j])(sca$GD[i]<-gd$GD[j])
  }
}

for(i in 1:dim(sca)[1]){
  for(j in 1:dim(gd)[1]){
    if(sca$com2[i]==gd$com2[j])(sca$GD[i]<-gd$GD[j])
  }
}

# -----cor
library(Hmisc) #相关显著性检验
# 1 heterosis 和gd
hete.cor<-as.matrix(hete[,-1])
a<-rcorr(hete.cor, type="pearson") 
# a<-cor(hete,method = c("pearson"), use = "complete.obs")
write.csv(a$r,"corr_hete_gd.csv")
write.csv(a$P,"corr_hete_gd_pvalue.csv")

# 1 sca 和gd
names(sca)
sca.cor<-as.matrix(sca[,-c(1:3,13)])
b<-rcorr(sca.cor, type="pearson") 
# a<-cor(hete,method = c("pearson"), use = "complete.obs")
write.csv(b$r,"corr_sca_gd.csv")
write.csv(b$P,"corr_sca_gd_pvalue.csv")

你可能感兴趣的:(heterosis SCA 和gd 关系)