phykit 2.0.1__tar.gz → 2.0.3__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 (72) hide show
  1. {phykit-2.0.1 → phykit-2.0.3}/PKG-INFO +3 -9
  2. {phykit-2.0.1 → phykit-2.0.3}/README.md +2 -3
  3. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/dna_threader.py +31 -7
  4. phykit-2.0.3/phykit/version.py +1 -0
  5. {phykit-2.0.1 → phykit-2.0.3}/phykit.egg-info/PKG-INFO +3 -9
  6. phykit-2.0.1/phykit/version.py +0 -1
  7. {phykit-2.0.1 → phykit-2.0.3}/LICENSE.md +0 -0
  8. {phykit-2.0.1 → phykit-2.0.3}/phykit/__init__.py +0 -0
  9. {phykit-2.0.1 → phykit-2.0.3}/phykit/__main__.py +0 -0
  10. {phykit-2.0.1 → phykit-2.0.3}/phykit/helpers/__init__.py +0 -0
  11. {phykit-2.0.1 → phykit-2.0.3}/phykit/helpers/boolean_argument_parsing.py +0 -0
  12. {phykit-2.0.1 → phykit-2.0.3}/phykit/helpers/files.py +0 -0
  13. {phykit-2.0.1 → phykit-2.0.3}/phykit/helpers/stats_summary.py +0 -0
  14. {phykit-2.0.1 → phykit-2.0.3}/phykit/phykit.py +0 -0
  15. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/__init__.py +0 -0
  16. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/__init__.py +0 -0
  17. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/alignment_length.py +0 -0
  18. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/alignment_length_no_gaps.py +0 -0
  19. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/alignment_recoding.py +0 -0
  20. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/base.py +0 -0
  21. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/column_score.py +0 -0
  22. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/compositional_bias_per_site.py +0 -0
  23. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/create_concatenation_matrix.py +0 -0
  24. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/evolutionary_rate_per_site.py +0 -0
  25. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/faidx.py +0 -0
  26. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/gc_content.py +0 -0
  27. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/pairwise_identity.py +0 -0
  28. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/parsimony_informative_sites.py +0 -0
  29. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/rcv.py +0 -0
  30. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/rcvt.py +0 -0
  31. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/rename_fasta_entries.py +0 -0
  32. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/sum_of_pairs_score.py +0 -0
  33. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/alignment/variable_sites.py +0 -0
  34. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/base.py +0 -0
  35. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/__init__.py +0 -0
  36. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/base.py +0 -0
  37. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/bipartition_support_stats.py +0 -0
  38. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/branch_length_multiplier.py +0 -0
  39. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/collapse_branches.py +0 -0
  40. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/covarying_evolutionary_rates.py +0 -0
  41. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/dvmc.py +0 -0
  42. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/evolutionary_rate.py +0 -0
  43. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/hidden_paralogy_check.py +0 -0
  44. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/internal_branch_stats.py +0 -0
  45. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/internode_labeler.py +0 -0
  46. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/last_common_ancestor_subtree.py +0 -0
  47. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/lb_score.py +0 -0
  48. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/monophyly_check.py +0 -0
  49. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/nearest_neighbor_interchange.py +0 -0
  50. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/patristic_distances.py +0 -0
  51. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/polytomy_test.py +0 -0
  52. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/print_tree.py +0 -0
  53. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/prune_tree.py +0 -0
  54. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/rename_tree_tips.py +0 -0
  55. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/rf_distance.py +0 -0
  56. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/root_tree.py +0 -0
  57. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/saturation.py +0 -0
  58. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/spurious_sequence.py +0 -0
  59. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/terminal_branch_stats.py +0 -0
  60. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/tip_labels.py +0 -0
  61. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/tip_to_tip_distance.py +0 -0
  62. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/tip_to_tip_node_distance.py +0 -0
  63. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/total_tree_length.py +0 -0
  64. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/treeness.py +0 -0
  65. {phykit-2.0.1 → phykit-2.0.3}/phykit/services/tree/treeness_over_rcv.py +0 -0
  66. {phykit-2.0.1 → phykit-2.0.3}/phykit.egg-info/SOURCES.txt +0 -0
  67. {phykit-2.0.1 → phykit-2.0.3}/phykit.egg-info/dependency_links.txt +0 -0
  68. {phykit-2.0.1 → phykit-2.0.3}/phykit.egg-info/entry_points.txt +0 -0
  69. {phykit-2.0.1 → phykit-2.0.3}/phykit.egg-info/requires.txt +0 -0
  70. {phykit-2.0.1 → phykit-2.0.3}/phykit.egg-info/top_level.txt +0 -0
  71. {phykit-2.0.1 → phykit-2.0.3}/setup.cfg +0 -0
  72. {phykit-2.0.1 → phykit-2.0.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phykit
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Home-page: https://github.com/jlsteenwyk/phykit
5
5
  Author: Jacob L. Steenwyk
6
6
  Author-email: jlsteenwyk@gmail.com
@@ -13,11 +13,6 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Topic :: Scientific/Engineering
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.md
16
- Requires-Dist: biopython>=1.82
17
- Requires-Dist: numpy>=1.24.0
18
- Requires-Dist: scipy>=1.11.3
19
- Requires-Dist: scikit-learn>=1.4.2
20
- Requires-Dist: cython
21
16
 
22
17
  <p align="center">
23
18
  <a href="https://github.com/jlsteenwyk/phykit">
@@ -40,9 +35,8 @@ Requires-Dist: cython
40
35
  <a href="https://github.com/jlsteenwyk/phykit/graphs/contributors" alt="Contributors">
41
36
  <img src="https://img.shields.io/github/contributors/jlsteenwyk/phykit">
42
37
  </a>
43
- <a href="https://twitter.com/intent/follow?screen_name=jlsteenwyk" alt="Author Twitter">
44
- <img src="https://img.shields.io/twitter/follow/jlsteenwyk?style=social&logo=twitter"
45
- alt="follow on Twitter">
38
+ <a href="https://bsky.app/profile/jlsteenwyk.bsky.social" target="_blank" rel="noopener noreferrer">
39
+ <img src="https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff">
46
40
  </a>
47
41
  <br />
48
42
  <a href="https://pepy.tech/badge/phykit">
@@ -19,9 +19,8 @@
19
19
  <a href="https://github.com/jlsteenwyk/phykit/graphs/contributors" alt="Contributors">
20
20
  <img src="https://img.shields.io/github/contributors/jlsteenwyk/phykit">
21
21
  </a>
22
- <a href="https://twitter.com/intent/follow?screen_name=jlsteenwyk" alt="Author Twitter">
23
- <img src="https://img.shields.io/twitter/follow/jlsteenwyk?style=social&logo=twitter"
24
- alt="follow on Twitter">
22
+ <a href="https://bsky.app/profile/jlsteenwyk.bsky.social" target="_blank" rel="noopener noreferrer">
23
+ <img src="https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff">
25
24
  </a>
26
25
  <br />
27
26
  <a href="https://pepy.tech/badge/phykit">
@@ -49,12 +49,36 @@ class DNAThreader(Alignment):
49
49
  # triplicate each amino acid
50
50
  return ''.join(c * 3 for c in p_seq)
51
51
 
52
- def normalize_n_seq(self, n_seq: Seq, normalized_p_seq: str) -> str:
53
- # insert gaps at corresponding positions in the nucleotide sequence based on the protein sequence
54
- normalized_n_seq = list(n_seq)
55
- for idx, c in enumerate(normalized_p_seq):
56
- if c in "-?*Xx":
57
- normalized_n_seq.insert(idx, "-")
52
+ def normalize_n_seq(self, n_seq: Seq, p_seq: Seq) -> str:
53
+ # Remove gaps and special characters from protein sequence to get actual amino acids
54
+ ungapped_p_seq = ''.join(aa for aa in str(p_seq) if aa not in "-?*Xx")
55
+
56
+ # Verify the nucleotide sequence matches the ungapped protein
57
+ expected_nt_length = len(ungapped_p_seq) * 3
58
+ if len(n_seq) < expected_nt_length:
59
+ # If nucleotide sequence is shorter, we'll handle it gracefully
60
+ # by padding with gaps when we run out of codons
61
+ pass
62
+
63
+ # Create codons from nucleotide sequence
64
+ codons = [str(n_seq[i:i+3]) for i in range(0, len(n_seq), 3)]
65
+
66
+ # Map back to gapped alignment - this creates the tripled version
67
+ normalized_n_seq = []
68
+ codon_idx = 0
69
+
70
+ for aa in p_seq:
71
+ if aa in "-?*Xx":
72
+ # For gaps/special chars, add three gap characters
73
+ normalized_n_seq.append("---")
74
+ else:
75
+ # For actual amino acids, add the corresponding codon
76
+ if codon_idx < len(codons):
77
+ normalized_n_seq.append(codons[codon_idx])
78
+ codon_idx += 1
79
+ else:
80
+ normalized_n_seq.append("---") # fallback in case of misalignment
81
+
58
82
  return ''.join(normalized_n_seq)
59
83
 
60
84
  def thread(self, prot_records) -> Dict[str, str]:
@@ -75,7 +99,7 @@ class DNAThreader(Alignment):
75
99
  n_seq = nucl_records[gene_id].seq
76
100
 
77
101
  normalized_p_seq = self.normalize_p_seq(p_seq)
78
- normalized_n_seq = self.normalize_n_seq(n_seq, normalized_p_seq)
102
+ normalized_n_seq = self.normalize_n_seq(n_seq, p_seq)
79
103
 
80
104
  sequence = [
81
105
  normalized_n_seq[idx] if c not in "-?*Xx" and keep_mask[idx] else "-"
@@ -0,0 +1 @@
1
+ __version__ = "2.0.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phykit
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Home-page: https://github.com/jlsteenwyk/phykit
5
5
  Author: Jacob L. Steenwyk
6
6
  Author-email: jlsteenwyk@gmail.com
@@ -13,11 +13,6 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Topic :: Scientific/Engineering
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.md
16
- Requires-Dist: biopython>=1.82
17
- Requires-Dist: numpy>=1.24.0
18
- Requires-Dist: scipy>=1.11.3
19
- Requires-Dist: scikit-learn>=1.4.2
20
- Requires-Dist: cython
21
16
 
22
17
  <p align="center">
23
18
  <a href="https://github.com/jlsteenwyk/phykit">
@@ -40,9 +35,8 @@ Requires-Dist: cython
40
35
  <a href="https://github.com/jlsteenwyk/phykit/graphs/contributors" alt="Contributors">
41
36
  <img src="https://img.shields.io/github/contributors/jlsteenwyk/phykit">
42
37
  </a>
43
- <a href="https://twitter.com/intent/follow?screen_name=jlsteenwyk" alt="Author Twitter">
44
- <img src="https://img.shields.io/twitter/follow/jlsteenwyk?style=social&logo=twitter"
45
- alt="follow on Twitter">
38
+ <a href="https://bsky.app/profile/jlsteenwyk.bsky.social" target="_blank" rel="noopener noreferrer">
39
+ <img src="https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff">
46
40
  </a>
47
41
  <br />
48
42
  <a href="https://pepy.tech/badge/phykit">
@@ -1 +0,0 @@
1
- __version__ = "2.0.1"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes