-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: add fit_tree and build_tree tests
- Loading branch information
Showing
3 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import piqtree2 | ||
import pytest | ||
from cogent3 import load_aligned_seqs, make_tree | ||
|
||
|
||
@pytest.fixture() | ||
def four_otu(DATA_DIR): | ||
aln = load_aligned_seqs(DATA_DIR / "example.fasta", moltype="dna") | ||
aln = aln.take_seqs(["Human", "Chimpanzee", "Rhesus", "Mouse"]) | ||
return aln.omit_gap_pos(allowed_gap_frac=0) | ||
|
||
|
||
def test_phylogenetic_analysis(four_otu): | ||
expected = make_tree("(Human,Chimpanzee,(Rhesus,Mouse));") | ||
got = piqtree2.build_tree(four_otu, "JC", rand_seed=1) | ||
assert expected.same_topology(got) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import piqtree2 | ||
import pytest | ||
from cogent3 import get_app, load_aligned_seqs, make_tree | ||
|
||
|
||
@pytest.fixture | ||
def three_otu(DATA_DIR): | ||
aln = load_aligned_seqs(DATA_DIR / "example.fasta", moltype="dna") | ||
aln = aln.take_seqs(["Human", "Rhesus", "Mouse"]) | ||
return aln.omit_gap_pos(allowed_gap_frac=0) | ||
|
||
|
||
def test_piqtree_fit(three_otu): | ||
tree_topology = make_tree(tip_names=three_otu.names) | ||
app = get_app("model", "JC69", tree=tree_topology) | ||
expected = app(three_otu) | ||
got = piqtree2.fit_tree(three_otu, tree_topology, "JC", rand_seed=1) | ||
assert got.params["lnL"] == pytest.approx(expected.lnL) |
This file was deleted.
Oops, something went wrong.