def test_codon_positions_4fold_degen(self): """codon_positions correctly return fourfold degenerate bases""" # **4---**4--- aln = make_aligned_seqs(data=[("a", "GCAAGCGTTTAT"), ("b", "GCTTTTGTCAAT")], moltype=DNA) expect = dict([("a", "AT"), ("b", "TC")]) ffold = sample.take_codon_positions(fourfold_degenerate=True) got = ffold(aln) self.assertEqual(got.to_dict(), expect) # error if no moltype with self.assertRaises(AssertionError): _ = sample.take_codon_positions(moltype=None)
def _get_all_composables(tmp_dir_name): test_model1 = evo.model("HKY85") test_model2 = evo.model("GN") test_hyp = evo.hypothesis(test_model1, test_model2) test_num_reps = 100 applications = [ align.align_to_ref(), align.progressive_align(model="GY94"), evo.ancestral_states(), evo.bootstrap(hyp=test_hyp, num_reps=test_num_reps), evo.hypothesis(test_model1, test_model2), evo.model("GN"), evo.tabulate_stats(), sample.fixed_length(100), sample.min_length(100), io.write_db(tmp_dir_name, create=True), io.write_json(tmp_dir_name, create=True), io.write_seqs(tmp_dir_name, create=True), sample.omit_bad_seqs(), sample.omit_degenerates(), sample.omit_duplicated(), sample.take_codon_positions(1), sample.take_named_seqs(), sample.trim_stop_codons(gc=1), translate.select_translatable(), tree.quick_tree(), tree.scale_branches(), tree.uniformize_tree(), ] return applications
def _get_all_composable_apps(): applications = [ align.align_to_ref(), align.progressive_align(model="GY94"), sample.fixed_length(100), sample.min_length(100), io.write_seqs(os.getcwd()), sample.omit_bad_seqs(), sample.omit_degenerates(), sample.take_codon_positions(1), sample.take_named_seqs(), sample.trim_stop_codons(gc=1), ] return applications
def _codon_positions(self, array_align): """correctly return codon positions""" aln = make_aligned_seqs(data=[("a", "ACGACGACG"), ("b", "GATGATGAT")], array_align=array_align) one = sample.take_codon_positions(1) got = one(aln) self.assertEqual(got.to_dict(), {"a": "AAA", "b": "GGG"}) two = sample.take_codon_positions(2) got = two(aln) self.assertEqual(got.to_dict(), {"a": "CCC", "b": "AAA"}) three = sample.take_codon_positions(3) got = three(aln) self.assertEqual(got.to_dict(), {"a": "GGG", "b": "TTT"}) one_two = sample.take_codon_positions(1, 2) got = one_two(aln) self.assertEqual(got.to_dict(), {"a": "ACACAC", "b": "GAGAGA"}) one_three = sample.take_codon_positions(1, 3) got = one_three(aln) self.assertEqual(got.to_dict(), {"a": "AGAGAG", "b": "GTGTGT"}) two_three = sample.take_codon_positions(2, 3) got = two_three(aln) self.assertEqual(got.to_dict(), {"a": "CGCGCG", "b": "ATATAT"})