# Genetic Tools for Colony Management

## Documentation for package ‘nprcgenekeepr’ version 2.0.0

- DESCRIPTION file
- User guides, package vignettes and other documentation
- Package NEWS
- Package README

## Help Pages

A C D E F G H I K L M O P Q R S T W

## -- A --

addAnimalsWithNoRelative | Add an NA value for animals with no relative
addBackSecondParents | Add back single parents trimmed pedigree
addGenotype | Add genotype data to pedigree file
addIdRecords | Add ego records with NA parent IDs
addParents | Add parents
addSexAndAgeToGroup | Build a group data frame with ID, sex, and age
addUIds | Add placeholder IDs for unknown parents
alleleFreq | Count each allele in a vector
applyKinshipOverrides | Apply outside-information kinship overrides to a kinship matrix
appServer | Main Application Server for nprcgenekeepr
appUI | Main Application UI for nprcgenekeepr
assignAlleles | Assign parent alleles randomly

## -- C --

calcA | Count each individual's rare alleles per simulation
calcAge | Calculate animal ages
calcFE | Calculate founder equivalents
calcFEFG | Calculate founder equivalents and founder genome equivalents
calcFG | Calculate founder genome equivalents
calcFGSE | Calculate the standard error of founder genome equivalents
calcGeneDiversity | Calculate gene diversity from founder genome equivalents
calcGU | Calculate genome uniqueness for each population ID
calcGUSE | Calculate the standard error of genome uniqueness
calcNeSexRatio | Calculate the demographic sex-ratio effective population size
calcNeVariance | Calculate the variance effective population size
calcRetention | Calculate allelic retention
calculateSexRatio | Calculate the sex ratio of a set of animals
checkChangedColsLst | Check a changed-columns list for non-empty fields
checkErrorLst | Check an error list for non-empty fields
checkGenotypeFile | Check genotype file
checkKinshipOverrides | Validate a kinship overrides table
checkParentAge | Check parent ages against a minimum age
checkRequiredCols | Check column names for required columns
chooseAlleles | Combine two allele vectors by Mendelian sampling
chooseDate | Choose the earlier or later of two dates
convertAncestry | Convert ancestry information to a standard code
convertDate | Convert character date columns to Date type
convertFromCenter | Convert from-center information to a logical value
convertRelationships | Convert pairwise kinship values to relationship categories
convertSexCodes | Convert a sex indicator to a standardized code
convertStatusCodes | Convert status indicators to a standardized code
correctParentSex | Correct the sex of animals listed as a sire or dam
countFirstOrder | Count first-order relatives
countKinshipValues | Count kinship-value occurrences across simulated pedigrees
countLoops | Count the number of loops in a pedigree tree
createExampleFiles | Create example pedigree and ID-list CSV files
createPedTree | Create a pedigree tree (PedTree)
createSimKinships | Build kinship matrices from simulated pedigrees
create_wkbk | Create an Excel workbook with worksheets
cumulateSimKinships | Compute kinship summary statistics across simulations

## -- D --

dataframe2string | Convert a data frame to a character vector

## -- E --

exampleNprcgenekeeprConfig | Example nprcgenekeepr configuration file (loadable)
examplePedigree | Example pedigree object (from ExamplePedigree.csv)

## -- F --

fillGroupMembersWithSexRatio | Form breeding groups to match a target sex ratio
filterKinMatrix | Filter a kinship matrix to selected IDs
filterPairs | Filter kinship pairs by the animals' sexes
filterReport | Filter a genetic value report to selected animals
filterThreshold | Filter out kinship pairs below a threshold
finalRpt | Genetic-value report list prior to ranking
findGeneration | Determine the generation number for each ID
findLoops | Find loops in a pedigree tree
findOffspring | Count total offspring for each animal
findPedigreeNumber | Determine the pedigree number for each ID
fixColumnNames | Standardize pedigree column names
focalAnimals | Focal animal IDs from examplePedigree

## -- G --

geneDrop | Simulate gene dropping through a pedigree
getAncestors | Recursively collect an individual's ancestors
getAnimalsWithHighKinship | List each animal's high-kinship relatives
getAutoIdFormat | Get the auto-generated unknown-ID format
getBoxWhiskerDescription | Get Box and Whisker Plot Description
getChangedColsTab | Build the changed-columns tab panel
getConfigFileName | Get the configuration file name for the system
getCurrentAge | Calculate current age in years from a birth date
getDatedFilename | Prepend the date and time to a file name
getDateErrorsAndConvertDatesInPed | Find date errors and convert dates in a pedigree
getDemographics | Get demographic data
getDescendantPedigree | Reduce a pedigree to a group and its descendants
getEmptyErrorLst | Create an empty errorLst object
getErrorTab | Build the error-list tab panel
getFileDirectRelatives | Get the direct relatives of selected animals from a pedigree file
getFocalAnimalPed | Get pedigree based on list of focal animals
getFocalAnimalPedFromFile | Get a focal-animal pedigree from a pedigree file
getFounders | Get the founder ids from a pedigree
getGeneticDiversityStats | Assemble breeding-group genetic diversity heat-map statistics
getGenotypes | Get genotypes from file
getGVGenotype | Extract genotype data for a genetic value report
getGVPopulation | Get the population of interest for the Genetic Value analysis
getIdsWithOneParent | Get ids of animals with only one parent
getIncludeColumns | Get the superset of columns that can be in a pedigree file
getLkDirectAncestors | Get the direct ancestors of selected animals
getLkDirectRelatives | Get the direct relatives of selected animals from the LabKey EHR
getOffspring | Get offspring to corresponding animal IDs provided
getParents | Get parents to corresponding animal IDs provided
getPedDirectRelatives | Get the direct relatives of selected animals from a pedigree
getPedigree | Get pedigree from file
getPedMaxAge | Get the maximum age of any animal in the pedigree
getPossibleCols | Get possible column names for a studbook
getPotentialParents | Get potential parents for animals with unknown parents
getPotentialSires | List potential sires
getProbandPedigree | Reduce a pedigree to probands and their ancestors
getPyramidAgeDist | Get the age distribution for the pedigree
getPyramidPlot | Create an age-sex pyramid plot of a pedigree
getRequiredCols | Get required column names for a studbook
getSiteInfo | Get site information
getSpeciesGestation | Look up the maximum gestation period (days) for one or more species
getSpeciesMinBreedingAge | Look up the minimum breeding age (years) for one or more species and sexes
getTokenList | Get tokens from a character vector of lines
getVersion | Get the version number of nprcgenekeepr
get_and_or_list | Join a character vector into an and/or list
get_elapsed_time_str | Format the elapsed time since a start time
groupAddAssign | Add animals to a breeding group or form new groups
gvaConvergence | Recommend gene-drop iterations for a pedigree

## -- H --

hasBothParents | Check whether an animal has both parents
hasGenotype | Check for genotype data in dataframe
headerDisplayNames | Convert internal column names to display or header names

## -- I --

isFounder | Identify the founders in a pedigree
is_valid_date_str | Test whether a string is a valid date

## -- K --

kinMatrix2LongForm | Reformat a kinship matrix into long form
kinship | Generate a kinship matrix
kinshipMatricesToKValues | Build a kValue table from a list of kinship matrices
kinshipMatrixToKValues | Extract a kValue table from a kinship matrix

## -- L --

lacy1989Ped | Small hypothetical pedigree (Lacy 1989)
lacy1989PedAlleles | Gene-drop alleles for lacy1989Ped (5000 iterations)
loadSiteConfig | Load the site configuration for the modular Shiny application
loadSpeciesOverrides | Load user-configurable species reproductive-parameter overrides
logModuleEvent | Log module events

## -- M --

makeCEPH | Make a CEPH-style pedigree for each id
makeExamplePedigreeFile | Write copy of nprcgenekeepr::examplePedigree into a file
makeFounderStatsTable | Create Founder Statistics HTML Table
makeGeneticDiversityHeatmap | Make a genetic diversity heat map
makeGeneticSummaryTable | Create Genetic Summary Statistics HTML Table
makeGroupMembers | Make the initial groupMembers animal list
makeGroupNum | Make the initial grpNum list
makeGrpNum | Deprecated alias for makeGroupNum
makeRelationClassesTable | Make a relation classes table from kinship pairs
makeSimPed | Make a simulated pedigree from representative sires and dams
mapIdsToObfuscated | Map IDs to Obfuscated IDs
meanKinship | Calculate mean kinship for each animal in a kinship matrix
modBreedingGroupsServer | Breeding Groups Module - Server Function
modBreedingGroupsUI | Breeding Groups Module - UI Function
modGeneticDiversityServer | Genetic Diversity Module - Server Function
modGeneticDiversityUI | Genetic Diversity Module - UI Function
modGeneticValueServer | Genetic Value Analysis Module - Server Function
modGeneticValueUI | Genetic Value Analysis Module - UI Function
modGvAndBgDescServer | Genetic Value and Breeding Group Description Module - Server Function
modGvAndBgDescUI | Genetic Value and Breeding Group Description Module - UI Function
modInputServer | Data Input and Quality Control Module - Server Function
modInputUI | Data Input and Quality Control Module - UI Function
modORIPReportingServer | ORIP Reporting Module - Server Function
modORIPReportingUI | ORIP Reporting Module - UI Function
modPedigreeServer | Pedigree Browser Module - Server Function
modPedigreeUI | Pedigree Browser Module - UI Function
modPotentialParentsServer | Potential Parents Module - Server Function
modPotentialParentsUI | Potential Parents Module - UI Function
modPyramidServer | Age-Sex Pyramid Module - Server Function
modPyramidUI | Age-Sex Pyramid Module - UI Function
modSummaryStatsServer | Summary Statistics Module - Server Function
modSummaryStatsUI | Summary Statistics Module - UI Function

