sim_completeness: This function computes the completeness of a haplotype

View source: R/sim_completeness.R

sim_completenessR Documentation

This function computes the completeness of a haplotype

Description

This function computes the completeness of a haplotype by finding the number of NAs and then dividing the number of NAs by the total number of genotypes or SNPs in the haplotype Finally, we subtract this ratio from 1 to find the ratio of complete or non-NA genotypes in the hapltoype. Note that this function works for a single vector/haplotype or for a matrix with multiple haplotypes. In the first case, we return a single value. In the latter case, we return a vector of values.

Usage

sim_completeness(predicted, num_snps)

Arguments

predicted

the rhapsodi predicted haplotype vector or haplotypes matrix/data frame where genotypes are 0/1 encoded

num_snps

an integer, the number of SNPs or the length of the haplotype

Value

to_return the completeness of the input. If predicted is a vector, to_return is a numeric. else if predicted is 2-dimensional, to_return is a vector of numerics


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