| read_ibd {skater} | R Documentation | 
Read IBD segment file
Description
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) 
Usage
read_ibd(file, source)
Arguments
| file | Input file path | 
| source | Source of the input file; must be one of  | 
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:
- 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) 
References
https://github.com/browning-lab/hap-ibd#output-files
https://github.com/williamslab/ped-sim#output-ibd-segments-file
Examples
hapibd_fp <- system.file("extdata", "GBR.sim.ibd.gz", package="skater", mustWork=TRUE)
hapibd_seg <- read_ibd(hapibd_fp, source = "hapibd")
pedsim_fp <- system.file("extdata", "GBR.sim.seg.gz", package="skater", mustWork=TRUE)
pedsim_seg <- read_ibd(pedsim_fp, source = "pedsim")