Pairwise JC distances
We estimate pairwise distances via the Jukes-Cantor model with the piq_jc_distances app.
In [1]:
Copied!
import cogent3
from piqtree import download_dataset
aln_path = download_dataset("example.phy.gz", dest_dir="data")
aln = cogent3.load_aligned_seqs(aln_path, moltype="dna", format_name="phylip")
import cogent3
from piqtree import download_dataset
aln_path = download_dataset("example.phy.gz", dest_dir="data")
aln = cogent3.load_aligned_seqs(aln_path, moltype="dna", format_name="phylip")
We get help on the piqtree_jc_dist app.
In [2]:
Copied!
cogent3.app_help("piq_jc_distances")
cogent3.app_help("piq_jc_distances")
Options for making the app
--------------------------
piq_jc_distances_app = get_app('piq_jc_distances', num_threads=None)
Compute pairwise JC distances for a given alignment.
Parameters
----------
aln : Alignment
The alignment to compute pairwise JC distances for.
num_threads: int | None, optional
Number of threads for IQ-TREE to use,
by default None (uses all available threads).
Returns
-------
DistanceMatrix
Pairwise JC distance matrix.
Input type
----------
Alignment
Output type
-----------
DistanceMatrix
Make an app and apply it to the alignment.
In [3]:
Copied!
jc_dists = cogent3.get_app("piq_jc_distances")
dists = jc_dists(aln)
dists
jc_dists = cogent3.get_app("piq_jc_distances")
dists = jc_dists(aln)
dists
Out[3]:
| names | Bird | Cow | Crocodile | Frog | Human | Lizard | LngfishAf | LngfishAu | LngfishSA | Mouse | Opossum | Platypus | Rat | Seal | Sphenodon | Turtle | Whale |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Bird | 0.0000 | 0.3828 | 0.3143 | 0.4059 | 0.3836 | 0.3656 | 0.4204 | 0.4122 | 0.3954 | 0.4134 | 0.3803 | 0.3886 | 0.4074 | 0.3753 | 0.3598 | 0.3139 | 0.3845 |
| Cow | 0.3828 | 0.0000 | 0.4085 | 0.3682 | 0.2100 | 0.3932 | 0.4143 | 0.3750 | 0.4048 | 0.2247 | 0.2397 | 0.2693 | 0.2302 | 0.1545 | 0.3778 | 0.3293 | 0.1460 |
| Crocodile | 0.3143 | 0.4085 | 0.0000 | 0.4280 | 0.4163 | 0.3968 | 0.4448 | 0.4186 | 0.4171 | 0.4475 | 0.4295 | 0.4154 | 0.4439 | 0.4102 | 0.3746 | 0.3396 | 0.4357 |
| Frog | 0.4059 | 0.3682 | 0.4280 | 0.0000 | 0.3940 | 0.4150 | 0.3504 | 0.2975 | 0.3520 | 0.3948 | 0.3673 | 0.3864 | 0.3982 | 0.3682 | 0.4349 | 0.3613 | 0.3805 |
| Human | 0.3836 | 0.2100 | 0.4163 | 0.3940 | 0.0000 | 0.3949 | 0.4390 | 0.3825 | 0.4160 | 0.2544 | 0.2889 | 0.3075 | 0.2586 | 0.2100 | 0.3895 | 0.3522 | 0.2214 |
| Lizard | 0.3656 | 0.3932 | 0.3968 | 0.4150 | 0.3949 | 0.0000 | 0.4524 | 0.4127 | 0.4165 | 0.3847 | 0.3780 | 0.4043 | 0.4156 | 0.3814 | 0.3714 | 0.3427 | 0.4078 |
| LngfishAf | 0.4204 | 0.4143 | 0.4448 | 0.3504 | 0.4390 | 0.4524 | 0.0000 | 0.2833 | 0.2384 | 0.4160 | 0.3878 | 0.4204 | 0.4435 | 0.4065 | 0.4408 | 0.3883 | 0.4082 |
| LngfishAu | 0.4122 | 0.3750 | 0.4186 | 0.2975 | 0.3825 | 0.4127 | 0.2833 | 0.0000 | 0.2877 | 0.3841 | 0.3883 | 0.3993 | 0.3850 | 0.3514 | 0.4131 | 0.3681 | 0.3692 |
| LngfishSA | 0.3954 | 0.4048 | 0.4171 | 0.3520 | 0.4160 | 0.4165 | 0.2384 | 0.2877 | 0.0000 | 0.3962 | 0.3647 | 0.4065 | 0.4248 | 0.3895 | 0.4230 | 0.3976 | 0.4048 |
| Mouse | 0.4134 | 0.2247 | 0.4475 | 0.3948 | 0.2544 | 0.3847 | 0.4160 | 0.3841 | 0.3962 | 0.0000 | 0.2425 | 0.2794 | 0.1226 | 0.2054 | 0.3811 | 0.3348 | 0.2315 |
| Opossum | 0.3803 | 0.2397 | 0.4295 | 0.3673 | 0.2889 | 0.3780 | 0.3878 | 0.3883 | 0.3647 | 0.2425 | 0.0000 | 0.2363 | 0.2721 | 0.2425 | 0.3696 | 0.3403 | 0.2488 |
| Platypus | 0.3886 | 0.2693 | 0.4154 | 0.3864 | 0.3075 | 0.4043 | 0.4204 | 0.3993 | 0.4065 | 0.2794 | 0.2363 | 0.0000 | 0.2918 | 0.2600 | 0.4031 | 0.3522 | 0.2671 |
| Rat | 0.4074 | 0.2302 | 0.4439 | 0.3982 | 0.2586 | 0.4156 | 0.4435 | 0.3850 | 0.4248 | 0.1226 | 0.2721 | 0.2918 | 0.0000 | 0.2234 | 0.4065 | 0.3530 | 0.2474 |
| Seal | 0.3753 | 0.1545 | 0.4102 | 0.3682 | 0.2100 | 0.3814 | 0.4065 | 0.3514 | 0.3895 | 0.2054 | 0.2425 | 0.2600 | 0.2234 | 0.0000 | 0.3811 | 0.3301 | 0.1688 |
| Sphenodon | 0.3598 | 0.3778 | 0.3746 | 0.4349 | 0.3895 | 0.3714 | 0.4408 | 0.4131 | 0.4230 | 0.3811 | 0.3696 | 0.4031 | 0.4065 | 0.3811 | 0.0000 | 0.3309 | 0.3820 |
| Turtle | 0.3139 | 0.3293 | 0.3396 | 0.3613 | 0.3522 | 0.3427 | 0.3883 | 0.3681 | 0.3976 | 0.3348 | 0.3403 | 0.3522 | 0.3530 | 0.3301 | 0.3309 | 0.0000 | 0.3356 |
| Whale | 0.3845 | 0.1460 | 0.4357 | 0.3805 | 0.2214 | 0.4078 | 0.4082 | 0.3692 | 0.4048 | 0.2315 | 0.2488 | 0.2671 | 0.2474 | 0.1688 | 0.3820 | 0.3356 | 0.0000 |