Movatterモバイル変換


[0]ホーム

URL:


wpeR

wildpedigreeexplorerR is an R package designed tosimplify the analysis of wild pedigree data. The package was primarilydeveloped to work with pedigree data generated byCOLONYpedigree reconstruction software. However, it can also accommodatepedigree data from other sources. By combining the reconstructedpedigree with genetic sample metadata, wpeR creates visual and tabularrepresentations of the pedigree, allowing the user to interpret thepedigree in spatial and temporal terms. The main goal of the package isto provide an efficient solution for the analysis of complex wildpedigree data and to help the user to gain valuable insights intogenetic relationships within wild animal populations.

Installation

devtools::install_github("GR3602/wpeR")

Key Features

Input Data

The wpeR package requires two main input datasets for analysis:Pedigree andGenetic samplesmetadata.

Basic workflow

Function
call
order
FunctionDescription
1aget_colony()Organizes COLONY output
1bget_ped()Organizes pedigree data
2anim_timespan()Get dates of individuals first and last sample
3org_fams()Organizes animals into families and expands pedigree data
4plot_table()Prepares pedigree data for plotting and spatial representation
5.1ped_satplot()Temporal plot of pedigree
5.2ped_spatial()Get files for spatial representation of pedigree
####DATA PREPARATION##### 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")# 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 sampledatasampledata <- merge(wolf_samples, animal_ts, by.x = "AnimalRef", by.y = "ID", all.x = TRUE)# Organize families and expand pedigree data using the org_fams function.## families data framefams <- org_fams(ped_colony, sampledata, output = "fams")## extended pedigree data frameped <- org_fams(ped_colony,sampledata, output = "ped")# The example show just one family ## Prepare data for plotting.pt <- plot_table(plot_fams = 1,                 org_tables$fams,                 org_tables$ped,                 sampledata,                 deadSample = c("Tissue"))                 ####VISUALIZATION####                 ## Get a temporal pedigree plot.ped_satplot(plottable = pt)
image

EXAMPLE Visualization usingkinship2package

# optional pedigre plot pedigree plot from kinship2### extract parent codesparents1 = strsplit(fams[fams$FamID == 1,]$parents, "_")[[1]]### filter the family from pedigreFam1 = ped[(ped$FamID == 1 | ped$id %in% parents1),]### plot using kinship2 plot(kinship2::pedigree(Fam1$id, Fam1$father, Fam1$mother, Fam1$sex))
image
## Create spatial files<!-- ps <- ped_spatial(pt) -->summary(ps)
Object NameDescription
mother…RpointsPOINT object representing reference samples of each animal. Referencesample for parents is their first sample, reference sample for theoffspring is their last sample within the user defined time frame.
father…
offspring…
mother…MovePointsPOINT object representing all samples of a particular animal.
father…
offspring…
maternity…LinesLINESTRING object connecting reference samples of mothers or fatherswith reference samples of their offspring.
paternity…
mother…MoveLinesLINESTRING object connecting all samples of an individual inchronological order, showcasing the movement or changes in location overtime for the specific animal.
father…
offspring…
mother…MovePolygonPOLYGON object representing a convex hull that encloses all the samplesof an individual. It provides a graphical representation of the spatialextent or range covered by the animal based on its sample locations.
father…


EXAMPLE Using spatial files together withggplot2,basemapsandggsflabelfor spatial visualization.

image
Spatial representation usingmother/father/offspringRpoints and maternety/paternitylines
!image
Spatial representation usingmother/fatherRpoints/MovePoints/MoveLines

[8]ページ先頭

©2009-2025 Movatter.jp