Data objects

exampleNprcgenekeeprConfig

exampleNprcgenekeeprConfig is a loadable version of the example configuration file example_nprcgenekeepr_config

examplePedigree

examplePedigree is a pedigree object created by qcStudbook

finalRpt

finalRpt is a list object created from the list object rpt prepared by reportGV. It is created inside orderReport. This version is at the state just prior to calling rankSubjects inside orderReport.

focalAnimals

focalAnimals is a dataframe with one column (_id_) containing the of animal Ids from the __examplePedigree__ pedigree.

lacy1989Ped

lacy1989Ped small hypothetical pedigree

lacy1989PedAlleles

lacy1989PedAlleles is a dataframe produced by geneDrop on lacy1989Ped with 5000 iterations.

ped1Alleles

ped1Alleles is a dataframe created by the geneDrop function

pedDuplicateIds

pedDuplicateIds is a dataframe with 9 rows and 5 columns (ego_id, sire, dam_id, sex, birth_date) representing a full pedigree with a duplicated record.

pedFemaleSireMaleDam

pedFemaleSireMaleDam is a dataframe with 8 rows and 5 columns (ego_id, sire, dam_id, sex, birth_date) representing a full pedigree with the errors of having a sire labeled as female and a dam labeled as male.

pedGood

pedGood is a dataframe with 8 rows and 5 columns (ego_id, sire, dam_id, sex, birth_date) representing a full pedigree with no errors.

pedInvalidDates

pedInvalidDates is a dataframe with 8 rows and 5 columns (ego_id, sire, dam_id, sex, birth_date) representing a full pedigree with values in the birth_date column that are not valid dates.

pedMissingBirth

pedMissingBirth is a dataframe with 8 rows and 5 columns (ego_id, sire, dam_id, sex, birth_date) representing a full pedigree with no errors.

pedOne

pedOne is a loadable version of a pedigree file fragment used for testing and demonstration

pedSameMaleIsSireAndDam

pedSameMaleIsSireAndDam is a dataframe with 8 rows and 5 columns (ego_id, sire, dam_id, sex, birth_date) representing a full pedigree with no errors.

pedSix

pedSix is a loadable version of a pedigree file fragment used for testing and demonstration

pedWithGenotype

pedWithGenotype is a dataframe produced from qcPed by adding made up genotypes.

pedWithGenotypeReport

pedWithGenotypeReport is a list containing the output of reportGV.

qcBreeders

qcBreeders is a list of 29 baboon IDs that are potential breeders

qcPed

qcPed is a dataframe with 277 rows and 6 columns

qcPedGvReport

qcPedGvReport is a genetic value report

rhesusGenotypes

rhesusGenotypes is a dataframe with two haplotypes per animal

rhesusPedigree

rhesusPedigree is a pedigree object

smallPed

smallPed is a hypothetical pedigree

smallPedTree

smallPedTree is a pedigree tree made from smallPed

Major Features and Functions

Brief codebook and Major Functions

nprcgenekeepr

Genetic Management Functions

Primary interactive functions

Funtions designed for interactive use

addBackSecondParents()

Add back single parents trimmed pedigree

addErrTxt()

Concatenates any errors from nprcgenekeeprErr into narrative form

addGenotype()

Add genotype data to pedigree file

addParents()

Add parents

addUIds()

Eliminates partial parentage situations by adding unique placeholder IDs for the unknown parent.

agePyramidPlot()

Form age pyramid plot

assignAlleles()

Assign parent alleles randomly

calcA()

Calculates a, the number of an individual's alleles that are rare in each simulation.

calcAge()

Calculate animal ages.

calcFE()

Calculates founder Equivalents

calcFEFG()

Calculates Founder Equivalents and Founder Genome Equivalents

calcFG()

Calculates Founder Genome Equivalents

calcGU()

Calculates genome uniqueness for each ID that is part of the population.

calcRetention()

Calculates Allelic Retention

checkGenotypeFile()

Check genotype file

checkParentAge()

Check parent ages to be at least minParentAge

correctParentSex()

Sets sex for animals listed as either a sire or dam.

countLoops()

Count the number of loops in a pedigree tree.

createExampleFiles()

Creates a folder with CSV files containing example pedigrees and ID lists used to demonstrate the package.

createPedTree()

Create a pedigree tree (PedTree).

finalRpt

finalRpt is a list object created from the list object rpt prepared by reportGV. It is created inside orderReport. This version is at the state just prior to calling rankSubjects inside orderReport.

findGeneration()

Determines the generation number for each id.

findLoops()

Find loops in a pedigree tree

findPedigreeNumber()

Determines the generation number for each id.

fixGenotypeCols()

Reformat names of observed genotype columns

geneDrop()

Gene drop simulation based on the provided pedigree information

getAncestors()

Recursively create a character vector of ancestors for an individual ID.

getDatedFilename()

Returns a character vector with an file name having the date prepended.

getDemographics()

Get demographic data

getFocalAnimalPed()

Get pedigree based on list of focal animals

getGenotypes()

Get genotypes from file

getGVGenotype()

Get Genetic Value Genotype data structure for reportGV function.

getGVPopulation()

Get the population of interest for the Genetic Value analysis.

getLkDirectAncestors()

Get the direct ancestors of selected animals

getLkDirectRelatives()

Get the direct ancestors of selected animals

getPedigree()

Get pedigree from file

getPedMaxAge()

Get the maximum age of live animals in the pedigree.

getPossibleCols()

Get possible column names for a studbook.

getPyramidPlot()

Creates a pyramid plot of the pedigree provided.

getRequiredCols()

Get required column names for a studbook.

getSiteInfo()

Get site information

kinship()

Generates a kinship matrix.

makeExamplePedigreeFile()

Write copy of nprcgenekeepr::examplePedigree into a file

obfuscateDate()

obfucateDate adds a random number of days bounded by plus and minus max delta

obfuscateId()

obfucateId creates a vector of ID aliases of specified length

obfuscatePed()

obfuscatePed takes a pedigree object and creates aliases for all IDs and adjusts all date within a specified amount.

print(<summary.nprcgenekeeprErr>) print(<summary.nprcgenekeeprGV>)

print.summary.nprcgenekeepr print.summary.nprcgenekeeprGV

qcStudbook()

Quality Control for the Studbook or pedigree

rankSubjects()

Ranks animals based on genetic value.

kinMatrix2LongForm()

Reformats a kinship matrix into a long-format table.

removeDuplicates()

Remove duplicate records from pedigree

removeUninformativeFounders()

Remove uninformative founders.

removeUnknownAnimals()

removeUnknownAnimals Removes unknown animals added to pedigree that serve as placeholders for unknown parents.

runGeneKeepR()

Allows running shiny application with nprcgenekeepr::runGeneKeepR()

trimPedigree()

Trim pedigree to ancestors of provided group by removing uninformative individuals

summary(<nprcgenekeeprErr>) summary(<nprcgenekeeprGV>)

summary.nprcgenekeeprErr Summary function for class nprcgenekeeprErr

All exposed functions

addAnimalsWithNoRelative()

Adds an NA value for all animals without a relative

addBackSecondParents()

Add back single parents trimmed pedigree

addGenotype()

Add genotype data to pedigree file

addGroupOfUnusedAnimals()

addGroupOfUnusedAnimals adds a group to the saved groups if needed

addIdRecords()

addIdRecords Adds Ego records added having NAs for parent IDs

addParents()

Add parents

addSexAndAgeToGroup()

Forms a dataframe with Id, Sex, and current Age given a list of Ids and a pedigree

addUIds()

Eliminates partial parentage situations by adding unique placeholder IDs for the unknown parent.

agePyramidPlot()

Form age pyramid plot

alleleFreq()

Calculates the count of each allele in the provided vector.

allTrueNoNA()

Returns TRUE if every member of the vector is TRUE.

assignAlleles()

Assign parent alleles randomly

calcA()

Calculates a, the number of an individual's alleles that are rare in each simulation.

calcAge()

Calculate animal ages.

calcFE()

Calculates founder Equivalents

calcFEFG()

Calculates Founder Equivalents and Founder Genome Equivalents

calcFG()

Calculates Founder Genome Equivalents

calcGU()

Calculates genome uniqueness for each ID that is part of the population.

calcRetention()

Calculates Allelic Retention

calculateSexRatio()

Calculates the sex ratio (number of non-males / number of males) given animal Ids and their pedigree

checkChangedColAndErrorLst()

checkChangedColAndErrorLst examines errorLst for errors and errorLst$changeCols non-empty fields

checkChangedColsLst()

checkChangedColsLst examines list for non-empty fields

checkErrorLst()

checkErrorLst examines list for non-empty fields

checkGenotypeFile()

Check genotype file

checkParentAge()

Check parent ages to be at least minParentAge

checkRequiredCols()

Examines column names, cols for required column names

chooseAlleles()

Combines two vectors of alleles by randomly selecting one allele or the other at each position.

chooseAllelesChar()

Combines two vectors of alleles when alleles are character vectors.

chooseDate()

Choose date based on earlier flag.

