sim_add_seq_error: This function inverts a bit at random indices in effect...

View source: R/sim_add_seq_error.R

sim_add_seq_errorR Documentation

This function inverts a bit at random indices in effect adding sequencing error to data

Description

This function takes as input a matrix and carries over its inverted data to a vector and its original data to a second vector After subsetting for just non-NA locations, the number of available genotypes to change is multiplied by the sequencing error rate to find the number of bits to flip Then these number of random (non NA) indices are sampled and the inverted bit data is used to replace the original input data in these locations Finallly, this data with the introduced sequencing errors is reshaped to a matrix of equal dimension and size as the input and returned

Usage

sim_add_seq_error(num_snps, num_gametes, seqError_add, gam_mat_with_na)

Arguments

num_snps

an integer; the number of snps or the number of rows of the input and output

num_gametes

an integer; the number of gametes or the number of columns of the input and output

seqError_add

a numeric; the sequencing error rate

gam_mat_with_na

a matrix; the input sparsified gamete data with nrow of num_snps and ncol of num_gametes

Value

gam_mat_with_na a matrix; reflecting the input with num_bits_to_flip inverted bits with nrow of num_snps and ncol of num_gametes


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