merge_zres: Merge several zres objects generated by zoorun

View source: R/zooroh_accessor.R

merge_zresR Documentation

Merge several zres objects generated by zoorun

Description

The function is used for example when the analysis has been split in several tasks. All the zres must come from the same original zoodata (zoorun is applied to the same zoodata with the same model). In addition, the data should not overlap (the same individual, or the same pair in an IBD analysis, should not be present in multiple zres).

Usage

merge_zres(list_zres)

Arguments

list_zres

A list with the name of the zres objects to be merged.

Details

The function works both for a standard (HBD) analysis and for an IBD analysis (zoorun run with ibd = TRUE), and detects automatically which one it is from the format of @sampleids. For a standard analysis, @ids are kept unchanged (they are absolute, stable positions in the original zoodata file) and only sorted, exactly as before. For an IBD analysis, @ids are only local to each zoorun() call and are therefore not comparable across the different zres objects being merged: the merged pairs are re-sorted numerically on (id1, hap1, id2, hap2) - or alphabetically if identifiers are not numeric - and @ids are reassigned as new, globally consistent numbers.

Value

a single zres object containing the results from the merged zres objects. Note that the HBD/IBD segments are not sorted by ID number.


RZooRoH documentation built on Oct. 3, 2026, 1:06 a.m.