check_parent_older_offspring: Check that parents are older than their offspring

Description Usage Arguments Details Value Examples

View source: R/pedigree_consistency_checks_tbl_df.R

Description

Given a pedigree in tbl_df format, all parents that are also present as animals are filtered, if they are not older than their offspring.

Usage

1
2
3
4
5
check_parent_older_offspring(ptbl_pedigree,
                                    pn_offspring_col,
                                    pn_birthday_col,
                                    pn_parent_col,
                                    pn_date_diff_tol)

Arguments

ptbl_pedigree

pedigree in tbl_df format

pn_offspring_col

column index for offspring

pn_birthday_col

column index for birthdates of offspring

pn_parent_col

column index for parents

pn_date_diff_tol

minimum difference between birthdates of parents and offspring

Details

From the given pedigree in ptbl_pedigree, the three columns containing animal-Id, birthdate and a parent-id where parent can either be mother or father are extracted using 'dplyr::select'. The selected columns are given new names for easier readability of the remaining code. In case the birthdates are formatted as characters, they are converted into integers. From the original set of pedigree records, all parents are selected into a separate tbl_df. Their birthdate is searched using a 'dplyr::inner_join()' back to the orginal pedigree records. Once the birthdates for the parents are found we can filter those out which have a birthdate which is closer to the birthdate of the offspring than a given tolerance value.

Value

tbl_df of pedigree records not fullfilling requirements

Examples

1
2
3
4
5
6
7
8
9
s_data_file <- system.file(file.path("extdata","KLDAT_20170524_10000.txt"),
                           package = "PedigreeFromTvdData")
tbl_ped <- PedigreeFromTvdData::laf_open_fwf_tvd_input(ps_input_file = s_data_file)
l_tvd_id_col_dsch <- PedigreeFromTvdData::getTvdIdColsDsch()
n_bd_col_idx <- PedigreeFromTvdData::getBirthdateColIdxDsch()
PedigreeFromTvdData::check_parent_older_offspring(ptbl_pedigree = tbl_ped,
                                                  pn_offspring_col = l_tvd_id_col_dsch$TierIdCol,
                                                  pn_birthday_col = n_bd_col_idx,
                                                  pn_parent_col = l_tvd_id_col_dsch$MutterIdCol)

pvrqualitasag/PedigreeFromTvdData documentation built on May 29, 2019, 7:50 a.m.