plot_table {wpeR} | R Documentation |
Prepares pedigree data for plotting and spatial representation
Description
Combines extended pedigree (obtained by org_fams()
function)
and sample metadata data for visual (ped_satplot()
) and spatial
(ped_spatial()
) representation of the pedigree.
Usage
plot_table(
plot_fams = "all",
all_fams,
ped,
sampledata,
datacolumns = c("Sample", "AnimalRef", "GeneticSex", "Date", "SType", "lat", "lng",
"FirstSeen", "LastSeen", "IsDead"),
deadSample = c("Tissue")
)
Arguments
plot_fams |
Character string or numeric vector. FamID numbers from |
all_fams |
Data frame. Family ( |
ped |
Data frame. Organized pedigree ( |
sampledata |
Data frame. Metadata for all genetic samples that belong
to the individuals included in pedigree reconstruction analysis.
For description of |
datacolumns |
Vector of column names included |
deadSample |
Single value or vector of different lethal sample types. Defaults to c("Tissue"). |
Details
-
sampledata
has to include columns that contain information on:unique identifier of each sample; character or numeric (default column name =
Sample
, seecheck_sampledata()
function),date of sample collection in
Date
format (default =Date
),assignment of sample to particular individual; character or numeric (default =
AnimalRef
, seecheck_sampledata()
function),sex of the animal coded as
F
,M
orNA
; character (default =GeneticSex
, seecheck_sampledata()
function),longitude and latitude coordinates of sample collection location; numeric (default =
lng
andlat
, seecheck_sampledata()
function),type of particular sample eg. scat, tissue, saliva; character (default =
SType
, seecheck_sampledata()
function),date of first and last sample of individual in
Date
format (default =FirstSeen
andLastSeen
, seeanim_timespan()
function),value identifying if if the individual is dead; logical (default =
IsDead
, seeanim_timespan()
function).
Value
Extended sampledata
data frame that includes all columns defined in datacolumns
parameter and adds information needed for visual and spatial representation of
pedigree:
-
plottingID
: Numeric. Identifier number for temporal pedigree plotped_satplot()
. In case of polygamous animals same individual can be included in more than one family. -
FamID
: Numeric. Identifier number of family that individual belongs to. -
hsGroup
: Numeric. Identifier number for the half-sib group of individual. -
rep
: Logical. Is individual reproductive in current family, (current family defined withFamID
for a particular entry). -
later_rep
: Logical. Is individual reproductive in any other (later) families. -
isPolygamous
: Logical. Does the individual have more than one mate. -
dead
: Logical. Is individual dead. -
first_sample
: Logical. Is this particular sample the first sample of the individual. -
last_sample
: Logical. Is this particular sample the last sample of the individual. -
isReference
: Logical. Is this particular sample reference sample of individual.
Examples
# Prepare the data for usage with plot_table() function.
# Get animal timespan data using the anim_timespan() function.
animal_ts <- anim_timespan(wolf_samples$AnimalRef,
wolf_samples$Date,
wolf_samples$SType,
dead = c("Tissue")
)
# Add animal timespan to the sampledata
sampledata <- merge(wolf_samples, animal_ts, by.x = "AnimalRef", by.y = "ID", all.x = TRUE)
# Define the path to the pedigree data file.
path <- paste0(system.file("extdata", package = "wpeR"), "/wpeR_samplePed")
# Retrieve the pedigree data from the get_colony function.
ped_colony <- get_colony(path, sampledata, rm_obsolete_parents = TRUE, out = "FamAgg")
# Organize families and expand pedigree data using the org_fams function.
org_tables <- org_fams(ped_colony, sampledata, output = "both")
# Run the function
# Prepare data for plotting.
plot_table(plot_fams = "all",
org_tables$fams,
org_tables$ped,
sampledata,
deadSample = c("Tissue")
)