Skip to contents

Returns the rows of a pedigree that draw one maternal line of makeColonyOverview: every animal of the line plus the sires of those animals. Pass the rows to makePedigreeMatingLayout and drawPedigreeDiagram to draw the line, as the Pedigree Browser's colony overview does when a line is clicked.

Usage

getMaternalLinePedigree(ped, line)

Arguments

ped

a pedigree data frame with id, sire and dam columns, such as qcStudbook returns. To draw the rows, it also needs the sex and gen columns makePedigreeMatingLayout reads.

line

the id of the line's founding dam: one of the line values of makeColonyOverview. A line of any size may be given, not only a drawn one.

Value

A data frame: the rows of ped for the line's animals and their sires, with the same columns.

Details

An animal's maternal line is found as makeColonyOverview finds it: its dams are followed back to the earliest one in the pedigree, the founding dam, whose id names the line. A sire is added when he has a row in the pedigree, generated unknown-parent ids (see addUIds) included; dams outside the line are not added.

The rows are kept in the pedigree's order and numbered afresh. A sire or dam that is not among them is set to NA, so the rows stand alone as a pedigree. Every other column, gen included, is kept as it is.

Examples

library(nprcgenekeepr)
ped <- nprcgenekeepr::examplePedigree
overview <- makeColonyOverview(ped)
rows <- getMaternalLinePedigree(ped, overview$lines$line[[1L]])
nrow(rows)
#> [1] 49
layout <- makePedigreeMatingLayout(rows)
drawPedigreeDiagram(layout)