Skip to contents

Analyze kinship within samples

Usage

find_kinship(samples, order = 4L, experimental = FALSE)

Arguments

samples

sample_family

order

integer

experimental

boolean

Value

A data.frame with the following columns:

  • from, to: sample IDs in integer.

  • path: text representation of the path found between samples; ascending with 1 and descending with 0; the count of the same paths is indicated by _n suffix; e.g., "10_1" and "10_2" means half-sibling and full-sibling pairs, respectively.

  • degree: the number of steps in the path.

  • label: aliases for the path. See https://github.com/heavywatal/tekkamaki/blob/main/data-raw/kinlabels.R for the available labels.

Details

find_kinship() finds kinship below given order.

See also

as_hsp() and as_hsp2() to find half-sibling pairs.

as_pop() and as_pop2() to find parent-offspring pairs.

Examples

set.seed(666)
result = tekka("-y20 -l2 --sa 2,2 --sj 2,2")
samples = result$sample_family[[1L]]
find_kinship(samples, order = 3L)
#> # A tibble: 20 × 5
#>     from    to path  degree label
#>    <int> <int> <chr>  <int> <fct>
#>  1     1     3 100_1      3 HUN  
#>  2     1    13 10_1       2 HS   
#>  3     2     4 100_1      3 HUN  
#>  4     2     8 100_1      3 HUN  
#>  5     3     4 10_1       2 HS   
#>  6     3     5 110_1      3 HUN  
#>  7     4     5 110_1      3 HUN  
#>  8     5     7 100_1      3 HUN  
#>  9     5     8 100_2      3 UN   
#> 10     6    10 110_2      3 UN   
#> 11     9    10 110_3      3 NA   
#> 12     9    14 10_1       2 HS   
#> 13     9    16 100_1      3 HUN  
#> 14    10    11 100_2      3 UN   
#> 15    10    14 100_2      3 UN   
#> 16    10    15 100_1      3 HUN  
#> 17    13     3 0_1        1 PO   
#> 18    13    10 110_1      3 HUN  
#> 19    14    15 100_1      3 HUN  
#> 20    14    16 0_1        1 PO