## -- O --

obfuscateDate | Obfuscate dates with a random day offset
obfuscateId | Create ID aliases of a specified length
obfuscatePed | Obfuscate a pedigree by aliasing IDs and shifting dates
offspringCounts | Tabulate offspring counts, optionally by population

## -- P --

ped1Alleles | Gene-drop alleles example (baboon pedigree)
pedDuplicateIds | Example studbook with a duplicated record
pedFemaleSireMaleDam | Example studbook with sex-mismatched parents
pedGood | Valid example studbook (no QC errors)
pedInvalidDates | Example studbook with invalid birth dates
pedMissingBirth | Example studbook missing the birth date column
pedOne | Raw pedigree-file fragment for testing (5 columns)
pedSameMaleIsSireAndDam | Example studbook with a male as both sire and dam
pedSix | Raw pedigree-file fragment for testing (7 columns)
pedWithGenotype | Pedigree with simulated genotypes (from qcPed)
pedWithGenotypeReport | Genetic-value report for pedWithGenotype
print.summary.nprcgenekeeprErr | Print an nprcgenekeepr summary object
print.summary.nprcgenekeeprGV | Print an nprcgenekeepr summary object
processQcStudbookResult | Process qcStudbook Result into UI-Friendly Format

## -- Q --

qcBreeders | Potential breeder IDs (29 baboons)
qcPed | Example quality-controlled baboon pedigree
qcPedGvReport | Genetic-value report for qcPed
qcStudbook | Run quality control on a studbook or pedigree

## -- R --

rankSubjects | Rank animals by genetic value
readKinshipOverrides | Read a kinship overrides table from a file
removeAutoGenIds | Remove automatically generated IDs from pedigree
removeDuplicates | Remove duplicate records from pedigree
removeEarlyDates | Remove dates before a specified year
removePotentialSires | Remove potential sires from a list of IDs
removeUninformativeFounders | Remove uninformative founders
removeUnknownAnimals | Remove placeholder animals added for unknown parents
reportGV | Generate a genetic value report for a pedigree
rhesusGenotypes | Rhesus genotypes (two haplotypes per animal)
rhesusPedigree | Obfuscated rhesus pedigree object
runGeneKeepR | Run the GeneKeepR Shiny Application
runModularApp | Run the Modular Version of GeneKeepR (Deprecated)
runQcStudbook | Run Quality Control on Studbook with UI-Friendly Results

## -- S --

safeExecute | Execute an expression with error handling
saveDataframesAsFiles | Write copy of dataframes to either CSV, TXT, or Excel file
savePlotToFile | Save Plot to File
setAutoIdFormat | Set the auto-generated unknown-ID format
setExit | Set the exit date when no exit column exists
setLabKeyDefaults | Configure Rlabkey authentication for the current session
setPopulation | Flag animals as the population of interest
set_seed | Set a reproducible RNG seed across R versions
shouldShowChangedColsTab | Determine if Changed Columns tab should be displayed
shouldShowOripTab | Determine if the ORIP Reporting tab should be displayed
smallPed | Hypothetical 17-animal pedigree
smallPedTree | Pedigree tree built from smallPed
speciesGestation | Per-species reproductive parameters
summarizeKinshipValues | Summarize imputed kinship values
summary.nprcgenekeeprErr | Summarize a studbook quality-control error list
summary.nprcgenekeeprGV | Summarize a studbook quality-control error list

## -- T --

toCharacter | Force dataframe columns to character
trimPedigree | Trim a pedigree to a group's ancestors

## -- W --

withinIntegerRange | Get integer within a range