Reads in the inferred IBD segments from hapibd (documentation) or IBD segment file generated by ped-sim (documentation).

If reading a hapibd segment file, the input data should have the following columns:

  1. First sample identifier

  2. First sample haplotype index (1 or 2)

  3. Second sample identifier

  4. Second sample haplotype index (1 or 2)

  5. Chromosome

  6. Base coordinate of first marker in segment

  7. Base coordinate of last marker in segment

  8. cM length of IBD segment

If read a pedsim segment file, the input data should have the following columns:

  1. First sample identifier

  2. Second sample identifer

  3. Chromosome

  4. Physical position start

  5. Physical position end

  6. IBD type

  7. Genetic position start

  8. Genetic position end

  9. Genetic length (end - start)

read_ibd(file, source)

Arguments

file

Input file path

source

Source of the input file; must be one of "hapibd" or "pedsim"

Value

if source="hapibd", a tibble is returned. If source="pedsim", a list with two tibble elements, IBD1 and IBD2 is returned. Both the hapibd tibble, and the two pedsim tibbles contain six columns:

  1. id1 (sample identifier 1)

  2. id2 (sample identifier 2)

  3. chr (chromosome)

  4. start (segment bp start coordinate)

  5. end (segment bp end coordinate)

  6. length (shared segment length in genetic units, cM)

Examples

hapibd_fp <- system.file("extdata", "GBR.sim.ibd.gz", package="skater", mustWork=TRUE)
hapibd_seg <- read_ibd(hapibd_fp, source = "hapibd")
#> New names:
#>  `1` -> `1...2`
#>  `1` -> `1...4`
#>  `1` -> `1...5`
pedsim_fp <- system.file("extdata", "GBR.sim.seg.gz", package="skater", mustWork=TRUE)
pedsim_seg <- read_ibd(pedsim_fp, source = "pedsim")