Ejemplo n.º 1
0
def test_emit_internal():
    """
    Calculate emission probabilities for internal branches
    """

    k = 10
    n = 1e4
    rho = 1.5e-8 * 20
    mu = 2.5e-8 * 20
    length = int(10e3) / 20
    times = argweaver.get_time_points(ntimes=20, maxtime=200000)

    arg = argweaver.sample_arg_dsmc(k,
                                    2 * n,
                                    rho,
                                    start=0,
                                    end=length,
                                    times=times)

    muts = argweaver.sample_arg_mutations(arg, mu, times)
    seqs = argweaver.make_alignment(arg, muts)

    trees, names = argweaverc.arg2ctrees(arg, times)
    seqs2, nseqs, seqlen = argweaverc.seqs2cseqs(seqs, names)

    assert argweaverc.argweaver_assert_emit_internal(trees, len(times), times,
                                                     mu, seqs2, nseqs, seqlen)
Ejemplo n.º 2
0
def test_emit():
    """
    Calculate emission probabilities
    """

    k = 10
    n = 1e4
    rho = 1.5e-8 * 20
    mu = 2.5e-8 * 20
    length = int(1e3) / 20
    times = argweaver.get_time_points(ntimes=20, maxtime=200000)

    arg = argweaver.sample_arg_dsmc(k,
                                    2 * n,
                                    rho,
                                    start=0,
                                    end=length,
                                    times=times)

    muts = argweaver.sample_arg_mutations(arg, mu, times)
    seqs = argweaver.make_alignment(arg, muts)

    new_name = "n%d" % (k - 1)
    arg = argweaver.remove_arg_thread(arg, new_name)

    trees, names = argweaverc.arg2ctrees(arg, times)
    seqs2, nseqs, seqlen = argweaverc.seqs2cseqs(seqs, names + [new_name])

    assert argweaverc.argweaver_assert_emit(trees, len(times), times, mu,
                                            seqs2, nseqs, seqlen)
Ejemplo n.º 3
0
def test_emit():
    """
    Calculate emission probabilities
    """

    k = 10
    n = 1e4
    rho = 1.5e-8 * 20
    mu = 2.5e-8 * 20
    length = int(1e3) / 20
    times = argweaver.get_time_points(ntimes=20, maxtime=200000)

    arg = argweaver.sample_arg_dsmc(k, 2*n, rho, start=0, end=length,
                                    times=times)

    muts = argweaver.sample_arg_mutations(arg, mu, times)
    seqs = argweaver.make_alignment(arg, muts)

    new_name = "n%d" % (k-1)
    arg = argweaver.remove_arg_thread(arg, new_name)

    trees, names = argweaverc.arg2ctrees(arg, times)
    seqs2, nseqs, seqlen = argweaverc.seqs2cseqs(seqs, names + [new_name])

    assert argweaverc.argweaver_assert_emit(trees, len(times), times, mu,
                                            seqs2, nseqs, seqlen)
Ejemplo n.º 4
0
def test_emit_internal():
    """
    Calculate emission probabilities for internal branches
    """

    k = 10
    n = 1e4
    rho = 1.5e-8 * 20
    mu = 2.5e-8 * 20
    length = int(10e3) / 20
    times = argweaver.get_time_points(ntimes=20, maxtime=200000)

    arg = argweaver.sample_arg_dsmc(k, 2*n, rho, start=0, end=length,
                                    times=times)

    muts = argweaver.sample_arg_mutations(arg, mu, times)
    seqs = argweaver.make_alignment(arg, muts)

    trees, names = argweaverc.arg2ctrees(arg, times)
    seqs2, nseqs, seqlen = argweaverc.seqs2cseqs(seqs, names)

    assert argweaverc.argweaver_assert_emit_internal(
        trees, len(times), times, mu, seqs2, nseqs, seqlen)