Learn R Programming

AlphaPart (version 0.8.1)

AlphaPart: AlphaPart.R

Description

A function to partition breeding values by a path variable. The partition method is described in Garc<U+00ED>a-Cort<U+00E9>s et al., 2008: Partition of the genetic trend to validate multiple selection decisions. Animal : an international journal of animal bioscience. DOI: 10.1017/S175173110800205X

Usage

AlphaPart(
  x,
  pathNA = FALSE,
  recode = TRUE,
  unknown = NA,
  sort = TRUE,
  verbose = 1,
  profile = FALSE,
  printProfile = "end",
  pedType = "IPP",
  colId = 1,
  colFid = 2,
  colMid = 3,
  colPath = 4,
  colBV = 5:ncol(x),
  colBy = NULL
)

Arguments

x

data.frame , with (at least) the following columns: individual, father, and mother identif ication, and year of birth; see arguments colId, colFid, colMid, colPath, and colBV; see also details about the validity of pedigree.

pathNA

Logical, set dummy path (to "XXX") where path information is unknown (missing).

recode

Logical, internally recode individual, father and, mother identification to 1:n codes, while missing parents are defined with 0; this option must be used if identif ications in x are not already given as 1:n codes, see also argument sort.

unknown

Value(s) used for representing unknown (missing) parent in x; this options has an effect only when recode=FALSE as it is only needed in that situation.

sort

Logical, initially sort x using orderPed() so that children follow parents in order to make imputation as optimal as possible (imputation is performed within a loop from the first to the last unknown birth year); at the end original order is restored.

verbose

Numeric, print additional information: 0 - print nothing, 1 - print some summaries about the data.

profile

Logical, collect timings and size of objects.

printProfile

Character, print profile info on the fly ("fly") or at the end ("end").

pedType

Character, pedigree type: the most common form is "IPP" for Individual, Parent 1 (say father), and Parent 2 (say mother) data; the second form is "IPG" for Individual, Parent 1 (say father), and one of Grandparents of Parent 2 (say maternal grandfather).

colId

Numeric or character, position or name of a column holding individual identif ication.

colFid

Numeric or character, position or name of a column holding father identif ication.

colMid

Numeric or character, position or name of a column holding mother identif ication or maternal grandparent identif ication if pedType="IPG" .

colPath

Numeric or character, position or name of a column holding path information.

colBV

Numeric or character, position(s) or name(s) of column(s) holding breeding Values.

colBy

Numeric or character, position or name of a column holding group information (see details).

Value

An object of class AlphaPart, which can be used in further analyses - there is a handy summary method (summary.AlphaPart works on objects of AlphaPart class) and a plot method for its output (plot.summaryAlphaPart works on objects of summaryAlphaPart class). Class AlphaPart is a list. The first length(colBV) components (one for each trait and named with trait label, say trt) are data frames. Each data.frame contains:

x

columns from initial data x

trt_pa

parent average

trt_w

Mendelian sampling term

trt_path1, trt_path2, ...

breeding value partitions

The last component of returned object is also a list named info with the following components holding meta information about the analysis:

path

column name holding path information

nP

number of paths

lP

path labels

nT

number of traits

lT

trait labels

warn

potential warning messages associated with this object

If colBy!=NULL the resulting object is of a class summaryAlphaPart, see summary.AlphaPart for details.

If profile=TRUE, profiling info is printed on screen to spot any computational bottlenecks.

Details

Pedigree in x must be valid in a sense that there are:

  • no directed loops (the simplest example is that the individual identification is equal to the identification of a father or mother)

  • no bisexuality, e.g., fathers most not appear as mothers

  • father and/or mother can be unknown (missing) - defined with any "code" that is dif ferent from existing identif ications

Unknown (missing) values for breeding values are propagated down the pedigree to provide all available values from genetic evaluation. Another option is to cut pedigree links - set parents to unknown and remove them from pedigree prior to using this function - see pedSetBase function. Warning is issued in the case of unknown (missing) values.

In animal breeding/genetics literature the model with the underlying pedigree type "IPP" is often called animal model, while the model for pedigree type "IPG" is often called sire - maternal grandsire model. With a combination of colFid and colMid mother - paternal grandsire model can be accomodated as well.

Argument colBy can be used to directly perform a summary analysis by group, i.e., summary(AlphaPart(...), by="group"). See summary.AlphaPart for more. This can save some CPU time by skipping intermediate steps. However, only means can be obtained, while summary method gives more flexibility.

References

Garcia-Cortes, L. A. et al. (2008) Partition of the genetic trend to validate multiple selection decisions. Animal, 2(6):821-824. http://dx.doi.org/10.1017/S175173110800205X

See Also

summary.AlphaPart for summary method that works on output of AlphaPart, pedSetBase for setting base population, pedFixBirthYear for imputing unknown (missing) birth years, orderPed in pedigree package for sorting pedigree

Examples

Run this code
# NOT RUN {
## Small pedigree with additive genetic (=breeding) values
ped <- data.frame(  id=c(  1,   2,   3,   4,   5,   6),
                   fid=c(  0,   0,   2,   0,   4,   0),
                   mid=c(  0,   0,   1,   0,   3,   3),
                   loc=c("A", "B", "A", "B", "A", "A"),
                   gen=c(  1,   1,   2,   2,   3,   3),
                  trt1=c(100, 120, 115, 130, 125, 125),
                  trt2=c(100, 110, 105, 100,  85, 110))

## Partition additive genetic values
tmp <- AlphaPart(x=ped, colBV=c("trt1", "trt2"))
print(tmp)

## Summarize by generation
summary(tmp, by="gen")

# }
# NOT RUN {
## There are also two demos
demo(topic="AlphaPart_deterministic", package="AlphaPart", ask=interactive())
demo(topic="AlphaPart_stochastic",     package="AlphaPart", ask=interactive())
# }

Run the code above in your browser using DataLab