Esempio n. 1
0
def calculate_ld_stats(snp1, snp2, samples=None):
    calls1 = choose_samples(snp1.record, sample_names=samples)
    calls2 = choose_samples(snp2.record, sample_names=samples)
    haplo_counts = _count_biallelic_haplotypes(calls1, calls2)
    fisher = _fisher_exact(haplo_counts)
    rsqr = _calculate_r_sqr(haplo_counts)
    return LDStats(fisher, rsqr)
Esempio n. 2
0
def calculate_r_sqr(snp1, snp2, samples=None):
    calls1 = choose_samples(snp1.record, sample_names=samples)
    calls2 = choose_samples(snp2.record, sample_names=samples)
    haplo_counts = _count_biallelic_haplotypes(calls1, calls2)

    if haplo_counts is None:
        return None
    return _calculate_r_sqr(haplo_counts)
Esempio n. 3
0
def fisher_exact(snp1, snp2, samples=None):
    calls1 = choose_samples(snp1.record, sample_names=samples)
    calls2 = choose_samples(snp2.record, sample_names=samples)
    haplo_counts = _count_biallelic_haplotypes(calls1, calls2)
    return _fisher_exact(haplo_counts)