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 test_bootstrap_composability(self): """can be composed with load_db and write_db""" m1 = evo_app.model("F81") m2 = evo_app.model("HKY85") hyp = evo_app.hypothesis(m1, m2) with TemporaryDirectory(dir=".") as dirname: path = join(dirname, "delme.tinydb") _ = io.load_db() + evo_app.bootstrap( hyp, num_reps=2) + io.write_db(path)
def test_bstrap_parallel(self): """exercising bootstrap with parallel""" aln = load_aligned_seqs(join(data_dir, "brca1.fasta"), moltype="dna") aln = aln.take_seqs(aln.names[:3]) aln = aln.omit_gap_pos(allowed_gap_frac=0) opt_args = dict(max_evaluations=20, limit_action="ignore") m1 = evo_app.model("F81", opt_args=opt_args) m2 = evo_app.model("HKY85", opt_args=opt_args) hyp = evo_app.hypothesis(m1, m2) strapper = evo_app.bootstrap(hyp, num_reps=2, parallel=True) result = strapper(aln) self.assertIsInstance(result, evo_app.bootstrap_result)
def test_bstrap(self): """exercising bootstrap with simple hypothesis""" aln = load_aligned_seqs(join(data_dir, "brca1.fasta"), moltype="dna") aln = aln.take_seqs(aln.names[:3]) aln = aln.omit_gap_pos(allowed_gap_frac=0) opt_args = dict(max_evaluations=20, limit_action="ignore") m1 = evo_app.model("F81", opt_args=opt_args) m2 = evo_app.model("HKY85", opt_args=opt_args) hyp = evo_app.hypothesis(m1, m2) strapper = evo_app.bootstrap(hyp, num_reps=2, parallel=False) result = strapper(aln) nd = result.null_dist self.assertTrue(set(type(v) for v in nd), {float}) json = result.to_json() got = deserialise_object(json) self.assertIsInstance(got, evo_app.bootstrap_result)