《动植物育种遗传数据分析》之AFEchidna篇--第1章

50 篇文章 4 订阅

引子: 本人于2019年主译出版的《动植物育种遗传数据分析》,原书主要使用ASReml进行分析。本博客将陆续演示使用AFEchidna包达到类似ASReml的结果。

第一章的代码如下:

// chapter one
library(AFEchidna)
get.es0.file(dat.file='pine_provenance.csv') # .es file
get.es0.file(es.file='pine_provenance.es',pedS=1) # .es0 file
# file.edit('pine_provenance.es0')

HT <- echidna(height ~ 1+Prov, 
             random = ~ Female*Block,
             residual=~units,
             es0.file = 'pine_provenance.es0' ) 

names(HT)
HT$Version

Var(HT)
# wald(HT)
waldT(HT)

HT$Converge

HT$LogLikelihood
# gets AIC and BIC for a model
IC(HT)

# fixed effects
coef(HT)$fixed

# random effects
bv<-coef(HT)$random
nrow(bv)
bv[1:10,]
tail(bv)

# Block bv
library(dplyr)
bv %>% filter(Term=='Block')
# Female bv
bv %>% filter(Term=='Female') %>% head
# Female:Block bv
bv %>% filter(Term=='Female:Block') %>% head

plot(HT)

## variance component and heritability
Var(HT)

## Linear Combinations of Variance Components
pin(HT)
pin(HT,mulp=c(Va~4*V3,
              VP~V1+V3+V4,
              H2i~4*V3/(V1+V3+V4)))

### TABULATE
library(dplyr)
pine_prov %>% group_by(Prov) %>% dplyr::select(height) %>%
  summarise(Mean=mean(height,na.rm=T),
            SD=sd(height,na.rm=T),
            Min=min(height,na.rm=T),
            Max=max(height,na.rm=T),
            Count=n()
  )

### prediction
#predict prov levels
HT1<-update(HT,predict="Prov")
HTprov_pred <- predict(HT1) 
predict.prov <- HTprov_pred$pred
predict.prov
HTprov_pred$ased

# Not adjusted for prov effect
HT2<-update(HT,predict="Female")
HTprov_female <- predict(HT2) 
predict.female <- HTprov_female$pred 
head(predict.female$pred1)
HTprov_female$ased

# adjusted for prov effect
HT3<-update(HT,predict="Prov Female !present Prov Female")
HTprov_fem.prov <- predict(HT3)

#includes non-estimable combinations
all_fem.prov<-HTprov_fem.prov$pred$pred1
head(all_fem.prov[,1:5])
#tail(all_fem.prov[,1:5])

## batch analysis, similar to !cycle for win Version
tba<-update(HT,trait=~height+diameter+volume,
            batch=TRUE)
Var(tba)

参考文献
1 . Zhang WH, Wei RY, Liu Y, Lin YZ. AFEchidna is a R package for genetic evaluation of plant and animal breeding datasets. BioRxiv. DOI: 10.1101/2021.06.24.449740.
2. 林元震 丁昌俊 主译,动植物育种遗传数据分析, 科学出版社,2019.9

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值