TreeSAK 1.45.4__tar.gz → 1.46.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 (115) hide show
  1. {TreeSAK-1.45.4/TreeSAK.egg-info → TreeSAK-1.46.0}/PKG-INFO +2 -2
  2. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/README.md +13 -6
  3. TreeSAK-1.46.0/TreeSAK/FigTree.py +34 -0
  4. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/VERSION +5 -2
  5. TreeSAK-1.46.0/TreeSAK/cogTree.py +186 -0
  6. TreeSAK-1.45.4/TreeSAK/FunTree.py → TreeSAK-1.46.0/TreeSAK/koTree.py +21 -24
  7. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/supertree.py +2 -0
  8. {TreeSAK-1.45.4 → TreeSAK-1.46.0/TreeSAK.egg-info}/PKG-INFO +2 -2
  9. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK.egg-info/SOURCES.txt +3 -1
  10. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/bin/TreeSAK +34 -17
  11. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/LICENSE +0 -0
  12. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/MANIFEST.in +0 -0
  13. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE.py +0 -0
  14. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE1.py +0 -0
  15. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE2.py +0 -0
  16. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE2RTC.py +0 -0
  17. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE3.py +0 -0
  18. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE4.py +0 -0
  19. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE5.py +0 -0
  20. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE6.py +0 -0
  21. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE7.py +0 -0
  22. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ALE_backup.py +0 -0
  23. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/AssessCVG.py +0 -0
  24. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/AssessMarker.py +0 -0
  25. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
  26. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/AssessMarkerPA.py +0 -0
  27. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/AssessPB.py +0 -0
  28. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/BMGE.jar +0 -0
  29. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/BMGE.py +0 -0
  30. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/CompareMCMC.py +0 -0
  31. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ConcateMSA.py +0 -0
  32. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ConvertMSA.py +0 -0
  33. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/Dir.rb +0 -0
  34. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ExtractMarkerSeq.py +0 -0
  35. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/FastRoot.py +0 -0
  36. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/FastRoot_backup.py +0 -0
  37. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/GTDB_tree.py +0 -0
  38. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/KEGG_Luo17.py +0 -0
  39. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/LcaToLeaves.py +0 -0
  40. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/MarkerRef2Tree.py +0 -0
  41. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
  42. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/MarkerSeq2Tree.py +0 -0
  43. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ModifyTopo.py +0 -0
  44. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/Newick_tree_plotter.py +0 -0
  45. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/OMA.py +0 -0
  46. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/OMA2.py +0 -0
  47. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/OneLineAln.py +0 -0
  48. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/PB.py +0 -0
  49. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/PMSF.py +0 -0
  50. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/PhyloBiAssoc.R +0 -0
  51. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/PhyloBiAssoc.py +0 -0
  52. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/PlotMCMC.py +0 -0
  53. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/PlotMcmcNode.py +0 -0
  54. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/RootTree.py +0 -0
  55. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/RootTreeGTDB214.py +0 -0
  56. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/RootTreeGTDB220.py +0 -0
  57. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SequentialDating.py +0 -0
  58. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SingleAleHGT.py +0 -0
  59. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SingleLinePhy.py +0 -0
  60. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SliceMSA.py +0 -0
  61. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SplitScore.py +0 -0
  62. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SplitScore1.py +0 -0
  63. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SplitScore1OMA.py +0 -0
  64. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/SplitScore2.py +0 -0
  65. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/TaxaCountStats.R +0 -0
  66. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/TaxonTree.py +0 -0
  67. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/TreeSAK_config.py +0 -0
  68. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/VisHPD95.R +0 -0
  69. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/VisHPD95.py +0 -0
  70. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/__init__.py +0 -0
  71. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ale_parser.py +0 -0
  72. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/ale_splitter.py +0 -0
  73. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/alignment_pruner.pl +0 -0
  74. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/catfasta2phy.py +0 -0
  75. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/compare_trees.R +0 -0
  76. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/compare_trees.py +0 -0
  77. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/dating.py +0 -0
  78. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/dating_ss.py +0 -0
  79. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/deltall.py +0 -0
  80. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/do_rrtc.rb +0 -0
  81. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/fa2phy.py +0 -0
  82. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/format_leaf_name.py +0 -0
  83. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/gap_stats.py +0 -0
  84. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/get_SCG_tree.py +0 -0
  85. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/get_arCOG_seq.py +0 -0
  86. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/global_functions.py +0 -0
  87. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/gnm_leaves.py +0 -0
  88. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/iTOL.py +0 -0
  89. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/iTOL_gene_tree.py +0 -0
  90. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/keep_highest_rrtc.py +0 -0
  91. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/label_tree.R +0 -0
  92. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/label_tree.py +0 -0
  93. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/mad.py +0 -0
  94. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/mcmc2tree.py +0 -0
  95. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/mcmcTC.py +0 -0
  96. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/merge_pdf.py +0 -0
  97. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/pRTC.py +0 -0
  98. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/plot_distruibution_th.py +0 -0
  99. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/prep_mcmctree_ctl.py +0 -0
  100. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/print_leaves.py +0 -0
  101. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/pruneMSA.py +0 -0
  102. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/recode.py +0 -0
  103. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/rename_leaves.py +0 -0
  104. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/replace_clade.py +0 -0
  105. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/root_with_out_group.py +0 -0
  106. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
  107. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/subsample_drep_gnms.py +0 -0
  108. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/subset.py +0 -0
  109. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
  110. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK/weighted_rand.rb +0 -0
  111. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK.egg-info/dependency_links.txt +0 -0
  112. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK.egg-info/requires.txt +0 -0
  113. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/TreeSAK.egg-info/top_level.txt +0 -0
  114. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/setup.cfg +0 -0
  115. {TreeSAK-1.45.4 → TreeSAK-1.46.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.45.4
3
+ Version: 1.46.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.45.4
27
+ TreeSAK v1.46.0
@@ -4,6 +4,7 @@
4
4
  [![pypi licence ](https://img.shields.io/pypi/l/TreeSAK.svg)](https://opensource.org/licenses/gpl-3.0.html)
5
5
  [![pypi version ](https://img.shields.io/pypi/v/TreeSAK.svg)](https://pypi.python.org/pypi/TreeSAK)
6
6
 
7
+
7
8
  Contact
8
9
  ---
9
10
 
@@ -29,11 +30,11 @@ Installation
29
30
  TreeSAK modules
30
31
  ---
31
32
 
32
- ...::: TreeSAK v1.38.7 :::...
33
+ ...::: TreeSAK v1.45.5 :::...
33
34
 
34
35
  Marker-related
35
36
  ExtractMarkerSeq -> Extract marker by blastn
36
- parse_deltall_stdout -> Parse stdout of deltaLL.rb
37
+ deltall -> Parse stdout of deltaLL.rb
37
38
  get_arCOG_seq -> Retrieve arCOG sequences
38
39
  AssessMarkerPA -> Assess Markers by P/A among groups
39
40
  SplitScore -> Assess markers by split score
@@ -46,8 +47,8 @@ TreeSAK modules
46
47
  pruneMSA -> Prune MSA with alignment_pruner.pl
47
48
  recodeAA -> Recode amino acids to Dayoff 4, Dayoff 6 or SR4 categories
48
49
  fa2phy -> Convert MSA format (fasta to phylip)
49
- SliceMSA -> Slice MSA by column
50
- ConcateMSA -> Concatenate MSA
50
+ SliceMSA -> Slice MSA by column
51
+ ConcateMSA -> Concatenate MSAs
51
52
  ConvertMSA -> Convert MSA format
52
53
  OneLineAln -> One-line fasta format alignments
53
54
  SingleLinePhy -> Put sequences in single line in phylip format
@@ -56,12 +57,15 @@ TreeSAK modules
56
57
 
57
58
  Tree-related
58
59
  iTOL -> Prepare iTOL files
60
+ iTOL_gene_tree -> Genome metadata to gene metadata
59
61
  PB -> Infer tree with PhyloBayes-MPI
62
+ supertree -> Infer species tree from gene trees
60
63
  AssessPB -> Compare PhyloBayes chains
61
64
  MarkerSeq2Tree -> Marker sequence to tree
62
65
  MarkerRef2Tree -> Marker (reference sequence) to Tree
63
- GTDB_tree -> get GTDB tree
66
+ GTDB_tree -> Get GTDB tree
64
67
  subset -> Subset tree
68
+ TaxonTree -> Subset GTDB tree by taxon
65
69
  compare_trees -> Compare trees with Mantel test
66
70
  rename_leaves -> Rename tree leaves
67
71
  print_leaves -> print out tree leaves
@@ -69,6 +73,7 @@ TreeSAK modules
69
73
  ModifyTopo -> Modify tree topology
70
74
  GeneRax -> (to be added) Run GeneRax
71
75
  ALE -> Modules for running ALE
76
+ FunTree -> Infer tree for individual COG/KEGG function
72
77
  RootTree -> Root tree with outgroup leaves
73
78
  RootTreeGTDB214 -> Root tree by GTDB taxonomy (r214)
74
79
  RootTreeGTDB220 -> Root tree by GTDB taxonomy (r220)
@@ -80,12 +85,14 @@ TreeSAK modules
80
85
  PPA -> (to be added) Perform Posterior Predictive Analysis (across-site)
81
86
 
82
87
  Dating-related
83
- Dating -> Perform molecular dating
88
+ dating -> Perform molecular dating
84
89
  AssessCVG -> Assess dating convergence
85
90
  CompareMCMC -> Compare MCMCTree outputs
86
91
  PlotMcmcNode -> distribution of node's age estimation
87
92
  VisHPD95 -> HPD95 of estimated node age
88
93
  pRTC -> Perform probabilistic RTC dating
94
+ mcmcTC -> adding time constraints to mcmctree tree
95
+ mcmc2tree -> get the tree with internal node id from mcmctree output
89
96
 
90
97
  Phylo-related stats
91
98
  PhyloBiAssoc -> A wrapper for binaryPGLMM test
@@ -0,0 +1,34 @@
1
+ import os
2
+ import argparse
3
+ from ete3 import Tree
4
+
5
+
6
+ FigTree_usage = '''
7
+ ====================== FigTree example commands ======================
8
+
9
+ TreeSAK FigTree -h
10
+
11
+ ======================================================================
12
+ '''
13
+
14
+
15
+ def FigTree(args):
16
+
17
+ input_txt_file = args['i']
18
+ op_txt = args['o']
19
+
20
+ if os.path.isfile(input_txt_file) is False:
21
+ print('Metadata file not found, program exited!')
22
+ exit()
23
+
24
+
25
+ if __name__ == '__main__':
26
+
27
+ FigTree_parser = argparse.ArgumentParser(usage=FigTree_usage)
28
+ FigTree_parser.add_argument('-i', required=True, help='input metadata')
29
+ FigTree_parser.add_argument('-tree', required=False, default=None, help='gene id, in tree file')
30
+ FigTree_parser.add_argument('-txt', required=False, default=None, help='gene id, in txt file')
31
+ FigTree_parser.add_argument('-o', required=True, help='output metadata')
32
+ FigTree_parser.add_argument('-na', required=False, action='store_true', help='include leaves with na values')
33
+ args = vars(FigTree_parser.parse_args())
34
+ FigTree(args)
@@ -1,11 +1,14 @@
1
- 1.45.4
1
+ 1.46.0
2
+ - new module added: cogTree
3
+
4
+ 1.45.5
2
5
  - fixed bugs
3
6
 
4
7
  1.45.0
5
8
  - new module added: iTOL_gene_tree
6
9
 
7
10
  1.44.0
8
- - new module added: FunTree
11
+ - new module added: koTree
9
12
 
10
13
  1.43.0
11
14
  - new module added: ALE7
@@ -0,0 +1,186 @@
1
+ import os
2
+ import glob
3
+ import argparse
4
+ from Bio import SeqIO
5
+ import multiprocessing as mp
6
+
7
+
8
+ cogTree_usage = '''
9
+ ================================ cogTree example commands ================================
10
+
11
+ TreeSAK cogTree -i combined.faa -cog arCOG_wd -o op_dir -bmge -t 12 -f -fun arCOG_id.txt
12
+ TreeSAK cogTree -i combined.faa -cog arCOG_wd -o op_dir -bmge -t 12 -f -fun arCOG00724
13
+ TreeSAK cogTree -i combined.faa -cog arCOG_wd -o op_dir -bmge -t 12 -f -fun arCOG00724,arCOG02271
14
+
15
+ ==========================================================================================
16
+ '''
17
+
18
+
19
+ def select_seq(seq_file, seq_id_set, output_file):
20
+ output_file_handle = open(output_file, 'w')
21
+ for seq_record in SeqIO.parse(seq_file, 'fasta'):
22
+ seq_id = seq_record.id
23
+ if seq_id in seq_id_set:
24
+ SeqIO.write(seq_record, output_file_handle, 'fasta-2line')
25
+ output_file_handle.close()
26
+
27
+
28
+ def cogTree(args):
29
+
30
+ combined_faa = args['i']
31
+ cog_annotation_wd = args['cog']
32
+ interested_fun_txt = args['fun']
33
+ op_dir = args['o']
34
+ trim_with_bmge = args['bmge']
35
+ trim_model = args['bmge_m']
36
+ entropy_score_cutoff = args['bmge_esc']
37
+ iqtree_model = args['iqtree_m']
38
+ force_overwrite = args['f']
39
+ num_of_threads = args['t']
40
+
41
+ # specify path to BMGE.jar
42
+ current_file_path = '/'.join(os.path.realpath(__file__).split('/')[:-1])
43
+ pwd_bmge_jar = '%s/BMGE.jar' % current_file_path
44
+
45
+ interested_fun_set = set()
46
+ if os.path.isfile(interested_fun_txt) is False:
47
+ if ',' in interested_fun_txt:
48
+ interested_fun_set = interested_fun_txt.split(',')
49
+ else:
50
+ interested_fun_set.add(interested_fun_txt)
51
+ else:
52
+ for each_fun in open(interested_fun_txt):
53
+ interested_fun_set.add(each_fun.strip().split()[0])
54
+
55
+ ################################################################################
56
+
57
+ faa_dir = '%s/dir_1_faa' % op_dir
58
+ aln_dir = '%s/dir_2_msa' % op_dir
59
+ trimmed_aln_dir = '%s/dir_3_trimmed_msa' % op_dir
60
+ tree_dir = '%s/dir_4_tree' % op_dir
61
+ cmd_1_mafft_txt = '%s/cmd_1_mafft.txt' % op_dir
62
+ cmd_2_trim_txt = '%s/cmd_2_trim.txt' % op_dir
63
+ cmd_3_tree_txt = '%s/cmd_3_tree.txt' % op_dir
64
+
65
+ ################################################################################
66
+
67
+ # create output folder
68
+ if os.path.isdir(op_dir) is True:
69
+ if force_overwrite is True:
70
+ os.system('rm -r %s' % op_dir)
71
+ else:
72
+ print('%s exist, program exited!' % op_dir)
73
+ exit()
74
+
75
+ os.mkdir(op_dir)
76
+ os.mkdir(faa_dir)
77
+ os.mkdir(aln_dir)
78
+ os.mkdir(trimmed_aln_dir)
79
+ os.mkdir(tree_dir)
80
+
81
+ ################################################################################
82
+
83
+ fun_to_gene_dict = dict()
84
+ if cog_annotation_wd is not None:
85
+
86
+ print('Reading in COG annotation results')
87
+ file_re = '%s/*COG_wd/*_query_to_cog.txt' % (cog_annotation_wd)
88
+ file_list = glob.glob(file_re)
89
+
90
+ if len(file_list) == 0:
91
+ print('COG annotation file not detected, program exited!')
92
+ exit()
93
+
94
+ for each_file in file_list:
95
+ line_index = 0
96
+ for each_line in open(each_file):
97
+ if line_index > 0:
98
+ each_line_split = each_line.strip().split('\t')
99
+ if len(each_line_split) == 4:
100
+ gene_id = each_line_split[0]
101
+ cog_id = each_line_split[4][2:]
102
+ if cog_id in interested_fun_set:
103
+ if cog_id not in fun_to_gene_dict:
104
+ fun_to_gene_dict[cog_id] = set()
105
+ fun_to_gene_dict[cog_id].add(gene_id)
106
+ line_index += 1
107
+
108
+ cmd_list_mafft = []
109
+ cmd_list_trim = []
110
+ cmd_list_tree = []
111
+ cmd_1_mafft_txt_handle = open(cmd_1_mafft_txt, 'w')
112
+ cmd_2_trim_txt_handle = open(cmd_2_trim_txt, 'w')
113
+ cmd_3_tree_txt_handle = open(cmd_3_tree_txt, 'w')
114
+ for each_fun in sorted(fun_to_gene_dict):
115
+
116
+ # define file name
117
+ fun_faa = '%s/%s.faa' % (faa_dir, each_fun)
118
+ current_gene_tree_dir = '%s/%s' % (tree_dir, each_fun)
119
+ fun_aln = '%s/%s.aln' % (aln_dir, each_fun)
120
+ fun_aln_trimmed = '%s/%s_trimal.aln' % (trimmed_aln_dir, each_fun)
121
+ if trim_with_bmge is True:
122
+ fun_aln_trimmed = '%s/%s_bmge.aln' % (trimmed_aln_dir, each_fun)
123
+
124
+ # extract sequences
125
+ current_fun_gene_set = fun_to_gene_dict[each_fun]
126
+ select_seq(combined_faa, current_fun_gene_set, fun_faa)
127
+
128
+ os.system('mkdir %s' % current_gene_tree_dir)
129
+
130
+ # prepare commands
131
+ mafft_cmd = 'mafft-einsi --thread %s --quiet %s > %s' % (1, fun_faa, fun_aln)
132
+ trim_cmd = 'trimal -in %s -out %s -automated1' % (fun_aln, fun_aln_trimmed)
133
+ if trim_with_bmge is True:
134
+ trim_cmd = 'java -jar %s -i %s -m %s -t AA -h %s -of %s' % (pwd_bmge_jar, fun_aln, trim_model, entropy_score_cutoff, fun_aln_trimmed)
135
+ infer_tree_cmd = 'iqtree2 -s %s --seqtype AA -m %s -B 1000 --wbtl --bnni --prefix %s/%s -T %s --quiet' % (fun_aln_trimmed, iqtree_model, current_gene_tree_dir, each_fun, num_of_threads)
136
+
137
+ # add commands to list
138
+ cmd_list_mafft.append(mafft_cmd)
139
+ cmd_list_trim.append(trim_cmd)
140
+ cmd_list_tree.append(infer_tree_cmd)
141
+
142
+ # write out commands
143
+ cmd_1_mafft_txt_handle.write(mafft_cmd + '\n')
144
+ cmd_2_trim_txt_handle.write(trim_cmd + '\n')
145
+ cmd_3_tree_txt_handle.write(infer_tree_cmd + '\n')
146
+
147
+ cmd_1_mafft_txt_handle.close()
148
+ cmd_2_trim_txt_handle.close()
149
+ cmd_3_tree_txt_handle.close()
150
+
151
+ # run mafft commands
152
+ print('Running mafft with %s cores for %s commands' % (num_of_threads, len(cmd_list_mafft)))
153
+ pool = mp.Pool(processes=num_of_threads)
154
+ pool.map(os.system, cmd_list_mafft)
155
+ pool.close()
156
+ pool.join()
157
+
158
+ # run trim commands
159
+ print('Trimming with %s cores for %s commands' % (num_of_threads, len(cmd_list_trim)))
160
+ pool = mp.Pool(processes=num_of_threads)
161
+ pool.map(os.system, cmd_list_trim)
162
+ pool.close()
163
+ pool.join()
164
+
165
+ # run iqtree commands
166
+ print('Running iqtree with %s cores' % num_of_threads)
167
+ for each_iqtree_cmd in sorted(cmd_list_tree):
168
+ print(each_iqtree_cmd)
169
+ os.system(each_iqtree_cmd)
170
+
171
+
172
+ if __name__ == '__main__':
173
+
174
+ cogTree_parser = argparse.ArgumentParser()
175
+ cogTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
176
+ cogTree_parser.add_argument('-fun', required=True, help='interested functions')
177
+ cogTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
178
+ cogTree_parser.add_argument('-o', required=True, help='output directory')
179
+ cogTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
180
+ cogTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
181
+ cogTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
182
+ cogTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
183
+ cogTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
184
+ cogTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
185
+ args = vars(cogTree_parser.parse_args())
186
+ cogTree(args)
@@ -5,14 +5,14 @@ from Bio import SeqIO
5
5
  import multiprocessing as mp
6
6
 
7
7
 
8
- FunTree_usage = '''
9
- ================================ FunTree example commands ================================
8
+ koTree_usage = '''
9
+ ================================ koTree example commands ================================
10
10
 
11
- TreeSAK FunTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun ko.txt
12
- TreeSAK FunTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun K01995
13
- TreeSAK FunTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun K01995,K01996
11
+ TreeSAK koTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun ko_id.txt
12
+ TreeSAK koTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun K01995
13
+ TreeSAK koTree -i combined.faa -kegg KEGG_wd -o op_dir -bmge -t 12 -f -fun K01995,K01996
14
14
 
15
- ==========================================================================================
15
+ =========================================================================================
16
16
  '''
17
17
 
18
18
 
@@ -25,10 +25,9 @@ def select_seq(seq_file, seq_id_set, output_file):
25
25
  output_file_handle.close()
26
26
 
27
27
 
28
- def FunTree(args):
28
+ def koTree(args):
29
29
 
30
30
  combined_faa = args['i']
31
- cog_annotation_wd = args['cog']
32
31
  kegg_annotation_wd = args['kegg']
33
32
  interested_fun_txt = args['fun']
34
33
  op_dir = args['o']
@@ -172,26 +171,24 @@ def FunTree(args):
172
171
 
173
172
  if __name__ == '__main__':
174
173
 
175
- FunTree_parser = argparse.ArgumentParser()
176
- FunTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
177
- FunTree_parser.add_argument('-fun', required=True, help='interested functions')
178
- FunTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
179
- FunTree_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation results')
180
- FunTree_parser.add_argument('-o', required=True, help='output directory')
181
- FunTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
182
- FunTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
183
- FunTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
184
- FunTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
185
- FunTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
186
- FunTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
187
- args = vars(FunTree_parser.parse_args())
188
- FunTree(args)
174
+ koTree_parser = argparse.ArgumentParser()
175
+ koTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
176
+ koTree_parser.add_argument('-fun', required=True, help='interested functions')
177
+ koTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
178
+ koTree_parser.add_argument('-o', required=True, help='output directory')
179
+ koTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
180
+ koTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
181
+ koTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
182
+ koTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
183
+ koTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
184
+ koTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
185
+ args = vars(koTree_parser.parse_args())
186
+ koTree(args)
187
+
189
188
 
190
189
  '''
191
190
 
192
191
  cd /scratch/PI/ocessongwz/Sponge_r220/4_OMA_wd/OMA_wd/Output
193
192
  TreeSAK FunTree -i /scratch/PI/ocessongwz/Sponge_r220/3_combined_genomes_50_5_dRep97_291.faa -fun K01995,K01996,K01997,K01998,K01999 -kegg /scratch/PI/ocessongwz/Sponge_r220/3_combined_genomes_50_5_dRep97_291_KEGG_wd -o interested_fun_tree_branched_chain_aa_transport_system -bmge -t 12 -f
194
193
 
195
- /scratch/PI/ocessongwz/Sponge_r220/3_combined_genomes_50_5_dRep97_291_arCOG_wd
196
-
197
194
  '''
@@ -9,6 +9,8 @@ import multiprocessing as mp
9
9
  supertree_usage = '''
10
10
  ====================== supertree example commands ======================
11
11
 
12
+ Dependencies: mafft, trimal, bmge and iqtree2
13
+
12
14
  TreeSAK supertree -i best10 -x fa -o best10_astral_tree -bmge -t 12 -f
13
15
 
14
16
  ========================================================================
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.45.4
3
+ Version: 1.46.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.45.4
27
+ TreeSAK v1.46.0
@@ -26,7 +26,7 @@ TreeSAK/Dir.rb
26
26
  TreeSAK/ExtractMarkerSeq.py
27
27
  TreeSAK/FastRoot.py
28
28
  TreeSAK/FastRoot_backup.py
29
- TreeSAK/FunTree.py
29
+ TreeSAK/FigTree.py
30
30
  TreeSAK/GTDB_tree.py
31
31
  TreeSAK/KEGG_Luo17.py
32
32
  TreeSAK/LcaToLeaves.py
@@ -66,6 +66,7 @@ TreeSAK/ale_parser.py
66
66
  TreeSAK/ale_splitter.py
67
67
  TreeSAK/alignment_pruner.pl
68
68
  TreeSAK/catfasta2phy.py
69
+ TreeSAK/cogTree.py
69
70
  TreeSAK/compare_trees.R
70
71
  TreeSAK/compare_trees.py
71
72
  TreeSAK/dating.py
@@ -82,6 +83,7 @@ TreeSAK/gnm_leaves.py
82
83
  TreeSAK/iTOL.py
83
84
  TreeSAK/iTOL_gene_tree.py
84
85
  TreeSAK/keep_highest_rrtc.py
86
+ TreeSAK/koTree.py
85
87
  TreeSAK/label_tree.R
86
88
  TreeSAK/label_tree.py
87
89
  TreeSAK/mad.py
@@ -73,7 +73,8 @@ def print_main_help():
73
73
  ModifyTopo -> Modify tree topology
74
74
  GeneRax -> (to be added) Run GeneRax
75
75
  ALE -> Modules for running ALE
76
- FunTree -> Infer tree for individual COG/KEGG function
76
+ cogTree -> Infer tree for individual COG function
77
+ koTree -> Infer tree for individual KEGG function
77
78
  RootTree -> Root tree with outgroup leaves
78
79
  RootTreeGTDB214 -> Root tree by GTDB taxonomy (r214)
79
80
  RootTreeGTDB220 -> Root tree by GTDB taxonomy (r220)
@@ -780,6 +781,7 @@ if __name__ == '__main__':
780
781
  iTOL_parser.add_argument('-dr', required=False, default=None, help='Donor to Recipient')
781
782
  iTOL_parser.add_argument('-scale', required=False, default=None, help='Scale Values, in format 0-3-6-9')
782
783
  iTOL_parser.add_argument('-lt', required=False, default=None, help='Legend Title')
784
+ iTOL_parser.add_argument('-legend', required=False, action='store_true', help='show legend for ColorStrip')
783
785
  iTOL_parser.add_argument('-o', required=True, help='Output filename')
784
786
  args = vars(parser.parse_args())
785
787
  iTOL.iTOL(args)
@@ -826,22 +828,37 @@ if __name__ == '__main__':
826
828
  args = vars(parser.parse_args())
827
829
  mcmc2tree.mcmc2tree(args)
828
830
 
829
- elif sys.argv[1] == 'FunTree':
830
- from TreeSAK import FunTree
831
- FunTree_parser = subparsers.add_parser('FunTree', usage=FunTree.FunTree_usage)
832
- FunTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
833
- FunTree_parser.add_argument('-fun', required=True, help='interested functions')
834
- FunTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
835
- FunTree_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation results')
836
- FunTree_parser.add_argument('-o', required=True, help='output directory')
837
- FunTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
838
- FunTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
839
- FunTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
840
- FunTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
841
- FunTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
842
- FunTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
843
- args = vars(parser.parse_args())
844
- FunTree.FunTree(args)
831
+ elif sys.argv[1] == 'cogTree':
832
+ from TreeSAK import cogTree
833
+ cogTree_parser = subparsers.add_parser('cogTree', usage=cogTree.cogTree_usage)
834
+ cogTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
835
+ cogTree_parser.add_argument('-fun', required=True, help='interested functions')
836
+ cogTree_parser.add_argument('-cog', required=False, default=None, help='COG annotation results')
837
+ cogTree_parser.add_argument('-o', required=True, help='output directory')
838
+ cogTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
839
+ cogTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
840
+ cogTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
841
+ cogTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
842
+ cogTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
843
+ cogTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
844
+ args = vars(parser.parse_args())
845
+ cogTree.cogTree(args)
846
+
847
+ elif sys.argv[1] == 'koTree':
848
+ from TreeSAK import koTree
849
+ koTree_parser = subparsers.add_parser('koTree', usage=koTree.koTree_usage)
850
+ koTree_parser.add_argument('-i', required=True, help='orthologous gene sequence')
851
+ koTree_parser.add_argument('-fun', required=True, help='interested functions')
852
+ koTree_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation results')
853
+ koTree_parser.add_argument('-o', required=True, help='output directory')
854
+ koTree_parser.add_argument('-bmge', required=False, action="store_true", help='trim with BMGE, default is trimal')
855
+ koTree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='trim model, default: BLOSUM30')
856
+ koTree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='entropy score cutoff, default: 0.55')
857
+ koTree_parser.add_argument('-iqtree_m', required=False, default='LG+G+I', help='iqtree_model, default: LG+G+I')
858
+ koTree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
859
+ koTree_parser.add_argument('-t', required=False, type=int, default=1, help='num of threads, default: 1')
860
+ args = vars(parser.parse_args())
861
+ koTree.koTree(args)
845
862
 
846
863
  elif sys.argv[1] == 'iTOL_gene_tree':
847
864
  from TreeSAK import iTOL_gene_tree
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes