Skip to contents

Puts each animal of a pedigree in its maternal line and counts, for the lines large enough to draw, their animals, their living animals and the links between lines. drawColonyOverview draws the result: a view of a whole colony, for one too large for the Pedigree Browser's Diagram.

Usage

makeColonyOverview(ped, minLineSize = 10L)

Arguments

ped

a pedigree data frame with id, sire and dam columns, and optionally a status or exit column, such as qcStudbook returns.

minLineSize

the fewest animals a line needs to be drawn: one whole number, 1 or more. The default is 10.

Value

A list of five:

lines

a data frame with one row per drawn line, sorted by founding dam id (the same order in every locale): line (the founding dam's id), animals, living and linkedLines (how many other drawn lines it is linked to).

links

a data frame with one row per pair of linked lines: line1 and line2 (line1 sorts first), young (the young sired across the pair, both ways), young1in2 (young in line2 whose sires are in line1) and young2in1.

animals

a data frame with one row per pedigree row, in the pedigree's order: id and line (NA for a generated unknown-parent id).

smallerLines

a data frame with one row: the number of smaller lines (lines), their animals, how many of those have no recorded parent and no offspring (noRelatives), and how many are living.

minLineSize

the minLineSize used, as an integer.

Details

An animal's maternal line is found by following its dams back to the earliest one in the pedigree, the founding dam, whose id names the line. An animal whose dam is missing, is not in the pedigree, or is a generated unknown-parent id (see addUIds) founds its own line. The generated ids belong to no line and are counted nowhere.

A line of minLineSize or more animals is drawn; the others are counted together as the smaller lines. Two drawn lines are linked when a sire in one fathered young in the other, and the link counts those young in each direction.

The living animals are those whose status is ALIVE. A pedigree with no status column counts those with no exit date, and one with neither column counts every animal.

Examples

library(nprcgenekeepr)
overview <- makeColonyOverview(nprcgenekeepr::examplePedigree)
head(overview$lines)
#>     line animals living linkedLines
#> 1 08CF4C      25      0           0
#> 2 4Z1FJ6      99     24          17
#> 3 5D0XXP     176     27          15
#> 4 6CX836      15      1           8
#> 5 9G1M77      31      0           0
#> 6 BTWLYN      32      0           0
head(overview$links)
#>    line1  line2 young young1in2 young2in1
#> 1 4Z1FJ6 5D0XXP    19        10         9
#> 2 4Z1FJ6 6CX836     4         0         4
#> 3 4Z1FJ6 D4B0RM     2         2         0
#> 4 4Z1FJ6 FJL8ZR     8         8         0
#> 5 4Z1FJ6 G5SZDC    10        10         0
#> 6 4Z1FJ6 HHFN1E     2         2         0
overview$smallerLines
#>   lines animals noRelatives living
#> 1   270     294         255      4