forked from AlphaGenes/AlphaPart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
146 lines (108 loc) · 7.95 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
output:
github_document:
pandoc_args: --webtex=https://chart.apis.google.com/chart?cht=tx&chl=
always_allow_html: yes
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
# show me all columns
# devtools::install_github("jimhester/itdepends")
options(
tibble.width = Inf,
pillar.bold = TRUE,
pillar.neg = TRUE,
pillar.subtle_num = TRUE,
pillar.min_chars = Inf
)
knitr::opts_chunk$set(
collapse = TRUE,
dpi = 300, # change to 300 once on CRAN
warning = FALSE,
message = FALSE,
out.width = "100%",
comment = "#>",
fig.path = "man/figures/README-"
)
```
# AlphaPart <img src="man/figures/logo.png" align="right" height = 150/>
| Package | Status | Coverage | GitHub | Miscellaneous |
|-----------------|----------------- | ----------------- | ----------------- | ----------------- |
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/AlphaPart)](https://cran.r-project.org/package=AlphaPart) | [![Development](https://img.shields.io/badge/development-active-blue.svg)](https://img.shields.io/badge/development-active-blue.svg) | [![codecov](https://codecov.io/gh/AlphaGenes/AlphaPart/branch/version-0.8.2/graph/badge.svg?token=WS7YGNSOVL)](https://codecov.io/gh/AlphaGenes/AlphaPart) | [![GitHub version](https://img.shields.io/badge/GitHub-0.6.8.9000-orange.svg?style=flat-square)](https://github.com/AlphaGenes/AlphaPart/) | [![downloads](https://cranlogs.r-pkg.org/badges/AlphaPart)](https://cranlogs.r-pkg.org/badges/AlphaPart) <!-- line break 1 -->
[![CRAN Checks](https://cranchecks.info/badges/summary/AlphaPart)](https://cran.r-project.org/web/checks/check_results_AlphaPart.html) | [![R build status](https://github.com/AlphaGenes/AlphaPart/workflows/R-CMD-check/badge.svg)](https://github.com/AlphaGenes/AlphaPart/) | [![lints](https://github.com//AlphaGenes/AlphaPart/workflows/lint/badge.svg)](https://github.com/AlphaGenes/AlphaPart/) | [![Forks](https://img.shields.io/badge/forks-`r itdepends:::get_github_info("AlphaPart")$forks[[1]]`-blue.svg)](https://github.com/AlphaGenes/AlphaPart/) | [![total downloads](https://cranlogs.r-pkg.org/badges/grand-total/AlphaPart)](https://cranlogs.r-pkg.org/badges/grand-total/AlphaPart) <!-- line break 2 -->
[![minimal R version](https://img.shields.io/badge/R%3E%3D-3.5.0-6666ff.svg)](https://cran.r-project.org/) | [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/9gjgy9ff2i15fa4q?svg=true)](https://ci.appveyor.com/project/Prof-ThiagoOliveira/alphapart) | **Code Factor** | [![Github Issues](https://img.shields.io/badge/issues-`r itdepends:::get_github_info("AlphaPart")$open_issues[[1]]`-red.svg)](https://github.com/AlphaGenes/AlphaPart/issues) | [![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) <!-- line break 3 -->
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html) | | [![CodeFactor](https://www.codefactor.io/repository/github/alphagenes/alphapart/badge)](https://www.codefactor.io/repository/github/alphagenes/alphapart) | [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/AlphaGenes/AlphaPart.svg)](https://github.com/AlphaGenes/AlphaPart/) <!-- line break 4 -->
# Overview
A software that implements a method for **partitioning genetic trends** to quantify the sources of genetic gain in breeding programmes. The partitioning method is described in [Garcia-Cortes et al. (2008)](https://doi.org/10.1017/S175173110800205X). The package includes the main function `AlphaPart` for partitioning breeding values and auxiliary functions for manipulating data and summarizing, visualizing, and saving outputs.
# Instalation
```r
# The easiest way to get AlphaPart
install.packages("AlphaPart")
```
## Development version
To get a bug fix or to use a feature from the development version, you can install the development version of `AlphaPart` from GitHub.
```r
install.packages("devtools")
devtools::install_github("AlphaGenes/AlphaPart")
```
# Contributing to AlphaPart
Please, follow the contribution guide at [Contributing file](CONTRIBUTING.md) to know how to start contributing to `AlphaPart`.
# Usage
```r
library(AlphaPart)
## Partition additive genetic values by country and sex
AlphaPart.ped$country.gender <- with(AlphaPart.ped, paste(country, gender, sep="-"))
(res <- AlphaPart(x=AlphaPart.ped, colPath="country.gender", colBV=c("bv1", "bv2")))
#> Size:
#> - individuals: 8
#> - traits: 2 (bv1, bv2)
#> - paths: 4 (domestic-F, domestic-M, import-F, import-M)
#> - unknown (missing) values:
#> bv1 bv2
#> 0 0
#> Partitions of breeding values
#> - individuals: 8
#> - paths: 4 (domestic-F, domestic-M, import-F, import-M)
#> - traits: 2 (bv1, bv2)
#> Trait: bv1
#> IId FId MId gen country gender country.gender bv1 bv1_pa bv1_w bv1_domestic-F bv1_domestic-M bv1_import-F bv1_import-M
#> 1 A 1 domestic F domestic-F 100 0.0 100.0 100.000 0.0 0.0 0.000
#> 2 B 1 import M import-M 105 0.0 105.0 0.000 0.0 0.0 105.000
#> 3 C B A 2 domestic F domestic-F 104 102.5 1.5 51.500 0.0 0.0 52.500
#> 4 T B 2 import F import-F 102 52.5 49.5 0.000 0.0 49.5 52.500
#> 5 D 2 import M import-M 108 0.0 108.0 0.000 0.0 0.0 108.000
#> 6 E D C 3 domestic M domestic-M 107 106.0 1.0 25.750 1.0 0.0 80.250
#> 7 U D 3 import F import-F 107 54.0 53.0 0.000 0.0 53.0 54.000
#> 8 V E 4 domestic F domestic-F 109 53.5 55.5 68.375 0.5 0.0 40.125
#> Trait: bv2
#> IId FId MId gen country gender country.gender bv2 bv2_pa bv2_w bv2_domestic-F bv2_domestic-M bv2_import-F bv2_import-M
#> 1 A 1 domestic F domestic-F 88 0.0 88.0 88.00 0.00 0.0 0.0
#> 2 B 1 import M import-M 110 0.0 110.0 0.00 0.00 0.0 110.0
#> 3 C B A 2 domestic F domestic-F 100 99.0 1.0 45.00 0.00 0.0 55.0
#> 4 T B 2 import F import-F 97 55.0 42.0 0.00 0.00 42.0 55.0
#> 5 D 2 import M import-M 101 0.0 101.0 0.00 0.00 0.0 101.0
#> 6 E D C 3 domestic M domestic-M 80 100.5 -20.5 22.50 -20.50 0.0 78.0
#> 7 U D 3 import F import-F 102 50.5 51.5 0.00 0.00 51.5 50.5
#> 8 V E 4 domestic F domestic-F 105 40.0 65.0 76.25 -10.25 0.0 39.0
## Summarize population by generation (=trend)
(ret <- summary(res, by="gen"))
#> Summary of partitions of breeding values
#> - paths: 4 (domestic-F, domestic-M, import-F, import-M)
#> - traits: 2 (bv1, bv2)
#> Trait: bv1
#> gen N Sum domestic-F domestic-M import-F import-M
#> 1 1 2 102.5000 50.00000 0.0 0.0 52.500
#> 2 2 3 104.6667 17.16667 0.0 16.5 71.000
#> 3 3 2 107.0000 12.87500 0.5 26.5 67.125
#> 4 4 1 109.0000 68.37500 0.5 0.0 40.125
#> Trait: bv2
#> gen N Sum domestic-F domestic-M import-F import-M
#> 1 1 2 99.00000 44.00 0.00 0.00 55.00000
#> 2 2 3 99.33333 15.00 0.00 14.00 70.33333
#> 3 3 2 91.00000 11.25 -10.25 25.75 64.25000
#> 4 4 1 105.00000 76.25 -10.25 0.00 39.00000
## Plot the partitions
p <- plot(ret, ylab=c("BV for trait 1", "BV for trait 2"), xlab="Generation")
print(p)
```
![](man/figures/README-example1.png)<!-- -->