phykit 2.4.0__tar.gz → 2.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. {phykit-2.4.0 → phykit-2.5.0}/PKG-INFO +1 -1
  2. {phykit-2.4.0 → phykit-2.5.0}/phykit/cli_registry.py +3 -0
  3. {phykit-2.4.0 → phykit-2.5.0}/phykit/phykit.py +225 -12
  4. {phykit-2.4.0 → phykit-2.5.0}/phykit/service_factories.py +2 -0
  5. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/__init__.py +1 -0
  6. phykit-2.5.0/phykit/services/alignment/alignment_outlier_regions.py +591 -0
  7. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/occupancy_filter.py +7 -2
  8. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/pairwise_identity.py +1 -1
  9. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/phylo_gwas.py +2 -0
  10. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/__init__.py +1 -0
  11. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/base.py +10 -0
  12. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/covarying_evolutionary_rates.py +135 -19
  13. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/nearest_neighbor_interchange.py +7 -2
  14. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/print_tree.py +16 -2
  15. phykit-2.5.0/phykit/services/tree/projected_covarying_rates.py +707 -0
  16. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/spr.py +19 -4
  17. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/transfer_annotations.py +7 -2
  18. phykit-2.5.0/phykit/version.py +1 -0
  19. {phykit-2.4.0 → phykit-2.5.0}/phykit.egg-info/PKG-INFO +1 -1
  20. {phykit-2.4.0 → phykit-2.5.0}/phykit.egg-info/SOURCES.txt +2 -0
  21. {phykit-2.4.0 → phykit-2.5.0}/phykit.egg-info/entry_points.txt +5 -0
  22. phykit-2.4.0/phykit/version.py +0 -1
  23. {phykit-2.4.0 → phykit-2.5.0}/LICENSE.md +0 -0
  24. {phykit-2.4.0 → phykit-2.5.0}/README.md +0 -0
  25. {phykit-2.4.0 → phykit-2.5.0}/phykit/__init__.py +0 -0
  26. {phykit-2.4.0 → phykit-2.5.0}/phykit/__main__.py +0 -0
  27. {phykit-2.4.0 → phykit-2.5.0}/phykit/errors.py +0 -0
  28. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/__init__.py +0 -0
  29. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/boolean_argument_parsing.py +0 -0
  30. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/caching.py +0 -0
  31. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/circular_layout.py +0 -0
  32. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/color_annotations.py +0 -0
  33. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/discrete_models.py +0 -0
  34. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/files.py +0 -0
  35. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/geological_timescale.py +0 -0
  36. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/json_output.py +0 -0
  37. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/parallel.py +0 -0
  38. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/parsimony_utils.py +0 -0
  39. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/pgls_utils.py +0 -0
  40. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/plot_config.py +0 -0
  41. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/quartet_utils.py +0 -0
  42. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/stats_summary.py +0 -0
  43. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/streaming.py +0 -0
  44. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/trait_parsing.py +0 -0
  45. {phykit-2.4.0 → phykit-2.5.0}/phykit/helpers/tree_paths.py +0 -0
  46. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/__init__.py +0 -0
  47. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/_fasta.py +0 -0
  48. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/alignment_entropy.py +0 -0
  49. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/alignment_length.py +0 -0
  50. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/alignment_length_no_gaps.py +0 -0
  51. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/alignment_outlier_taxa.py +0 -0
  52. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/alignment_recoding.py +0 -0
  53. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/alignment_subsample.py +0 -0
  54. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/base.py +0 -0
  55. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/codon_dnds.py +0 -0
  56. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/column_score.py +0 -0
  57. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/composition_per_taxon.py +0 -0
  58. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/compositional_bias_per_site.py +0 -0
  59. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/create_concatenation_matrix.py +0 -0
  60. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/dfoil.py +0 -0
  61. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/dna_threader.py +0 -0
  62. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/dstatistic.py +0 -0
  63. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/evolutionary_rate_per_site.py +0 -0
  64. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/faidx.py +0 -0
  65. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/gc_content.py +0 -0
  66. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/identity_matrix.py +0 -0
  67. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/mask_alignment.py +0 -0
  68. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/occupancy_per_taxon.py +0 -0
  69. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/parsimony_informative_sites.py +0 -0
  70. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/plot_alignment_qc.py +0 -0
  71. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/rcv.py +0 -0
  72. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/rcvt.py +0 -0
  73. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/rename_fasta_entries.py +0 -0
  74. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/sum_of_pairs_score.py +0 -0
  75. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/taxon_groups.py +0 -0
  76. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/alignment/variable_sites.py +0 -0
  77. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/base.py +0 -0
  78. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/ancestral_reconstruction.py +0 -0
  79. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/bipartition_support_stats.py +0 -0
  80. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/branch_length_multiplier.py +0 -0
  81. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/character_map.py +0 -0
  82. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/chronogram.py +0 -0
  83. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/collapse_branches.py +0 -0
  84. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/concordance_asr.py +0 -0
  85. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/consensus_network.py +0 -0
  86. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/consensus_tree.py +0 -0
  87. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/cont_map.py +0 -0
  88. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/cophylo.py +0 -0
  89. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/density_map.py +0 -0
  90. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/discordance_asymmetry.py +0 -0
  91. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/dtt.py +0 -0
  92. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/dvmc.py +0 -0
  93. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/evo_tempo_map.py +0 -0
  94. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/evolutionary_rate.py +0 -0
  95. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/faiths_pd.py +0 -0
  96. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/fit_continuous.py +0 -0
  97. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/fit_discrete.py +0 -0
  98. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/hidden_paralogy_check.py +0 -0
  99. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/hybridization.py +0 -0
  100. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/independent_contrasts.py +0 -0
  101. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/internal_branch_stats.py +0 -0
  102. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/internode_labeler.py +0 -0
  103. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/kf_distance.py +0 -0
  104. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/last_common_ancestor_subtree.py +0 -0
  105. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/lb_score.py +0 -0
  106. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/ltt.py +0 -0
  107. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/monophyly_check.py +0 -0
  108. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/neighbor_net.py +0 -0
  109. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/network_signal.py +0 -0
  110. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/ou_shift_detection.py +0 -0
  111. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/ouwie.py +0 -0
  112. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/parsimony_score.py +0 -0
  113. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/patristic_distances.py +0 -0
  114. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phenogram.py +0 -0
  115. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylo_anova.py +0 -0
  116. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylo_heatmap.py +0 -0
  117. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylo_impute.py +0 -0
  118. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylo_logistic.py +0 -0
  119. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylo_path.py +0 -0
  120. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylogenetic_glm.py +0 -0
  121. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylogenetic_ordination.py +0 -0
  122. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylogenetic_regression.py +0 -0
  123. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylogenetic_signal.py +0 -0
  124. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/phylomorphospace.py +0 -0
  125. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/polytomy_test.py +0 -0
  126. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/prune_tree.py +0 -0
  127. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/quartet_network.py +0 -0
  128. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/quartet_pie.py +0 -0
  129. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/rate_heterogeneity.py +0 -0
  130. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/relative_rate_test.py +0 -0
  131. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/rename_tree_tips.py +0 -0
  132. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/rf_distance.py +0 -0
  133. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/root_tree.py +0 -0
  134. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/saturation.py +0 -0
  135. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/simmap_summary.py +0 -0
  136. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/spectral_discordance.py +0 -0
  137. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/spurious_sequence.py +0 -0
  138. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/stochastic_character_map.py +0 -0
  139. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/terminal_branch_stats.py +0 -0
  140. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/threshold_model.py +0 -0
  141. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/tip_labels.py +0 -0
  142. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/tip_to_tip_distance.py +0 -0
  143. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/tip_to_tip_node_distance.py +0 -0
  144. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/total_tree_length.py +0 -0
  145. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/trait_correlation.py +0 -0
  146. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/trait_rate_map.py +0 -0
  147. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/tree_space.py +0 -0
  148. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/treeness.py +0 -0
  149. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/treeness_over_rcv.py +0 -0
  150. {phykit-2.4.0 → phykit-2.5.0}/phykit/services/tree/vcv_utils.py +0 -0
  151. {phykit-2.4.0 → phykit-2.5.0}/phykit.egg-info/dependency_links.txt +0 -0
  152. {phykit-2.4.0 → phykit-2.5.0}/phykit.egg-info/requires.txt +0 -0
  153. {phykit-2.4.0 → phykit-2.5.0}/phykit.egg-info/top_level.txt +0 -0
  154. {phykit-2.4.0 → phykit-2.5.0}/setup.cfg +0 -0
  155. {phykit-2.4.0 → phykit-2.5.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phykit
3
- Version: 2.4.0
3
+ Version: 2.5.0
4
4
  Home-page: https://github.com/jlsteenwyk/phykit
5
5
  Author: Jacob L. Steenwyk
6
6
  Author-email: jlsteenwyk@gmail.com
@@ -21,6 +21,8 @@ ALIAS_TO_HANDLER: dict[str, str] = {
21
21
  "recode": "alignment_recoding",
22
22
  "outlier_taxa": "alignment_outlier_taxa",
23
23
  "aot": "alignment_outlier_taxa",
24
+ "outlier_regions": "alignment_outlier_regions",
25
+ "aor": "alignment_outlier_regions",
24
26
  "dtt": "dtt",
25
27
  "disparity_through_time": "dtt",
26
28
  "dstat": "dstatistic",
@@ -80,6 +82,7 @@ ALIAS_TO_HANDLER: dict[str, str] = {
80
82
  "chrono": "chronogram",
81
83
  "time_tree": "chronogram",
82
84
  "cover": "covarying_evolutionary_rates",
85
+ "pcover": "projected_covarying_rates",
83
86
  "consnet": "consensus_network",
84
87
  "splitnet": "consensus_network",
85
88
  "splits_network": "consensus_network",
@@ -540,6 +540,8 @@ class Phykit:
540
540
  symmetric phylogeny
541
541
  alignment_outlier_taxa (alias: outlier_taxa; aot)
542
542
  - identify potential outlier taxa and why they were flagged
543
+ alignment_outlier_regions (alias: outlier_regions; aor)
544
+ - detect localized nonhomologous or erroneous sequence regions
543
545
  column_score (alias: cs)
544
546
  - calculate column score between a reference and query alignment
545
547
  compositional_bias_per_site (alias: comp_bias_per_site; cbps)
@@ -619,6 +621,8 @@ class Phykit:
619
621
  - collapses branches according to bipartition support
620
622
  covarying_evolutionary_rates (alias: cover)
621
623
  - calculates correlation in the evolutionary rate of two trees
624
+ projected_covarying_rates (alias: pcover)
625
+ - estimates rate covariation when gene-tree topologies differ
622
626
  consensus_network (alias: consnet; splitnet; splits_network)
623
627
  - extract bipartition splits from gene trees and visualize
624
628
  conflicting phylogenetic signal as a splits network
@@ -1237,6 +1241,92 @@ class Phykit:
1237
1241
  _add_json_argument(parser)
1238
1242
  _run_service(parser, argv, AlignmentOutlierTaxa)
1239
1243
 
1244
+ @staticmethod
1245
+ def alignment_outlier_regions(argv):
1246
+ parser = _new_parser(
1247
+ description=_dedent(
1248
+ f"""\
1249
+ {help_header}
1250
+
1251
+ Detect localized outlier regions in a multiple sequence alignment.
1252
+
1253
+ This command uses a TAPER-inspired two-dimensional method. It scores
1254
+ residues relative to their alignment columns, detects unusually high
1255
+ scores within each sequence at multiple window sizes, and smooths
1256
+ window calls into contiguous regions. Only residues belonging to a
1257
+ flagged taxon-region are reported or masked; complete alignment
1258
+ columns are not removed.
1259
+
1260
+ Citation:
1261
+ Zhang C, Zhao Y, Braun EL, and Mirarab S. 2021. TAPER:
1262
+ Pinpointing errors in multiple sequence alignments despite varying
1263
+ rates of evolution. Methods in Ecology and Evolution 12:2145-2158.
1264
+ doi:10.1111/2041-210X.13696
1265
+
1266
+ Aliases:
1267
+ alignment_outlier_regions, outlier_regions, aor
1268
+ Command line interfaces:
1269
+ pk_alignment_outlier_regions, pk_outlier_regions, pk_aor
1270
+
1271
+ Usage:
1272
+ phykit alignment_outlier_regions <alignment>
1273
+ [--cutoff <float>] [--report <path>]
1274
+ [--mask-output <path>] [--mask-character <character>]
1275
+ [--json]
1276
+
1277
+ Options
1278
+ =====================================================
1279
+ <alignment> multiple sequence alignment
1280
+
1281
+ --cutoff minimum divergence score used
1282
+ to control detection sensitivity;
1283
+ must be >1 (default: 3.0)
1284
+
1285
+ --report optional path for the region
1286
+ report; defaults to standard output
1287
+
1288
+ --mask-output optional path for a FASTA alignment
1289
+ with flagged residues masked
1290
+
1291
+ --mask-character single ambiguity character used in
1292
+ the masked alignment (default: ?)
1293
+
1294
+ --json output the report as JSON
1295
+ """
1296
+ ),
1297
+ )
1298
+ parser.add_argument("alignment", type=str, help=SUPPRESS)
1299
+ parser.add_argument(
1300
+ "--cutoff",
1301
+ type=float,
1302
+ default=3.0,
1303
+ required=False,
1304
+ help=SUPPRESS,
1305
+ )
1306
+ parser.add_argument(
1307
+ "--report",
1308
+ type=str,
1309
+ default=None,
1310
+ required=False,
1311
+ help=SUPPRESS,
1312
+ )
1313
+ parser.add_argument(
1314
+ "--mask-output",
1315
+ type=str,
1316
+ default=None,
1317
+ required=False,
1318
+ help=SUPPRESS,
1319
+ )
1320
+ parser.add_argument(
1321
+ "--mask-character",
1322
+ type=str,
1323
+ default="?",
1324
+ required=False,
1325
+ help=SUPPRESS,
1326
+ )
1327
+ _add_json_argument(parser)
1328
+ _run_service(parser, argv, AlignmentOutlierRegions)
1329
+
1240
1330
  @staticmethod
1241
1331
  def column_score(argv):
1242
1332
  if (
@@ -3962,23 +4052,24 @@ class Phykit:
3962
4052
  Genes that have covarying evolutionary histories tend to have
3963
4053
  similar functions and expression levels.
3964
4054
 
3965
- Input two phylogenies and calculate the correlation among relative
3966
- evolutionary rates between the two phylogenies. The two input trees
3967
- do not have to have the same taxa. This function will first prune both
3968
- trees to have the same tips. To transform branch lengths into relative
3969
- rates, PhyKIT uses the putative species tree's branch lengths, which is
3970
- inputted by the user. As recommended by the original method developers,
3971
- outlier branche lengths are removed. Outlier branches have a relative
3972
- evolutionary rate greater than five.
4055
+ Input two gene phylogenies and calculate the Pearson correlation among
4056
+ their relative evolutionary rates. PhyKIT first prunes both gene trees
4057
+ and the reference tree to their shared taxa. The three rooted trees must
4058
+ then have the same topology. Each gene-tree branch length is divided by
4059
+ the corresponding reference-tree branch length. Branch pairs are removed
4060
+ if either relative rate is greater than five, and the remaining rates are
4061
+ Z-transformed before correlation.
3973
4062
 
3974
4063
  PhyKIT reports two tab delimited values:
3975
4064
  col1: correlation coefficient
3976
4065
  col2: p-value
3977
4066
 
3978
- Method is empirically evaluated by Clark et al., Genome Research
3979
- (2012), doi: 10.1101/gr.132647.111. Normalization method using a
3980
- species tree follows Sato et al., Bioinformatics (2005), doi:
3981
- 10.1093/bioinformatics/bti564.
4067
+ This CovER calculation is described by Steenwyk et al., Science
4068
+ Advances (2022), doi: 10.1126/sciadv.abn0105, and is based on the
4069
+ mirror-tree principle developed by Sato et al., Bioinformatics (2005),
4070
+ doi: 10.1093/bioinformatics/bti564. ERC2.0 and RERconverge use a
4071
+ different residual-based rate normalization and are not expected to
4072
+ return the same coefficient from the same trees.
3982
4073
 
3983
4074
 
3984
4075
  Aliases:
@@ -4093,6 +4184,120 @@ class Phykit:
4093
4184
  _add_json_argument(parser)
4094
4185
  _run_service(parser, argv, CovaryingEvolutionaryRates)
4095
4186
 
4187
+ @staticmethod
4188
+ def projected_covarying_rates(argv):
4189
+ parser = _new_parser(
4190
+ description=_dedent(
4191
+ f"""\
4192
+ {help_header}
4193
+
4194
+ Estimate evolutionary-rate covariation when gene-tree topologies
4195
+ differ (experimental).
4196
+
4197
+ This method prunes both gene trees and a reference tree to their
4198
+ shared taxa, then converts each gene tree to pairwise patristic
4199
+ distances. It constructs an edge-path design matrix from the
4200
+ unrooted reference tree and uses nonnegative least squares (NNLS)
4201
+ to project each gene's distances onto that common edge basis.
4202
+ Projected edge lengths are divided by reference edge lengths,
4203
+ filtered by --max-rate, Z-transformed, and correlated with Pearson's
4204
+ r. Unlike covarying_evolutionary_rates, matching tree topologies are
4205
+ not required.
4206
+
4207
+ The projection NRMSE reported for each gene measures disagreement
4208
+ with the reference basis: zero is an exact additive fit and larger
4209
+ values indicate more distance signal that the reference topology
4210
+ cannot explain. For rooted references with two root children, their
4211
+ complementary branches are combined because pairwise distances
4212
+ identify only their summed unrooted edge length.
4213
+
4214
+ This is an experimental PhyKIT estimator, not the published CovER
4215
+ calculation. Its ordinary Pearson p-value is descriptive because
4216
+ projected reference edges are not statistically independent. The
4217
+ rate-covariation context follows Steenwyk et al., Science Advances
4218
+ (2022), doi: 10.1126/sciadv.abn0105. NNLS follows Lawson and Hanson,
4219
+ Solving Least Squares Problems (1995).
4220
+
4221
+ Aliases:
4222
+ projected_covarying_rates, pcover
4223
+ Command line interfaces:
4224
+ pk_projected_covarying_rates, pk_pcover
4225
+
4226
+ Usage:
4227
+ phykit projected_covarying_rates <tree_file_zero> <tree_file_one>
4228
+ -r/--reference <reference_tree_file>
4229
+ [-v/--verbose]
4230
+ [--weighting uniform|inverse_reference]
4231
+ [--max-rate <float>] [--max-pairs <int>] [--seed <int>]
4232
+ [--plot] [--plot-output <path>] [--json]
4233
+
4234
+ Options
4235
+ =====================================================
4236
+ <tree_file_zero> first gene tree with branch lengths
4237
+
4238
+ <tree_file_one> second gene tree with branch lengths
4239
+
4240
+ -r/--reference reference tree with branch lengths;
4241
+ typically a species tree
4242
+
4243
+ -v/--verbose include the projected length, relative
4244
+ rate, Z-score, and status of every
4245
+ identifiable reference edge
4246
+
4247
+ --weighting distance-pair weighting for NNLS:
4248
+ uniform (default) or inverse_reference
4249
+
4250
+ --max-rate exclude an edge if either projected
4251
+ relative rate exceeds this value
4252
+ (default: 5)
4253
+
4254
+ --max-pairs maximum number of taxon pairs used in
4255
+ projection (default: 50000)
4256
+
4257
+ --seed random seed for deterministic pair
4258
+ subsampling (default: 0)
4259
+
4260
+ --plot save a projected-rate scatter plot
4261
+
4262
+ --plot-output plot path (default:
4263
+ projected_covarying_rates_plot.png)
4264
+
4265
+ --json output results and diagnostics as JSON
4266
+ """
4267
+ ),
4268
+ )
4269
+ parser.add_argument("tree_zero", type=str, help=SUPPRESS)
4270
+ parser.add_argument("tree_one", type=str, help=SUPPRESS)
4271
+ parser.add_argument(
4272
+ "-r", "--reference", type=str, required=True, help=SUPPRESS, metavar=""
4273
+ )
4274
+ parser.add_argument(
4275
+ "-v", "--verbose", action="store_true", required=False, help=SUPPRESS
4276
+ )
4277
+ parser.add_argument(
4278
+ "--weighting",
4279
+ choices=("uniform", "inverse_reference"),
4280
+ default="uniform",
4281
+ help=SUPPRESS,
4282
+ )
4283
+ parser.add_argument(
4284
+ "--max-rate", type=float, default=5.0, help=SUPPRESS
4285
+ )
4286
+ parser.add_argument(
4287
+ "--max-pairs", type=int, default=50_000, help=SUPPRESS
4288
+ )
4289
+ parser.add_argument("--seed", type=int, default=0, help=SUPPRESS)
4290
+ parser.add_argument("--plot", action="store_true", help=SUPPRESS)
4291
+ parser.add_argument(
4292
+ "--plot-output",
4293
+ type=str,
4294
+ default="projected_covarying_rates_plot.png",
4295
+ help=SUPPRESS,
4296
+ )
4297
+ add_plot_arguments(parser)
4298
+ _add_json_argument(parser)
4299
+ _run_service(parser, argv, ProjectedCovaryingRates)
4300
+
4096
4301
  @staticmethod
4097
4302
  def dvmc(argv):
4098
4303
  parser = _new_parser(
@@ -10212,6 +10417,10 @@ def alignment_outlier_taxa(argv=None):
10212
10417
  Phykit.alignment_outlier_taxa(sys.argv[1:])
10213
10418
 
10214
10419
 
10420
+ def alignment_outlier_regions(argv=None):
10421
+ Phykit.alignment_outlier_regions(sys.argv[1:])
10422
+
10423
+
10215
10424
  def column_score(argv=None):
10216
10425
  Phykit.column_score(sys.argv[1:])
10217
10426
 
@@ -10353,6 +10562,10 @@ def covarying_evolutionary_rates(argv=None):
10353
10562
  Phykit.covarying_evolutionary_rates(sys.argv[1:])
10354
10563
 
10355
10564
 
10565
+ def projected_covarying_rates(argv=None):
10566
+ Phykit.projected_covarying_rates(sys.argv[1:])
10567
+
10568
+
10356
10569
  def dvmc(argv=None):
10357
10570
  Phykit.dvmc(sys.argv[1:])
10358
10571
 
@@ -23,6 +23,7 @@ AlignmentEntropy = _LazyServiceFactory("phykit.services.alignment.alignment_entr
23
23
  AlignmentRecoding = _LazyServiceFactory("phykit.services.alignment.alignment_recoding", "AlignmentRecoding")
24
24
  AlignmentSubsample = _LazyServiceFactory("phykit.services.alignment.alignment_subsample", "AlignmentSubsample")
25
25
  AlignmentOutlierTaxa = _LazyServiceFactory("phykit.services.alignment.alignment_outlier_taxa", "AlignmentOutlierTaxa")
26
+ AlignmentOutlierRegions = _LazyServiceFactory("phykit.services.alignment.alignment_outlier_regions", "AlignmentOutlierRegions")
26
27
  ColumnScore = _LazyServiceFactory("phykit.services.alignment.column_score", "ColumnScore")
27
28
  CompositionalBiasPerSite = _LazyServiceFactory("phykit.services.alignment.compositional_bias_per_site", "CompositionalBiasPerSite")
28
29
  CompositionPerTaxon = _LazyServiceFactory("phykit.services.alignment.composition_per_taxon", "CompositionPerTaxon")
@@ -60,6 +61,7 @@ BipartitionSupportStats = _LazyServiceFactory("phykit.services.tree.bipartition_
60
61
  BranchLengthMultiplier = _LazyServiceFactory("phykit.services.tree.branch_length_multiplier", "BranchLengthMultiplier")
61
62
  CollapseBranches = _LazyServiceFactory("phykit.services.tree.collapse_branches", "CollapseBranches")
62
63
  CovaryingEvolutionaryRates = _LazyServiceFactory("phykit.services.tree.covarying_evolutionary_rates", "CovaryingEvolutionaryRates")
64
+ ProjectedCovaryingRates = _LazyServiceFactory("phykit.services.tree.projected_covarying_rates", "ProjectedCovaryingRates")
63
65
  Chronogram = _LazyServiceFactory("phykit.services.tree.chronogram", "Chronogram")
64
66
  ConsensusNetwork = _LazyServiceFactory("phykit.services.tree.consensus_network", "ConsensusNetwork")
65
67
  NeighborNet = _LazyServiceFactory("phykit.services.tree.neighbor_net", "NeighborNet")
@@ -7,6 +7,7 @@ _EXPORTS = {
7
7
  "AlignmentLengthNoGaps": "alignment_length_no_gaps",
8
8
  "AlignmentEntropy": "alignment_entropy",
9
9
  "AlignmentRecoding": "alignment_recoding",
10
+ "AlignmentOutlierRegions": "alignment_outlier_regions",
10
11
  "ColumnScore": "column_score",
11
12
  "CompositionalBiasPerSite": "compositional_bias_per_site",
12
13
  "CompositionPerTaxon": "composition_per_taxon",