yzhlinscau的个人博客分享 http://blog.sciencenet.cn/u/yzhlinscau

博文

遗传分析R包推荐--breedR(一)

已有 4791 次阅读 2017-3-8 16:48 |个人分类:breedR|系统分类:科研笔记

breedR包由法国人facundo munoz开发的,源于对林业遗传分析所用,现已用于动植物遗传分析。其内核也是基于REML理论,所用的编程语言基于Fortran,可做类似于ARSReml-R包的分析,遗憾的是,目前该程序包暂时未能用于多性状分析和基因组选择分析。


下文做一简单的示范。


程序包的安装:

   if( !require(devtools) ) install.packages('devtools')

  devtools::install_github('famuvie/breedR')


其它程序包的安装:

   install.packages(c('tidyr','dplyr','ggplot2','GGally','knitr','viridis'))


简单示范:


data("douglas")

dat <- droplevels(subset(douglas, site == "s3")) # 目标数据


表型数据的图形

ggplot(dat, aes(x, y, fill = C13)) +

 geom_raster(show_legend = FALSE) +

 coord_fixed() +

 scale_fill_viridis()



示范1 简单的区组设计模型


dat$fam <- factor(dat$mum)  # 数据格式转换

h2.fml <- "4*G_3_3_1_1/(G_2_2_1_1+G_3_3_1_1+R_1_1)"  # 遗传力计算


res.base <- remlf90(

 fixed = C13 ~ orig,

 random = ~ block + fam,

 progsf90.options = paste("se_covar_function h2", h2.fml),

 dat = dat)


运行结果如下:

> summary(res.base)

Linear Mixed Model with pedigree and spatial effects fit by AI-REMLF90 ver. 1.122

  Data: dat

  AIC   BIC logLik

17987 18003  -8991


Parameters of special components:



Variance components:

        Estimated variances S.E.

block                   1087  387

fam                     1774  604

Residual               19914  774


  Estimate   S.E.

h2   0.3095 0.1004


Fixed effects:

        value   s.e.

orig.pA 471.86 12.470

orig.pB 501.58 19.925

orig.pC 435.96 27.087

orig.pF 444.08 14.372

orig.pG 378.28 50.751

orig.pH 389.80 46.890

orig.pI 409.80 47.066

orig.pJ 416.98 46.660

orig.pK 445.68 46.509


随机效应值如下:

> ranef(res.base)

$block

       value     s.e.

1   22.237335 18.30979

2    5.424956 17.93340

3  -11.723889 20.26381

4   14.077191 18.96857

5  -35.876594 19.28160

6   20.279598 18.05373

7   11.840247 20.62507

8   11.613073 17.93919

......

$fam

       value     s.e.

1    9.390304 25.17861

2  -49.228936 24.44993

3  -10.615627 26.03407

4   46.583473 24.92353

5   -3.174557 26.03291

6   28.684198 25.44909

7   47.244867 27.39178

8   26.594792 25.18145

.......

残差图

coordinates(res.base) <- dat[, c('x', 'y')]

plot(res.base, 'residuals')


示范2 个体模型+区组设计


res.blk <- remlf90(

 fixed = C13 ~ orig,

 genetic = list(model = 'add_animal',

                pedigree = dat[, c('self','dad','mum')],

                id = 'self'),

 spatial = list(model = 'blocks',

                coord = dat[, c('x','y')],

                id = "block"),

 dat = dat)


运行结果如下:


> summary(res.blk)

Linear Mixed Model with pedigree and spatial effects fit by AI-REMLF90 ver. 1.122

  Data: dat

  AIC   BIC logLik

17984 18000  -8989


Parameters of special components:

spatial: n.blocks: 34


Variance components:

        Estimated variances S.E.

genetic                 5477 1727

spatial                 1107  391

Residual               16235 1384


            Estimate    S.E.

Heritability   0.2389 0.07069


Fixed effects:

        value   s.e.

orig.pA 466.96 14.430

orig.pB 493.67 20.055

orig.pC 435.60 25.267

orig.pF 444.01 13.464

orig.pG 378.21 46.773

orig.pH 389.83 42.457

orig.pI 409.72 42.655

orig.pJ 417.02 42.198

orig.pK 445.65 42.027


残差图:

plot(res.blk, 'residuals')


空间效应图

plot(res.blk, type = 'spatial')



近期内,将继续演示breedR的空间分析模型和遗传竞争模型。





https://blog.sciencenet.cn/blog-1114360-1038297.html

上一篇:《R与ASReml-R统计学》封面草稿
下一篇:《R与ASReml-R统计学》已上市--购买途径
收藏 IP: 125.88.24.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-26 15:06

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部