Runs the local Digital Twin Test using the TDT test statistc. This test determines if there is a causal SNP somewhere in a specified windown, after accounting for all genetic variant outside the window.

conditional_tdt(sample, haps_matrix, snp_info, group, site, gen_map,
  n_reps = 500, exact = FALSE)

Arguments

sample

A dataframe in .sample format. sample$father gives the index of the father in the haps_matrix, and the sample$mother gives the index of the the mother in the haps_matrix.

haps_matrix

A n x p matrix of 0-1. Each row represents one haplotypes. To convert from indices to haplotype indices, an entry i in sample$father corresponds to the two rows 2*i - 1 and 2*i in haps_matrix.

snp_info

A dataframe with 5 columns: chromosome, snp_name, position, variant_1, and variant_2 (column naming is ignored).

group

A vector of entries specifying the group to test. Must be a vector of the form j:k for some j > 0 and k < p + 1.

site

The index of a column of haps_matrix to test. This is analagous to the variant tested by the TDT.

gen_map

Genetic map: a dataframe contining at least columns "pposition" and "gposition".

n_reps

Number of repetions of the randomization test.

exact

Whether or not to include the finite-sample correction.

Value

A p-value.

Details

This function is not intented to be called repeatedly for different variants. Significant computational speedups would be possible in that case.