run_hmm: A function that assigns the position in each gamete to the...

View source: R/run_hmm.R

run_hmmR Documentation

A function that assigns the position in each gamete to the correct donor haplotype

Description

This function walks along each gamete and replaces the original observation with the inferred state. If the number of original observations is 0 or 1, the viterbi algorithm is not called, as there is no "path" to evaluate. If only one observation, we assign the one observation as the inferred state If no observations, we assign an inferred state of NA, such that the inferred state (NA) simply matches the original observations (which were also NA in this situation) This replaces any incorrect haplotype assignments (e.g., due to sequencing error).

Usage

run_hmm(dt, column_index, hmm)

Arguments

dt

Matrix of gametes with 0 and 1

column_index

apply function cycles through gamete_dt to act on each column (i.e., each gamete)

hmm

the HMM that viterbi will be applied on

Value

original_obs Replaced observed haplotype with that assigned by the model


mccoy-lab/rhapsodi documentation built on July 27, 2022, 3:56 a.m.