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 with "hsp2" class and 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.

Examples

set.seed(666)
result = tekka("-y20 -l2 --sa 2,2 --sj 2,2")
samples = result$sample_family[[1L]]
as_hsp2(samples)
#> # A tibble: 66 × 8
#>    cohort_i cohort_j capture_age_i capture_age_j location_i location_j comps
#>       <int>    <int>         <int>         <int>      <int>      <int> <int>
#>  1       11       11             8             9          1          1     1
#>  2       15       15             4             5          0          1     1
#>  3       19       19             0             0          0          0     1
#>  4        9        9            10            10          1          1     0
#>  5        9       11            10             8          1          1     1
#>  6        9       11            10             9          1          1     1
#>  7        9       14            10             5          1          0     1
#>  8        9       15            10             4          1          0     1
#>  9        9       15            10             5          1          1     1
#> 10        9       16            10             4          1          0     2
#> # ℹ 56 more rows
#> # ℹ 1 more variable: hsps <int>