 Software
 Open access
 Published:
GCA: an R package for genetic connectedness analysis using pedigree and genomic data
BMC Genomics volumeÂ 22, ArticleÂ number:Â 119 (2021)
Abstract
Background
Genetic connectedness is a critical component of genetic evaluation as it assesses the comparability of predicted genetic values across units. Genetic connectedness also plays an essential role in quantifying the linkage between reference and validation sets in wholegenome prediction. Despite its importance, there is no userfriendly software tool available to calculate connectedness statistics.
Results
We developed the GCA R package to perform genetic connectedness analysis for pedigree and genomic data. The software implements a large collection of various connectedness statistics as a function of prediction error variance or variance of unit effect estimates. The GCA R package is available at GitHub and the source code is provided as open source.
Conclusions
The GCA R package allows users to easily assess the connectedness of their data. It is also useful to determine the potential risk of comparing predicted genetic values of individuals across units or measure the connectedness level between training and testing sets in genomic prediction.
Background
Genetic connectedness quantifies the extent to which estimated breeding values can be fairly compared across units or contemporary groups [1, 2]. Genetic evaluation is known to be more robust when the connectedness level is high enough due to sufficient sharing of genetic material across groups. In such scenarios, the best linear unbiased prediction minimizes the risk of uncertainty in ranking of individuals. On the other hand, limited or no sharing of genetic material leads to less reliable comparisons of genetic evaluation methods [3]. Highthroughput genetic variants spanning the entire genome available for a wide range of agricultural species have now opened up an opportunity to assess connectedness using genomic data. A recent study showed that genomic relatedness strengthens the measures of connectedness across units compared with the use of pedigree relationships [4]. The concept of genetic connectedness was later extended to measure the connectedness level between reference and validation sets in wholegenome prediction [5]. This approach has also been used to optimize individuals constituting reference sets [6, 7]. In general, it was observed that increased connectedness led to increased prediction accuracy of genetic values evaluated by crossvalidation [8]. Comparability of total genetic values across units by accounting for additive as well as nonadditive genetic effects has also been investigated [9].
Despite the importance of connectedness, there is no userfriendly software tool available that offers computation of a comprehensive list of connectedness statistics using pedigree and genomic data. Therefore, we developed a genetic connectedness analysis R package, GCA, which measures the connectedness between individuals across units using pedigree or genomic data. The objective of this article is to describe a large collection of connectedness statistics implemented in the GCA package, overview the software architecture, and present several examples using simulated data.
Implementation
Connectedness statistics
A list of connectedness statistics supported by the GCA R package is shown in Fig.Â 1. These statistics can be classified into core functions derived from either prediction error variance (PEV) or variance of unit effect estimates (VE). PEVderived metrics include prediction error variance of differences (PEVD), coefficient of determination (CD), and prediction error correlation (r). Further, each metric based on PEV can be summarized as the average PEV within and across units, at the unit level as the average PEV of all pairwise differences between individuals across units, or using a contrast vector. VEderived metrics include variance of differences in unit effects (VED), coefficient of determination of VED (CDVED), and connectedness rating (CR). For each VEderived metric, three correction factors accounting for the number of fixed effects can be applied. These include no correction (0), correcting for one fixed effect (1), and correcting for two or more fixed effects (2). Thus, a combination of core functions, metrics, summary functions, and correction factors uniquely characterizes connectedness statistics. Further, the overall connectedness statistic can be obtained by calculating the average of the pairwise connectedness statistics across units.
Core functions
Prediction error variance (PEV)
A PEV matrix is obtained from Hendersonâ€™s mixed model equations (MME) by assuming a standard linear mixed model y=Xb+Zu+Îµ, where y,b,u, and Îµ refer to a vector of phenotypes, fixed effects, random additive genetic effects, and residuals, respectively [10]. The X and Z are incidence matrices associating fixed effects and genetic values to observations, respectively. The MME of the linear mixed model is
where K is a relationship matrix and \(\lambda = \frac {\sigma ^{2}_{\epsilon }}{\sigma ^{2}_{u}}\) is the ratio of residual and additive genetic variance. The inverse of the coefficient matrix is given by
Then the PEV of u is derived as shown in Henderson [10].
where M=Iâˆ’X(X^{â€²}X)^{âˆ’}X^{â€²} is the absorption (projection) matrix for fixed effects. C^{22} represents the lower right quadrant of the inverse of coefficient matrix. Note that \(\text {PEV}(\mathbf {u}) = \text {Var}(\mathbf {u}  \hat {\mathbf {u}})\) can be viewed as the posterior variance of u.
Variance of unit effect estimates (VE)
An alternative option for the choice of core function is to use VE, which is based on the variancecovariance matrix of estimated unit or contemporary group effects. Kennedy and Trus (1993) [11] argued that mean PEV over unit (PEV_{Mean}) defined as the average of PEV between individuals within the same unit can be approximated by VE \( = \text {Var}(\hat {\mathbf {b}})\), that is
Holmes et al. [12] pointed out that the agreement between PEV_{Mean} and VE_{0} depends on a number of fixed effects other than the management group fitted in the model. They proposed exact ways to derive PEV_{Mean} as a function of VE and suggested addition of a few correction factors. When unit effect is the only fixed effect included in the model, the exact PEV_{Mean} can be obtained as given below.
where X^{â€²}X^{âˆ’1} is a diagonal matrix with ith diagonal element equal to \(\frac {1}{n_{i}}\), and n_{i} is the number of records in unit i. Thus, the term \(\sigma ^{2}_{\epsilon } (\mathbf {X}' \mathbf {X})^{1}\) corrects the number of records within units. Accounting for additional fixed effects beyond unit effect when computing PEV_{Mean} is given by the following equation.
where X_{1} and X_{2} represent incidence matrices for units and other fixed effects, respectively, and \(\hat {\mathbf {b}}_{1}\) and \(\hat {\mathbf {b}}_{2}\) refer to the estimates of unit effects and other fixed effects, respectively [12]. This equation is suitable for cases in which there are two or more fixed effects fitted in the model.
Connectedness metrics
Below we describe connectedness metrics implemented in the GCA package. We also summarized and organized their relationships with each other, which were never clearly articulated in the literature. These metrics are the function of PEV or VE described earlier (Fig.Â 1).
Prediction error variance of difference (PEVD)
A PEVD metric measures the prediction error variance difference of breeding values between individuals from different units [11]. The PEVD between two individuals i and j is expressed as shown below.
where PEC _{ij} is the offdiagonal element of the PEV matrix corresponding to the prediction error covariance between errors of genetic values.
Group average PEVD: The average PEVD derived from the average relationships between and within units as a choice of connectedness measure can be traced back to Kennedy and Trus [11]. This can be calculated by inserting the PEV_{Mean} of i^{â€²}th and j^{â€²}th units and mean prediction error covariance (PEC_{Mean}) between i^{â€²}th and j^{â€²}th units into Eq. (5) as
where \(\phantom {\dot {i}\!}\overline {\text {PEV}}_{i'i'}, \overline {\text {PEV}}_{j'j'}\), and \(\phantom {\dot {i}\!}\overline {\text {PEC}}_{i'j'}\) denote PEV_{Mean} in i^{â€²}th and j^{â€²}th units, and PEC_{Mean} between i^{â€²}th and j^{â€²}th units. We refer to this summary method as group average as illustrated in Fig.Â 2A.
Individual average PEVD: Alternatively, we can first compute PEVD at the individual level using Eq. (5) and then aggregate and summarize at the unit level to obtain the average of PEVD between individuals across two units [13]
where \(\phantom {\dot {i}\!}n_{i'}\) and \(\phantom {\dot {i}\!}n_{j'}\) are the total number of records in units i^{â€²} and j^{â€²}, respectively and \(\phantom {\dot {i}\!}\sum \text {PEVD}_{i'j'}\) is the sum of all pairwise differences between the two units. We refer to this summary method as individual average. A flow diagram illustrating the computational procedure is shown in Fig.Â 2B.
Contrast PEVD: The PEVD of contrast between a pair of units can be used to summarize PEVD [14].
where x is a contrast vector involving \(\phantom {\dot {i}\!}1/n_{i'}, 1/n_{j'}\) and 0 corresponding to individuals belonging to i^{â€²}th, j^{â€²}th, and the remaining units. The sum of elements in x equals to zero. A flow diagram showing a computational procedure is shown in Fig.Â 2C.
Coefficient of determination (CD)
A CD metric measures the precision of genetic values and can be interpreted as the square of the correlation between the predicted and the true difference in the genetic values or the ratio of posterior and prior variances of genetic values u [15]. A notable difference between CD and PEVD is that CD penalizes connectedness measurements when across units include individuals that are genetically too similar [4, 8]. A pairwise CD between individuals i and j is given by the following equation.
where K_{ii} and K_{jj} are ith and jth diagonal elements of K, and K_{ij} is the relationship between ith and jth individuals [14].
Group average CD: Similar to the group average PEVD statistic, PEV_{Mean} and PEC_{Mean} can be used to summarize CD at the unit level.
Here, \(\phantom {\dot {i}\!}\overline {\mathbf {K}}_{i'i'}, \overline {\mathbf {K}}_{j'j'}\) and \(\phantom {\dot {i}\!}\overline {\mathbf {K}}_{i'j'}\) refer to the means of relationship coefficients in units i^{â€²} and j^{â€²}, and the mean relationship coefficient between two units i^{â€²} and j^{â€²}, respectively. Graphical derivation of group average CD is illustrated in Fig.Â 3A. This summary method has not been used in the literature, but shares the same spirit with the group average PEVD.
Individual average CD: Individual average CD is derived from the average of CD between individuals across two units [13].
A flow diagram of individual average CD is shown in Fig.Â 3B.
Contrast CD: A contrast of CD between any pair of units is given by [14]
A flow diagram showing the computational procedure is shown in Fig.Â 3C.
Prediction error correlation (r)
Prediction error correlation, known as pairwise r statistic, between individuals i and j is calculated from the elements of the PEV matrix [16].
Group average r: This is known as flock connectedness in the literature, which calculates the ratio of PEV_{Mean} and PEC_{Mean} [16]. This group average connectedness for r between two units i^{â€²} and j^{â€²} is given by
A graphical derivation is presented in Fig.Â 4A.
Individual average r: The summary method based on individual average calculates pairwise r for all pairs of individuals followed by averaging all r measures across units.
This summary method was first used in Yu et al. [4] and calculation steps are shown in Fig.Â 4B.
Contrast r: A contrast of r is defined as below.
This summary method has not been used in the literature, but shares the same concept with the contrasts PEVD and CD. A flow diagram illustrating a computational procedure is shown in Fig.Â 4C.
Variance of differences in unit effects (VED)
A metric VED, which is a function of VE can be used to measure connectedness. All PEVbased metrics follow a twostep procedure in the sense that they first compute the PEV matrix at the individual level and then apply one of the summary methods to derive connectedness at the unit level or vice versa. In contrast, VEbased metrics follow a singlestep procedure such that we can obtain connectedness between units directly. Moreover, since the number of fixed effects is oftentimes smaller than the number of individuals in the model, the computational requirements for VED are expected to be lower [12]. Note that all VEderived approaches can be classified based on the number of fixed effects to be corrected. Using the group average summary method, three VEDc statistics estimate PEVD alike connectedness between two units i^{â€²} and j^{â€²} by replacing PEV_{Mean} in Eq. (6) from VEc [11, 12].
Here, c denotes no correction (0), correction for one fixed effect (1), and correction for two or more fixed effects (2) [12].
Coefficient of determination of vED (CDVED)
Similarly, the correction function based on VEc can be employed to define a group average CD alike statistic. We named this as coefficient of determination of VED (CDVEDc). A pairwise CDVEDc between two units i^{â€²} and j^{â€²} is given by
Here, c includes 0, 1, and 2 by referring to the number of corrections for fixed effects.
Connectedness rating (CR)
A CR statistic first proposed by Mathur et al. [17] is similar to Eq. (8). However, it uses variances and covariances of estimated unit effects instead of PEV_{Mean} and PEC_{Mean}. Holmes et al. [12] extended CR by replacing VE with VEc to calculate CR and this is referred as CRc below. A pairwise CRc between two units i^{â€²} and j^{â€²} is outlined as
where c equals to the number of corrections for fixed effects: 0, 1, and 2. When c is set to 0, this is equivalent to CR of Mathur et al. [17].
Results and discussion
Overview of software architecture
The GCA R package is implemented entirely in R, which is an open source programming language and environment for performing statistical computing [18]. The package is hosted on a GitHub page accompanied by a detailed vignette document. Computational speed was improved by integrating C++ code into R code using the Rcpp package [19]. The initial versions of the algorithms and the R code were used in previous studies [4, 8, 9] and were enhanced further for efficiency, usability, and documentation in the current version to facilitate connectedness analysis. The GCA R package provides a comprehensive and effective tool for genetic connectedness analysis and wholegenome prediction, which further contributes to the genetic evaluation and prediction.
Installing the GCA package
The current version of the GCA R package is available at GitHub (https://github.com/QGresources/GCA). The package can be installed using the devtools R package [20] and loaded into the R environment following the steps shown at GitHub.
Simulated data
A simulated cattle data set using QMSim software [21] is included in the GCA package as an example data set. A total of 2,500 cattle spanning five generations were simulated with pedigree and genomic information available for all individuals. We simulated 10,000 evenly distributed biallelic single nucleotide polymorphisms and 2,000 randomly distributed quantitative trait loci across 29 pairs of autosomes with 100 cM per chromosome. A single phenotype with a heritability of 0.6 and a fixed covariate of sex were simulated. This was followed by simulating units using the kmedoid algorithm [22] coupled with the dissimilarity matrix derived from a numerator relationship matrix as shown in previous studies [4, 8, 9]. The data set is stored as an R object in the package. The genotype object is a 2,500Ã—10,000 marker matrix. The phenotype object is a 2,500Ã—6 matrix, including the columns of progeny, sire, dam, sex, unit, and phenotype.
Application of the GCA package
A detailed usage of the GCA R package can be found in the vignette document (https://qgresources.github.io/GCA_Vignette/GCA.html). Examples include 1) pairwise and overall connectedness measures across units; 2) relationship between PEV and VEbased connectedness metrics; and 3) relationship between connectedness metrics and genomic prediction accuracies.
Conclusions
The GCA R package provides users with a comprehensive tool for analysis of genetic connectedness using pedigree and genomic data. The users can easily assess the connectedness of their data and be mindful of the uncertainty associated with comparing genetic values of individuals involving different management units or contemporary groups. Moreover, the GCA package can be used to measure the level of connectedness between training and testing sets in the wholegenome prediction paradigm. This parameter can be used as a criterion for optimizing the training data set. This paper also summarized the relationship among various connectedness metrics, which was not clearly articulated in the past literature. In summary, we contend that the availability of the GCA package to calculate connectedness allows breeders and geneticists to make better decisions on comparing individuals in genetic evaluations and inferring linkage between any pair of individual groups in genomic prediction.
Availability and implementation
Project name: Genetic connectedness analysis (GCA) Project home page:https://github.com/QGresources/GCAOperating system: Platformindependent Programming language: R and C++ Other requirements: No License: GNU GPLv3 Any restrictions to use by nonacademics: No
Availability of data and material
The GCA R source code is provided as free and open source. The webpage https://github.com/QGresources/GCAwas created as a nexus of all genetic connectedness related functions and examples available in the GCA R package. The vignette is available at https://qgresources.github.io/GCA_Vignette/GCA.html.
Abbreviations
 CD:

Coefficient of determination
 CDVED:

Coefficient of determination of VED
 CR:

Connectedness rating
 GCA:

Genetic connectedness analysis
 MME:

Mixed model equations
 PEV:

Prediction error variance
 PEVD:

Prediction error variance of differences
 PEV_{Mean} :

Mean PEV over unit
 r:

Prediction error correlation
 VE:

Variance of unit effect estimates
 VED:

Variance of differences in unit effects
References
Foulley J, Schaeffer L, Song H, Wilton J. Progeny group size in an organized progeny test program of ai beef bulls using reference sires. Can J Anim Sci. 1983; 63(1):17â€“26.
Foulley JL, Bouix J, Goffinet B, Elsen MJ. Connectedness in genetic evaluation In: Gianola D, Hammond K, editors. Advances in statistical methods for genetic improvement of livestock. Heidelberg: Springer Verlag: 1990. p. 277â€“308.
Kuehn L, Notter D, Nieuwhof G, Lewis R. Changes in connectedness over time in alternative sheep sire referencing schemes. J Anim Sci. 2008; 86(3):536â€“44.
Yu H, Spangler ML, Lewis RM, Morota G. Genomic relatedness strengthens genetic connectedness across management units. G3 Genes Genomes Genet. 2017; 7(10):3543â€“56.
Pszczola M, Strabel T, Van Arendonk J, Calus M. The impact of genotyping different groups of animals on accuracy when moving from traditional to genomic selection. J Dairy Sci. 2012; 95(9):5412â€“21.
Rincent R, LaloÃ« D, Nicolas S, Altmann T, Brunel D, Revilla P, Rodriguez VM, MorenoGonzalez J, Melchinger A, Bauer E, et al.Maximizing the reliability of genomic selection by optimizing the calibration set of reference individuals: comparison of methods in two diverse groups of maize inbreds (zea mays l.)Genetics. 2012; 192(2):715â€“28.
Isidro J, Jannink JL, Akdemir D, Poland J, Heslot N, Sorrells ME. Training set optimization under population structure in genomic selection. Theor Appl Genet. 2015; 128(1):145â€“58.
Yu H, Spangler ML, Lewis RM, Morota G. Do stronger measures of genomic connectedness enhance prediction accuracies across management units?. J Anim Sci. 2018; 96(11):4490â€“500.
Momen M, Morota G. Quantifying genomic connectedness and prediction accuracy from additive and nonadditive gene actions. Genet Sel Evol. 2018; 50(1):45.
Henderson CR. Applications of Linear Models in Animal Breeding. Third edition, Edited by Schaeffer LR. Guelph: University of Guelph; 1984.
Kennedy B, Trus D. Considerations on genetic connectedness between management units under an animal model. J Anim Sci. 1993; 71(9):2341â€“52.
Holmes JB, Dodds KG, Lee MA. Estimation of genetic connectedness diagnostics based on prediction errors without the prediction error varianceâ€“covariance matrix. Genet Sel Evol. 2017; 49(1):29.
Amorim ST, Yu H, Baldi F, Morota G. An assessment of genomic connectedness measures in nellore cattle. J Anim Sci. 2020; 98:1â€“12.
LaloÃ« D, Phocas F, Menissier F. Considerations on measures of precision and connectedness in mixed linear models of genetic evaluation. Genet Sel Evol. 1996; 28(4):359.
LaloÃ« D. Precision and information in linear models of genetic evaluation. Genet Sel Evol. 1993; 25(6):557.
Lewis R, Crump R, Simm G, Thompson R. Assessing connectedness in acrossflock genetic evaluations. Scarborough: The British Society of Animal Science; 1999. pp. 121â€“122.
Mathur P, Sullivan B, Chesnais J. Measuring connectedness: concept and application to a large industry breeding program. In: Proc. 7th World Congr. Genet. Appl. to Livest. Prod, vol. 19. Montpellier: 2002. p. 23.
R Core Team. R: A Language and Environment for Statistical Computing. Vienna: R Foundation for Statistical Computing; 2019. https://www.Rproject.org/.
Eddelbuettel D, FranÃ§ois R. Rcpp: Seamless R and C++ integration. J Stat Softw. 2011; 40(8):1â€“18. https://doi.org/10.18637/jss.v040.i08.
Wickham H, Chang W. Devtools: Tools to make developing r packages easier. R Package Version. 2016; 1(0):9000.
Sargolzaei M, Schenkel FS. Qmsim: a largescale genome simulator for livestock. Bioinformatics. 2009; 25(5):680â€“1.
Kaufman L, Rousseeuw PJ. Finding Groups in Data: an Introduction to Cluster Analysis. New York: Wiley; 1990.
Acknowledgements
We thank the Morota lab members for testing the GCA package.
Funding
This work was supported in part by Virginia Polytechnic Institute and State University startup funds to GM.
Author information
Authors and Affiliations
Contributions
HY developed the software tool and drafted the manuscript. GM designed and supervised the study, and revised the manuscript. All authors read and approved the manuscript.
Corresponding authors
Ethics declarations
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Competing interests
GM is a member of the editorial board for BMC Genomics.
Additional information
Publisherâ€™s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the articleâ€™s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the articleâ€™s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.
About this article
Cite this article
Yu, H., Morota, G. GCA: an R package for genetic connectedness analysis using pedigree and genomic data. BMC Genomics 22, 119 (2021). https://doi.org/10.1186/s12864021074147
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s12864021074147