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:
First sample identifier
First sample haplotype index (1 or 2)
Second sample identifier
Second sample haplotype index (1 or 2)
Chromosome
Base coordinate of first marker in segment
Base coordinate of last marker in segment
cM length of IBD segment
If read a pedsim segment file, the input data should have the following columns:
First sample identifier
Second sample identifer
Chromosome
Physical position start
Physical position end
IBD type
Genetic position start
Genetic position end
Genetic length (end - start)
read_ibd(file, source)Input file path
Source of the input file; must be one of "hapibd" or "pedsim"
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:
id1 (sample identifier 1)
id2 (sample identifier 2)
chr (chromosome)
start (segment bp start coordinate)
end (segment bp end coordinate)
length (shared segment length in genetic units, cM)
https://github.com/browning-lab/hap-ibd#output-files
https://github.com/williamslab/ped-sim#output-ibd-segments-file
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")