Skip to contents

The extended version of HSP format with additional columns for grouping.

Usage

as_hsp2(samples)

write_hsp2(x, path = "hsp2.tsv")

read_hsp2(path)

Arguments

samples

A sample_family data.frame of tekka() result.

x

An outcome of as_hsp2().

path

A file name or connection to write to.

Value

A data.frame of "hsp2" subclass with the following columns:

  • cohort_i, cohort_j: birth year of samples

  • capture_age_i, capture_age_j: of samples

  • location_i, location_j: of sampling

  • comps: the number of possible comparisons between group i and j. All samples are compared pairwise, excluding self-comparisons. The total number of comparisons equals \(n \choose 2\), where n is the total sample size.

  • hsps: the count of half-sib pairs observed between group i and j

See also

as_hsp() for the original HSP format.

find_kinship() to count kinship within samples.

Examples

set.seed(666)
result = tekka("-y25 -l2 --sa 2,2 --sj 2,2")
samples = result$sample_family[[1L]]
as_hsp2(samples)
#> # A tibble: 55 × 8
#>    cohort_i cohort_j capture_age_i capture_age_j location_i location_j comps
#>       <int>    <int>         <int>         <int>      <int>      <int> <int>
#>  1       14       15            10             9          1          1     1
#>  2       20       20             4             5          0          0     2
#>  3       24       24             0             0          1          1     1
#>  4       24       25             0             0          0          1     4
#>  5       25       25             0             0          1          1     1
#>  6       14       14            10            10          1          1     0
#>  7       14       18            10             7          1          1     2
#>  8       14       20            10             4          1          0     2
#>  9       14       20            10             5          1          0     1
#> 10       14       21            10             4          1          0     1
#> # ℹ 45 more rows
#> # ℹ 1 more variable: hsps <int>