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)
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)
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)
def test_arg_joint(): """ Compute joint probability of an ARG """ k = 2 n = 1e4 rho = 1.5e-8 * 20 mu = 2.5e-8 * 20 length = 10000 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=times) seqs = arglib.make_alignment(arg, muts) lk = argweaver.calc_joint_prob(arg, seqs, mu=mu, rho=rho, times=times) print lk
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)