colChange()

colChange internal function to describe column names transformation

convertAncestry()

Converts the ancestry information to a standardized code

convertDate()

Converts date columns formatted as characters to be of type datetime

convertFromCenter()

Converts the fromCenter information to a standardized code

convertRelationships()

Converts pairwise kinship values to a relationship category descriptor.

convertSexCodes()

Converts sex indicator for an individual to a standardized codes.

convertStatusCodes()

Converts status indicators to a Standardized code

correctParentSex()

Sets sex for animals listed as either a sire or dam.

countFirstOrder()

Count first-order relatives.

countLoops()

Count the number of loops in a pedigree tree.

createExampleFiles()

Creates a folder with CSV files containing example pedigrees and ID lists used to demonstrate the package.

createPedOne()

createPedOne makes the pedOne data object

createPedSix()

createPedSix makes the pedSix data object

createPedTree()

Create a pedigree tree (PedTree).

create_wkbk()

Creates an Excel workbook with worksheets.

dataframe2string()

dataframe2string converts a data.frame object to a character vector

fillBins()

fillBins Fill bins represented by list of two lists males and females.

fillGroupMembers()

Forms and fills list of animals groups based on provided constraints

fillGroupMembersWithSexRatio()

Forms breeding group(s) with an effort to match a specified sex ratio

filterAge()

Removes kinship values where an animal is less than the minAge

filterKinMatrix()

Filters a kinship matrix to include only the egos listed in 'ids'

filterPairs()

Filters kinship values from a long-format kinship table based on the sexes of the two animals involved.

filterReport()

Filters a genetic value report down to only the specified animals

filterThreshold()

Filters kinship to remove rows with kinship values less than the specified threshold

findGeneration()

Determines the generation number for each id.

findLoops()

Find loops in a pedigree tree

findOffspring()

Finds the number of total offspring for each animal in the provided pedigree.

findPedigreeNumber()

Determines the generation number for each id.

fixColumnNames()

fixColumnNames changes original column names and into standardized names.

fixGenotypeCols()

Reformat names of observed genotype columns

geneDrop()

Gene drop simulation based on the provided pedigree information

get_and_or_list()

Returns a one element character string with correct punctuation for a list made up of the elements of the character vector argument.

get_elapsed_time_str()

Returns the elapsed time since start_time.

getAncestors()

Recursively create a character vector of ancestors for an individual ID.

getAnimalsWithHighKinship()

Forms a list of animal Ids and animals related to them

getChangedColsTab()

getChangedColsTab skeleton of list of errors

getConfigFileName()

getConfigFileName returns the configuration file name appropriate for the system.

getCurrentAge()

Age in years using the provided birthdate.

getDateColNames()

Vector of date column names

getDatedFilename()

Returns a character vector with an file name having the date prepended.

getDateErrorsAndConvertDatesInPed()

Converts columns of dates in text form to Date object columns

getDemographics()

Get demographic data

getEmptyErrorLst()

Creates a empty errorLst object

getErrorTab()

getErrorTab skeleton of list of errors

getFocalAnimalPed()

Get pedigree based on list of focal animals

getGenoDefinedParentGenotypes()

Assigns parental genotype contributions to an IDs genotype by attributing alleles to sire or dam

getGenotypes()

Get genotypes from file

getGVGenotype()

Get Genetic Value Genotype data structure for reportGV function.

getGVPopulation()

Get the population of interest for the Genetic Value analysis.

getIdsWithOneParent()

getIdsWithOneParent extracts IDs of animals pedigree without either a sire or a dam

getIncludeColumns()

Get the superset of columns that can be in a pedigree file.

getIndianOriginStatus()

Get Indian-origin status of group

getLkDirectAncestors()

Get the direct ancestors of selected animals

getLkDirectRelatives()

Get the direct ancestors of selected animals

getLogo()

Get Logo file name

getMaxAx()

Get the maximum of the absolute values of the negative (males) and positive (female) animal counts.

getMinParentAge()

Get minimum parent age.

getOffspring()

Get offspring to corresponding animal IDs provided

getParamDef()

Get parameter definitions from tokens found in configuration file.

getParents()

Get parents to corresponding animal IDs provided

getPedigree()

Get pedigree from file

getPedMaxAge()

Get the maximum age of live animals in the pedigree.

getPossibleCols()

Get possible column names for a studbook.

getPotentialSires()

Provides list of potential sires

getProbandPedigree()

Gets pedigree to ancestors of provided group leaving uninformative ancestors.

getProductionStatus()

Get production status of group

getProportionLow()

Get proportion of Low genetic value animals

