Skip to content

DOC: Use new Model API in README #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ This project is still in early development, if you encounter any problems or hav

```python
from piqtree2 import build_tree
from piqtree2.model import DnaModel, Model
from piqtree2.model import Model
from cogent3 import load_aligned_seqs # Included with piqtree2!

# Load Sequences
aln = load_aligned_seqs("tests/data/example.fasta", moltype="dna")
aln = aln.take_seqs(["Human", "Chimpanzee", "Rhesus", "Mouse"])

# Reconstruct a phylogenetic tree with IQ-TREE!
tree = build_tree(aln, Model(DnaModel.JC), rand_seed=1) # Optionally specify a random seed.
tree = build_tree(aln, Model("JC"), rand_seed=1) # Optionally specify a random seed.

print("Tree topology:", tree) # A cogent3 tree object
print("Log-likelihood:", tree.params["lnL"])
Expand All @@ -43,7 +43,7 @@ print("Log-likelihood:", tree.params["lnL"])

```python
from piqtree2 import fit_tree
from piqtree2.model import DnaModel, Model
from piqtree2.model import Model
from cogent3 import load_aligned_seqs, make_tree # Included with piqtree2!

# Load Sequences
Expand All @@ -54,7 +54,7 @@ aln = aln.take_seqs(["Human", "Chimpanzee", "Rhesus", "Mouse"])
tree = make_tree("(Human, Chimpanzee, (Rhesus, Mouse));")

# Fit branch lengths with IQ-TREE!
tree = fit_tree(aln, tree, Model(DnaModel.JC), rand_seed=1) # Optionally specify a random seed.
tree = fit_tree(aln, tree, Model("JC"), rand_seed=1) # Optionally specify a random seed.

print("Tree with branch lengths:", tree) # A cogent3 tree object
print("Log-likelihood:", tree.params["lnL"])
Expand Down