Learn R Programming

hsphase (version 3.0.0)

.fixBothStrand: Fix conflicting allele assignments on both haplotype strands

Description

Internal helper that scans a haplotype/strand matrix in *pairs of rows* (two rows per individual/segment) and detects loci where **both rows in a pair are non-zero**. Such positions are treated as conflicting assignments and are replaced with the sentinel value `100` on *both* rows of the pair.

Usage

.fixBothStrand(groups)

Value

A numeric matrix with the same dimensions as groups. For each row-pair and column:

  • if both entries are non-zero, both are set to `100`;

  • otherwise, the original values are preserved.

Arguments

groups

A numeric matrix with an **even number of rows**. Rows are interpreted in pairs: rows 1,2 form the first pair, 3,4 the second, and so on. Columns represent markers/positions. Values are typically strand/allele codes; `0` is treated as "unknown/empty", and any non-zero value indicates an assigned state.

Details

This function is a thin R wrapper around the native routine fixBothStrand implemented in C++ and called via .Call().

The sentinel value `100` is used downstream as an indicator of an unresolvable conflict between the two strands at that position.

See Also

aio, ssp, bmh for the main hsphase workflow where strand/haplotype matrices are produced and refined.