getPyramidAgeDist()

Get the age distribution for the pedigree

getPyramidPlot()

Creates a pyramid plot of the pedigree provided.

getRecordStatusIndex()

Returns record numbers with selected recordStatus.

getRequiredCols()

Get required column names for a studbook.

getSiteInfo()

Get site information

getTokenList()

Gets tokens from character vector of lines

getVersion()

getVersion Get the version number of nprcgenekeepr

groupAddAssign()

Add animals to an existing breeding group or forms groups:

groupMembersReturn()

Forms return list of groupAddAssign function

hasGenotype()

Check for genotype data in dataframe

hasBothParents()

hasBothParents checks to see if both parents are identified.

headerDisplayNames()

Convert internal column names to display or header names.

initializeHaremGroups()

Make the initial groupMembers animal list

insertChangedColsTab()

insertChangedColsTab insert a list of changed columns found by qcStudbook in the pedigree file

insertErrorTab()

insertErrorTab insert a list of errors found by qcStudbook in the pedigree file

insertSeparators()

insertSeparators inserts the character "-" between year and month and between month and day portions of a date string in %Y%m%d format.

isEmpty()

Is vector empty or all NA values.

is_valid_date_str()

Returns TRUE if the string is a valid date.

kinship()

Generates a kinship matrix.

makeAvailable()

Convenience function to make the initial available animal list

makeCEPH()

Make a CEPH-style pedigree for each id

makeExamplePedigreeFile()

Write copy of nprcgenekeepr::examplePedigree into a file

makeGroupMembers()

Convenience function to make the initial groupMembers animal list

makeGrpNum()

Convenience function to make the initial grpNum list

makeRelationClassesTable()

Make relation classes table from kin dataframe.

makeRoundUp()

Round up the provided integer vector int according to the modulus.

makesLoop()

makesLoop tests for a common ancestor.

mapIdsToObfuscated()

Map IDs to Obfuscated IDs

meanKinship()

Calculates the mean kinship for each animal in a kinship matrix

offspringCounts()

Finds the total number of offspring for each animal in the pedigree

obfuscateDate()

obfucateDate adds a random number of days bounded by plus and minus max delta

obfuscateId()

obfucateId creates a vector of ID aliases of specified length

obfuscatePed()

obfuscatePed takes a pedigree object and creates aliases for all IDs and adjusts all date within a specified amount.

orderReport()

Order the results of the genetic value analysis for use in a report.

print(<summary.nprcgenekeeprErr>) print(<summary.nprcgenekeeprGV>)

print.summary.nprcgenekeepr print.summary.nprcgenekeeprGV

qcStudbook()

Quality Control for the Studbook or pedigree

rankSubjects()

Ranks animals based on genetic value.

rbindFill()

Append the rows of one dataframe to another.

removeGroupIfNoAvailableAnimals()

Remove group numbers when all available animals have been used

removeSelectedAnimalFromAvailableAnimals()

Updates list of available animals by removing the selected animal

kinMatrix2LongForm()

Reformats a kinship matrix into a long-format table.

readExcelPOSIXToCharacter()

Read in Excel file and convert POSIX dates to character

removeDuplicates()

Remove duplicate records from pedigree

removeEarlyDates()

removeEarlyDates removes dates before a specified year

removePotentialSires()

Removes potential sires from list of Ids

removeUninformativeFounders()

Remove uninformative founders.

removeUnknownAnimals()

removeUnknownAnimals Removes unknown animals added to pedigree that serve as placeholders for unknown parents.

reportGV()

Generates a genetic value report for a provided pedigree.

resetGroup()

Update or add the "group" field of a Pedigree.

runGeneKeepR()

Allows running shiny application with nprcgenekeepr::runGeneKeepR()

saveDataframesAsFiles()

Write copy of dataframes to either CSV, TXT, or Excel file.

setPopulation()

Population designation function

getSexRatioWithAdditions()

getSexRatioWithAdditions returns the sex ratio of a group.

setExit()

Sets the exit date, if there is no exit column in the table

set_seed()

Work around for unit tests using sample() among various versions of R

str_detect_fixed_all()

Returns a logical vector with results of stri_detect() for each pattern in second parameters character vector.

summary(<nprcgenekeeprErr>) summary(<nprcgenekeeprGV>)

summary.nprcgenekeeprErr Summary function for class nprcgenekeeprErr

toCharacter()

Force dataframe columns to character

trimPedigree()

Trim pedigree to ancestors of provided group by removing uninformative individuals

unknown2NA()

Removing IDs having "UNKNOWN" regardless of case

withinIntegerRange()

Get integer within a range