slurp_spip: Read in the pedigree, census, and sampling information from...

View source: R/slurp_spip.R

slurp_spipR Documentation

Read in the pedigree, census, and sampling information from the spip run

Description

This function is run after run_spip(). It assumes that run_spip() has left the files: spip_pedigree.tsv, spip_prekill_census.tsv, and spip_samples.tsv, spip_postkill_census.tsv, spip_deaths.tsv, spip_genotypes.tsv, and spip_migrants.tsv inside the directory where run_spip() was run.

Usage

slurp_spip(
  dir,
  num_generations,
  read_pedigree_file = TRUE,
  find_ancestors_and_relatives = TRUE
)

Arguments

dir

the path to the directory where spip was run. This is returned by run_spip().

num_generations

how many generations back do you wish to consider for find relatives of each sampled individual. 0 means just the individual themselves (so, not very interesting, and you likely wouldn't ever use it. 1 means up to and including the parents; 2 means up to and including the grandparents; 3 means up to and including the great grandparents; and so forth.

read_pedigree_file

A logical. If TRUE, this function reads the pedgigree file and returns the pedigree in the output. If FALSE the function does not read the pedigree file and merely returns an empty tibble for the pedigree component of the return object. Note that if this is FALSE, the output will not have the information required for some functions like count_and_plot_mate_distribution(), which might fail. This option is intended for the case where the pedigree file is not written out by the simulation software.

find_ancestors_and_relatives

A logical indicating whether this function should read in the complete pedigree of the population and process it to find ancestors and relatives amongst the sampled individuals using the pedigree file (TRUE). Or whether it should not do that (FALSE). If option read_pedigree_file is FALSE, then this must also be FALSE.

Details

For an example of its use, see the Vignette: vignette("species_1_simulation", package = "CKMRpop").

Value

A list of tibbles. Each tibble is a named component of the return list. The names are as follows:

  • pedigree

  • census_prekill,

  • census_postkill,

  • samples,

  • deaths,

  • genotypes,

  • migrants

You can inspect some example output in the package data object three_pops_with_mig_slurped_results

Examples

# see Vignette: vignette("species_1_simulation", package = "CKMRpop")

eriqande/CKMRpop documentation built on Jan. 25, 2024, 2:10 p.m.