
Group a colony into maternal lines and the links between them
Source:R/makeColonyOverview.R
makeColonyOverview.RdPuts 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.
Arguments
- ped
a pedigree data frame with
id,sireanddamcolumns, and optionally astatusorexitcolumn, such asqcStudbookreturns.- 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:
linesa 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,livingandlinkedLines(how many other drawn lines it is linked to).linksa data frame with one row per pair of linked lines:
line1andline2(line1sorts first),young(the young sired across the pair, both ways),young1in2(young inline2whose sires are inline1) andyoung2in1.animalsa data frame with one row per pedigree row, in the pedigree's order:
idandline(NAfor a generated unknown-parent id).smallerLinesa data frame with one row: the number of smaller lines (
lines), theiranimals, how many of those have no recorded parent and no offspring (noRelatives), and how many areliving.minLineSizethe
minLineSizeused, 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