TreeSAK 1.35.3__tar.gz → 1.37.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 (101) hide show
  1. {TreeSAK-1.35.3/TreeSAK.egg-info → TreeSAK-1.37.0}/PKG-INFO +2 -2
  2. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/MarkerRef2Tree.py +19 -0
  3. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/MarkerSeq2Tree.py +42 -18
  4. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SplitScore2.py +1 -1
  5. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/VERSION +6 -0
  6. TreeSAK-1.37.0/TreeSAK/gap_stats.py +38 -0
  7. TreeSAK-1.37.0/TreeSAK/recodeAA.py +73 -0
  8. {TreeSAK-1.35.3 → TreeSAK-1.37.0/TreeSAK.egg-info}/PKG-INFO +2 -2
  9. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK.egg-info/SOURCES.txt +2 -0
  10. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/bin/TreeSAK +19 -1
  11. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/LICENSE +0 -0
  12. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/MANIFEST.in +0 -0
  13. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/README.md +0 -0
  14. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE.py +0 -0
  15. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE1.py +0 -0
  16. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE2.py +0 -0
  17. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE2RTC.py +0 -0
  18. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE3.py +0 -0
  19. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE4.py +0 -0
  20. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE5.py +0 -0
  21. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE6.py +0 -0
  22. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ALE_backup.py +0 -0
  23. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/AlignmentPruner.py +0 -0
  24. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/AssessCVG.py +0 -0
  25. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/AssessMarker.py +0 -0
  26. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
  27. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/AssessMarkerPA.py +0 -0
  28. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/AssessPB.py +0 -0
  29. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/BMGE.jar +0 -0
  30. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/BMGE.py +0 -0
  31. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/CompareMCMC.py +0 -0
  32. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ConcateMSA.py +0 -0
  33. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ConvertMSA.py +0 -0
  34. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/Dir.rb +0 -0
  35. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ExtractMarkerSeq.py +0 -0
  36. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/FastRoot.py +0 -0
  37. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/FastRoot_backup.py +0 -0
  38. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/GTDB_tree.py +0 -0
  39. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/KEGG_Luo17.py +0 -0
  40. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/LcaToLeaves.py +0 -0
  41. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/MCMCtreeR.py +0 -0
  42. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
  43. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ModifyTopo.py +0 -0
  44. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/OMA.py +0 -0
  45. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/OMA2.py +0 -0
  46. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/OneLineAln.py +0 -0
  47. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/PB.py +0 -0
  48. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/PMSF.py +0 -0
  49. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/PhyloBiAssoc.R +0 -0
  50. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/PhyloBiAssoc.py +0 -0
  51. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/PlotMcmcNode.py +0 -0
  52. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/RootTree.py +0 -0
  53. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/RootTreeGTDB214.py +0 -0
  54. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/RootTreeGTDB220.py +0 -0
  55. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SequentialDating.py +0 -0
  56. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SingleAleHGT.py +0 -0
  57. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SingleLinePhy.py +0 -0
  58. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SliceMSA.py +0 -0
  59. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SplitScore.py +0 -0
  60. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SplitScore1.py +0 -0
  61. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/SplitScore1OMA.py +0 -0
  62. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/TaxaCountStats.R +0 -0
  63. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/TreeSAK_config.py +0 -0
  64. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/VisHPD95.R +0 -0
  65. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/VisHPD95.py +0 -0
  66. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/__init__.py +0 -0
  67. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ale_parser.py +0 -0
  68. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/ale_splitter.py +0 -0
  69. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/compare_trees.R +0 -0
  70. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/compare_trees.py +0 -0
  71. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/dating.py +0 -0
  72. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/dating_ss.py +0 -0
  73. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/do_rrtc.rb +0 -0
  74. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/fa2phy.py +0 -0
  75. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/format_leaf_name.py +0 -0
  76. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/get_arCOG_seq.py +0 -0
  77. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/global_functions.py +0 -0
  78. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/merge_pdf.py +0 -0
  79. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/pRTC.py +0 -0
  80. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/parse_deltall_stdout.py +0 -0
  81. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/plot_distruibution_th.py +0 -0
  82. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/prep_mcmctree_ctl.py +0 -0
  83. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/print_leaves.py +0 -0
  84. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/rename_leaves.py +0 -0
  85. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/replace_clade.py +0 -0
  86. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/root_with_out_group.py +0 -0
  87. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
  88. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/subsample_drep_gnms.py +0 -0
  89. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/subset.py +0 -0
  90. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
  91. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/test_1.py +0 -0
  92. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/test_2.py +0 -0
  93. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/tmp_2.py +0 -0
  94. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/tmp_3.py +0 -0
  95. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/tmp_4.py +0 -0
  96. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK/weighted_rand.rb +0 -0
  97. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK.egg-info/dependency_links.txt +0 -0
  98. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK.egg-info/requires.txt +0 -0
  99. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/TreeSAK.egg-info/top_level.txt +0 -0
  100. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/setup.cfg +0 -0
  101. {TreeSAK-1.35.3 → TreeSAK-1.37.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.35.3
3
+ Version: 1.37.0
4
4
  Summary: BioSAK
5
5
  Home-page: https://github.com/songweizhi/TreeSAK
6
6
  Author: Weizhi Song
@@ -24,4 +24,4 @@ Requires-Dist: kaleido
24
24
  Requires-Dist: PyPDF3
25
25
  Requires-Dist: dendropy
26
26
 
27
- TreeSAK v1.35.3
27
+ TreeSAK v1.37.0
@@ -290,6 +290,25 @@ def AssessMarkerPA(trimmed_aln_dir, gnm_set, group_to_gnm_dict, present_pct_cuto
290
290
  print('Assessment results exported to:\n%s\n%s' % (assess_summary_1_txt, assess_summary_2_txt))
291
291
 
292
292
 
293
+ def get_gap_stats(msa_in_fa, stats_txt):
294
+
295
+ gap_pct_dict = dict()
296
+ for each_seq in SeqIO.parse(msa_in_fa, 'fasta'):
297
+ seq_id = each_seq.id
298
+ seq_str = str(each_seq.seq)
299
+ gap_pct = seq_str.count('-')*100/len(seq_str)
300
+ gap_pct = float("{0:.2f}".format(gap_pct))
301
+ gap_pct_dict[seq_id] = gap_pct
302
+
303
+ gap_pct_sorted = sorted(gap_pct_dict.items(), key=lambda x:x[1])
304
+
305
+ stats_txt_handle = open(stats_txt, 'w')
306
+ stats_txt_handle.write('Sequence\tGap\n')
307
+ for each_seq in gap_pct_sorted:
308
+ stats_txt_handle.write('%s\t%s\n' % (each_seq[0], each_seq[1]))
309
+ stats_txt_handle.close()
310
+
311
+
293
312
  def MarkerRef2Tree(args):
294
313
 
295
314
  faa_file_dir = args['i']
@@ -94,6 +94,25 @@ def catfasta2phy(msa_dir, msa_ext, concatenated_msa_phy, partition_file):
94
94
  AlignIO.convert(concatenated_msa_fasta, 'fasta', concatenated_msa_phy, 'phylip-relaxed')
95
95
 
96
96
 
97
+ def get_gap_stats(msa_in_fa, stats_txt):
98
+
99
+ gap_pct_dict = dict()
100
+ for each_seq in SeqIO.parse(msa_in_fa, 'fasta'):
101
+ seq_id = each_seq.id
102
+ seq_str = str(each_seq.seq)
103
+ gap_pct = seq_str.count('-')*100/len(seq_str)
104
+ gap_pct = float("{0:.2f}".format(gap_pct))
105
+ gap_pct_dict[seq_id] = gap_pct
106
+
107
+ gap_pct_sorted = sorted(gap_pct_dict.items(), key=lambda x:x[1])
108
+
109
+ stats_txt_handle = open(stats_txt, 'w')
110
+ stats_txt_handle.write('Sequence\tGap\n')
111
+ for each_seq in gap_pct_sorted:
112
+ stats_txt_handle.write('%s\t%s\n' % (each_seq[0], each_seq[1]))
113
+ stats_txt_handle.close()
114
+
115
+
97
116
  def MarkerSeq2Tree(args):
98
117
 
99
118
  marker_seq_dir = args['i']
@@ -116,14 +135,16 @@ def MarkerSeq2Tree(args):
116
135
  marker_seq_list = sorted(glob.glob(marker_seq_re))
117
136
 
118
137
  # define output dir
119
- renamed_marker_seq_dir = '%s/renamed_markers' % op_dir
120
- renamed_marker_aln_dir = '%s/renamed_markers_aln' % op_dir
121
- renamed_marker_aln_dir_trimmed = '%s/renamed_markers_aln_trimmed' % op_dir
122
- concatenated_phy = '%s/concatenated.phy' % op_dir
123
- concatenated_phy_partition = '%s/concatenated_partition.txt' % op_dir
124
- iqtree_dir = '%s/iqtree_wd' % op_dir
125
- cmds_txt = '%s/cmds.txt' % op_dir
126
- pwd_guide_tree = '%s/iqtree_wd/guide_tree.treefile' % op_dir
138
+ renamed_marker_seq_dir = '%s/renamed_markers' % op_dir
139
+ renamed_marker_aln_dir = '%s/renamed_markers_aln' % op_dir
140
+ renamed_marker_aln_dir_trimmed = '%s/renamed_markers_aln_trimmed' % op_dir
141
+ concatenated_phy = '%s/concatenated.phy' % op_dir
142
+ concatenated_phy_partition = '%s/concatenated_partition.txt' % op_dir
143
+ iqtree_dir = '%s/iqtree_wd' % op_dir
144
+ cmds_1_mafft_txt = '%s/cmds_1_mafft.txt' % op_dir
145
+ cmds_2_trimal_txt = '%s/cmds_2_trimal.txt' % op_dir
146
+ cmds_3_iqtree_txt = '%s/cmds_3_iqtree2.txt' % op_dir
147
+ pwd_guide_tree = '%s/iqtree_wd/guide_tree.treefile' % op_dir
127
148
 
128
149
  # create output folder
129
150
  if os.path.isdir(op_dir) is True:
@@ -155,13 +176,16 @@ def MarkerSeq2Tree(args):
155
176
  marker_hits_seq_renamed_handle.close()
156
177
 
157
178
  # align and trim
158
- mafft_cmd = 'mafft-einsi --thread %s --quiet %s > %s' % (num_of_threads, pwd_renamed_marker_seq, pwd_renamed_marker_aln)
159
- trimal_cmd = 'trimal -in %s -out %s -automated1' % (pwd_renamed_marker_aln, pwd_renamed_marker_aln_trimmed)
179
+ mafft_cmd = 'mafft-einsi --thread %s --quiet %s > %s' % (num_of_threads, pwd_renamed_marker_seq, pwd_renamed_marker_aln)
180
+ trimal_cmd = 'trimal -in %s -out %s -automated1' % (pwd_renamed_marker_aln, pwd_renamed_marker_aln_trimmed)
181
+
182
+ # write out mafft cmds
183
+ with open(cmds_1_mafft_txt, 'a') as cmds_1_mafft_txt_handle:
184
+ cmds_1_mafft_txt_handle.write(mafft_cmd + '\n')
160
185
 
161
- # write out cmds
162
- with open(cmds_txt, 'a') as cmds_txt_handle:
163
- cmds_txt_handle.write(mafft_cmd + '\n')
164
- cmds_txt_handle.write(trimal_cmd + '\n')
186
+ # write out trimal cmds
187
+ with open(cmds_2_trimal_txt, 'a') as cmds_2_trimal_txt_handle:
188
+ cmds_2_trimal_txt_handle.write(trimal_cmd + '\n')
165
189
 
166
190
  # run cmds
167
191
  os.system(mafft_cmd)
@@ -175,10 +199,10 @@ def MarkerSeq2Tree(args):
175
199
  get_guide_tree_cmd = 'iqtree2 --seqtype AA -T %s -B 1000 --alrt 1000 --quiet -s %s --prefix %s/guide_tree -m LG ' % (num_of_threads, concatenated_phy, iqtree_dir, )
176
200
  get_c60_tree_cmd = 'iqtree2 --seqtype AA -T %s -B 1000 --alrt 1000 --quiet -s %s --prefix %s/concatenated -m LG+C60+G+F -ft %s' % (num_of_threads, concatenated_phy, iqtree_dir, pwd_guide_tree)
177
201
 
178
- # write out cmds
179
- with open(cmds_txt, 'a') as cmds_txt_handle:
180
- cmds_txt_handle.write(get_guide_tree_cmd + '\n')
181
- cmds_txt_handle.write(get_c60_tree_cmd + '\n')
202
+ # write out iqtree2 cmds
203
+ with open(cmds_3_iqtree_txt, 'a') as cmds_3_iqtree_txt_handle:
204
+ cmds_3_iqtree_txt_handle.write(get_guide_tree_cmd + '\n')
205
+ cmds_3_iqtree_txt_handle.write(get_c60_tree_cmd + '\n')
182
206
 
183
207
  # run cmds
184
208
  os.system(get_guide_tree_cmd)
@@ -586,7 +586,7 @@ def SplitScore2(args):
586
586
  exit()
587
587
  os.mkdir(step_2_op_dir)
588
588
 
589
- print('Counting sister taxa')
589
+ print('Counting sister taxa with %s cores' % num_of_threads)
590
590
  run_count_sister_taxa(gtdb_classification_txt, contree_ufboot_shared_sorted, qualified_og_seq_dir, qualified_og_seq_dir, gnm_group_txt, target_label, num_of_threads, count_sister_taxa_op_dir, force_overwrite)
591
591
 
592
592
  print('Summarising sister taxa')
@@ -1,3 +1,9 @@
1
+ 1.37.0
2
+ - new module added: recodeAA
3
+
4
+ 1.36.0
5
+ - new module added: gap_stats
6
+
1
7
  1.35.3
2
8
  - fixed bugs
3
9
 
@@ -0,0 +1,38 @@
1
+ import argparse
2
+ from Bio import SeqIO
3
+
4
+
5
+ gap_stats_usage = '''
6
+ ======= gap_stats example commands =======
7
+
8
+ TreeSAK gap_stats -i msa.fasta
9
+
10
+ ==========================================
11
+ '''
12
+
13
+
14
+ def gap_stats(args):
15
+
16
+ msa_in_fa = args['i']
17
+
18
+ gap_pct_dict = dict()
19
+ for each_seq in SeqIO.parse(msa_in_fa, 'fasta'):
20
+ seq_id = each_seq.id
21
+ seq_str = str(each_seq.seq)
22
+ gap_pct = seq_str.count('-')*100/len(seq_str)
23
+ gap_pct = float("{0:.2f}".format(gap_pct))
24
+ gap_pct_dict[seq_id] = gap_pct
25
+
26
+ gap_pct_sorted = sorted(gap_pct_dict.items(), key=lambda x: x[1])
27
+
28
+ print('Sequence\tGap')
29
+ for each_seq in gap_pct_sorted:
30
+ print('%s\t%s' % (each_seq[0], each_seq[1]))
31
+
32
+
33
+ if __name__ == '__main__':
34
+
35
+ gap_stats_parser = argparse.ArgumentParser()
36
+ gap_stats_parser.add_argument('-i', required=True, help='MSA in fasta format')
37
+ args = vars(gap_stats_parser.parse_args())
38
+ gap_stats(args)
@@ -0,0 +1,73 @@
1
+ import argparse
2
+ from Bio import SeqIO
3
+
4
+
5
+ recodeAA_usage = '''
6
+ =========================== recodeAA example commands ===========================
7
+
8
+ TreeSAK recodeAA -i msa.fa -o recoded_msa_D4.fa -c d4
9
+ TreeSAK recodeAA -i msa.fa -o recoded_msa_D6.fa -c d6
10
+ TreeSAK recodeAA -i msa.fa -o recoded_msa_S4.fa -c s4
11
+
12
+ Note:
13
+ This script is modified based on the Recode_aa.py from Anja Spang.
14
+ It was prepared to recode amino acids to Dayoff 4, Dayoff 6 or SR4 categories.
15
+ Please refer to https://doi.org/10.1038/s41467-020-17408-w for details.
16
+
17
+ Recoding schemes
18
+ 1. Selenocysteine will be recoded to a gap.
19
+ 2. Dayhoff6 (d6): A,G,P,S,T = A; D,E,N,Q = D; H,K,R = H; F,Y,W = F; I,L,M,V = I; C = C
20
+ 3. Dayhoff4 (d4): A,G,P,S,T = A; D,E,N,Q = D; H,K,R = H; F,Y,W,I,L,M,V = F; C = ?
21
+ 4. Sr4 (s4): A,G,N,P,S,T = A; C,H,W,Y = C; D,E,K,Q,R = G; F,I,L,M,V = T
22
+
23
+ =================================================================================
24
+ '''
25
+
26
+
27
+ def recodeAA(args):
28
+
29
+ msa_in = args['i']
30
+ msa_out = args['o']
31
+ category = args['c']
32
+
33
+ DH6 = {'A': 'A', 'G': 'A', 'P': 'A', 'S': 'A', 'T': 'A', 'D': 'D', 'E': 'D', 'N': 'D', 'Q': 'D', 'H': 'H', 'K': 'H', 'R': 'H', 'F': 'F', 'Y': 'F', 'W': 'F', 'I': 'I', 'L': 'I', 'M': 'I', 'V': 'I', 'C': 'C'}
34
+ DH4 = {'A': 'A', 'G': 'A', 'P': 'A', 'S': 'A', 'T': 'A', 'D': 'D', 'E': 'D', 'N': 'D', 'Q': 'D', 'H': 'H', 'K': 'H', 'R': 'H', 'F': 'F', 'Y': 'F', 'W': 'F', 'I': 'F', 'L': 'F', 'M': 'F', 'V': 'F', 'C': '-'}
35
+ SR4 = {'A': 'A', 'G': 'A', 'N': 'A', 'P': 'A', 'S': 'A', 'T': 'A', 'C': 'C', 'H': 'C', 'W': 'C', 'Y': 'C', 'D': 'G', 'E': 'G', 'K': 'G', 'Q': 'G', 'R': 'G', 'F': 'T', 'I': 'T', 'L': 'T', 'M': 'T', 'V': 'T'}
36
+
37
+ msa_out_handle = open(msa_out, 'w')
38
+ for seq_record in SeqIO.parse(msa_in, "fasta"):
39
+ header = str(seq_record.description).strip()
40
+ seq = str(seq_record.seq).strip()
41
+ new_seq = ''
42
+ for item in seq:
43
+ if category in ['D6', 'd6']:
44
+ if item in DH6:
45
+ new_seq = new_seq + str(DH6.get(item))
46
+ else:
47
+ new_seq = new_seq + str('-')
48
+ elif category in ['D4', 'd4']:
49
+ if item in DH4:
50
+ new_seq = new_seq + str(DH4.get(item))
51
+ else:
52
+ new_seq = new_seq + str('-')
53
+ elif category in ['S4', 's4']:
54
+ if item in SR4:
55
+ new_seq = new_seq + str(SR4.get(item))
56
+ else:
57
+ new_seq = new_seq + str('-')
58
+ else:
59
+ print('Please choose recoding scheme from d4, d6 and s4, program exited!')
60
+ exit()
61
+
62
+ msa_out_handle.write(">%s\n%s\n" % (header, new_seq))
63
+ msa_out_handle.close()
64
+
65
+
66
+ if __name__ == '__main__':
67
+
68
+ recodeAA_parser = argparse.ArgumentParser(description='Recode amino acids to Dayoff 4, Dayoff 6 or SR4 categories')
69
+ recodeAA_parser.add_argument('-i', required=True, help='input file')
70
+ recodeAA_parser.add_argument('-c', required=True, help='recoding scheme, choose from d4, d6 and s4')
71
+ recodeAA_parser.add_argument('-o', required=True, help='output file')
72
+ args = vars(recodeAA_parser.parse_args())
73
+ recodeAA(args)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.35.3
3
+ Version: 1.37.0
4
4
  Summary: BioSAK
5
5
  Home-page: https://github.com/songweizhi/TreeSAK
6
6
  Author: Weizhi Song
@@ -24,4 +24,4 @@ Requires-Dist: kaleido
24
24
  Requires-Dist: PyPDF3
25
25
  Requires-Dist: dendropy
26
26
 
27
- TreeSAK v1.35.3
27
+ TreeSAK v1.37.0
@@ -68,6 +68,7 @@ TreeSAK/dating_ss.py
68
68
  TreeSAK/do_rrtc.rb
69
69
  TreeSAK/fa2phy.py
70
70
  TreeSAK/format_leaf_name.py
71
+ TreeSAK/gap_stats.py
71
72
  TreeSAK/get_arCOG_seq.py
72
73
  TreeSAK/global_functions.py
73
74
  TreeSAK/merge_pdf.py
@@ -76,6 +77,7 @@ TreeSAK/parse_deltall_stdout.py
76
77
  TreeSAK/plot_distruibution_th.py
77
78
  TreeSAK/prep_mcmctree_ctl.py
78
79
  TreeSAK/print_leaves.py
80
+ TreeSAK/recodeAA.py
79
81
  TreeSAK/rename_leaves.py
80
82
  TreeSAK/replace_clade.py
81
83
  TreeSAK/root_with_out_group.py
@@ -52,6 +52,8 @@ def print_main_help():
52
52
  SingleLinePhy -> Put sequences in single line in phylip format
53
53
  AlignmentPruner -> Remove heterogenous sites from MSA
54
54
  CS_trim -> (to be added) perform chi-squared trimming to reduce compositional heterogeneity
55
+ gap_stats -> The percentage of gap in each sequence of a MSA
56
+ recodeAA -> Recode amino acids to Dayoff 4, Dayoff 6 or SR4 categories
55
57
 
56
58
  Tree-related
57
59
  PB -> Infer tree with PhyloBayes-MPI
@@ -88,7 +90,7 @@ def print_main_help():
88
90
  Phylo-related stats
89
91
  PhyloBiAssoc -> A wrapper for binaryPGLMM test
90
92
 
91
- # Upgrade with "pip3 install --upgrade TreeSAK"
93
+ # Upgrade with: pip3 install --upgrade TreeSAK
92
94
  ''' % version(config_dict)
93
95
 
94
96
  print(help_message)
@@ -706,6 +708,22 @@ if __name__ == '__main__':
706
708
  args = vars(parser.parse_args())
707
709
  AssessPB.AssessPB(args)
708
710
 
711
+ elif sys.argv[1] == 'gap_stats':
712
+ from TreeSAK import gap_stats
713
+ gap_stats_parser = subparsers.add_parser('gap_stats', usage=gap_stats.gap_stats_usage)
714
+ gap_stats_parser.add_argument('-i', required=True, help='MSA in fasta format')
715
+ args = vars(parser.parse_args())
716
+ gap_stats.gap_stats(args)
717
+
718
+ elif sys.argv[1] == 'recodeAA':
719
+ from TreeSAK import recodeAA
720
+ recodeAA_parser = subparsers.add_parser('recodeAA', usage=recodeAA.recodeAA_usage)
721
+ recodeAA_parser.add_argument('-i', required=True, help='input file')
722
+ recodeAA_parser.add_argument('-c', required=True, help='recoding scheme, choose from d4, d6 and s4')
723
+ recodeAA_parser.add_argument('-o', required=True, help='output file')
724
+ args = vars(parser.parse_args())
725
+ recodeAA.recodeAA(args)
726
+
709
727
  else:
710
728
  print('Unrecognized command: %s, program exited' % sys.argv[1])
711
729
  exit()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes