TreeSAK 1.29.3__tar.gz → 1.29.4__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.
- TreeSAK-1.29.4/PKG-INFO +26 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/README.md +2 -2
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE5.py +9 -8
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/OMA.py +16 -8
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/OMA2.py +43 -34
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/VERSION +1 -1
- TreeSAK-1.29.4/TreeSAK/gtdb_root.py +288 -0
- TreeSAK-1.29.4/TreeSAK.egg-info/PKG-INFO +26 -0
- TreeSAK-1.29.4/TreeSAK.egg-info/SOURCES.txt +88 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/bin/TreeSAK +11 -8
- TreeSAK-1.29.3/.gitignore +0 -1
- TreeSAK-1.29.3/PKG-INFO +0 -14
- TreeSAK-1.29.3/TreeSAK/BMGE.jar +0 -0
- TreeSAK-1.29.3/TreeSAK/deltaLL_gene_removal.ipynb +0 -399
- TreeSAK-1.29.3/TreeSAK/iTOL.py +0 -464
- TreeSAK-1.29.3/TreeSAK.egg-info/PKG-INFO +0 -14
- TreeSAK-1.29.3/TreeSAK.egg-info/SOURCES.txt +0 -155
- TreeSAK-1.29.3/TreeSAK_DateArTree/4.sampling_th.py +0 -222
- TreeSAK-1.29.3/TreeSAK_DateArTree/AssessMarker.py +0 -306
- TreeSAK-1.29.3/TreeSAK_DateArTree/HGT/backup/HGT_ALE.py +0 -929
- TreeSAK-1.29.3/TreeSAK_DateArTree/HGT/backup/HGT_MetaCHIP.py +0 -481
- TreeSAK-1.29.3/TreeSAK_DateArTree/HGT/runALE.py +0 -987
- TreeSAK-1.29.3/TreeSAK_DateArTree/combine_trees.py +0 -61
- TreeSAK-1.29.3/TreeSAK_DateArTree/distribution_plot_Tianhua.py +0 -126
- TreeSAK-1.29.3/TreeSAK_DateArTree/get_outgroup_gnms.py +0 -43
- TreeSAK-1.29.3/TreeSAK_DateArTree/get_prokka_cmds.py +0 -23
- TreeSAK-1.29.3/TreeSAK_DateArTree/iTOL_tree.py +0 -60
- TreeSAK-1.29.3/TreeSAK_DateArTree/prototypeSelection.py +0 -618
- TreeSAK-1.29.3/TreeSAK_DateArTree/s1_select_ar_gnm.py +0 -37
- TreeSAK-1.29.3/TreeSAK_DateArTree/s2_psiblast.py +0 -152
- TreeSAK-1.29.3/TreeSAK_DateArTree/s3_Prep_gnm_metadata.py +0 -55
- TreeSAK-1.29.3/TreeSAK_DateArTree/s6_decorate_tree.py +0 -71
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/Marker2Tree.py +0 -367
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/ModifyTopo.py +0 -114
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/Tianhua_deltaLL.py +0 -126
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/Tianhua_main_deno100.py +0 -368
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/batch_access_itol_Tianhua.py +0 -54
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/deltaLL_gene_removal.ipynb +0 -399
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/do_rrtc.rb +0 -364
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/fit_mcmctree_posterior.R +0 -156
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/itol_tree.py +0 -44
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/merged_two_trees.py +0 -26
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/plot_tree.py +0 -151
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/s2_assess_markers.py +0 -305
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/s2_select_assessed_marker.py +0 -114
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/s4_get_dm_Mash.py +0 -45
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/s4_get_dm_fastANI.py +0 -44
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/tmp_1.py +0 -87
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/tmp_2.py +0 -38
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/tmp_3.py +0 -13
- TreeSAK-1.29.3/TreeSAK_DateArTree/script_backup/true_by_prob.py +0 -17
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/dating_pro.py +0 -420
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/deltaLL.py +0 -210
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/final_params.py +0 -80
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/main_deno100.py +0 -368
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/multiple_sbatch.py +0 -155
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/untouched_backup/deltaLL.py +0 -126
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/untouched_backup/final_params.py +0 -80
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/untouched_backup/main_deno100.py +0 -368
- TreeSAK-1.29.3/TreeSAK_DateArTree/scripts/untouched_backup/multiple_sbatch.py +0 -155
- TreeSAK-1.29.3/TreeSAK_DateArTree/submit_cmds.py +0 -27
- TreeSAK-1.29.3/TreeSAK_DateArTree/tests_to_perform.py +0 -13
- TreeSAK-1.29.3/TreeSAK_DateArTree/tmp_1.py +0 -49
- TreeSAK-1.29.3/TreeSAK_DateArTree/tmp_2.py +0 -49
- TreeSAK-1.29.3/TreeSAK_DateArTree/tmp_3.py +0 -57
- TreeSAK-1.29.3/TreeSAK_DateArTree/tmp_4.py +0 -72
- TreeSAK-1.29.3/TreeSAK_DateArTree/tmp_5.py +0 -404
- TreeSAK-1.29.3/TreeSAK_Sponge/extract_gnm_source.py +0 -47
- TreeSAK-1.29.3/TreeSAK_Sponge/get_prokka_cmds.py +0 -30
- TreeSAK-1.29.3/TreeSAK_Sponge/prep_metadata.py +0 -344
- TreeSAK-1.29.3/TreeSAK_Sponge/summarise_OMA_annotation.py +0 -97
- TreeSAK-1.29.3/TreeSAK_Sponge/tmp_1.py +0 -48
- TreeSAK-1.29.3/TreeSAK_Sponge/tmp_2.py +0 -21
- TreeSAK-1.29.3/TreeSAK_Sponge/tmp_3.py +0 -43
- TreeSAK-1.29.3/TreeSAK_Sponge/tmp_4.py +0 -42
- TreeSAK-1.29.3/TreeSAK_Sponge/tmp_5.py +0 -19
- TreeSAK-1.29.3/bin/__init__.py +0 -0
- TreeSAK-1.29.3/docs/BMGE_doc.pdf +0 -0
- TreeSAK-1.29.3/images/Bioinformatics.jpg +0 -0
- TreeSAK-1.29.3/images/windows_cmds.docx +0 -0
- TreeSAK-1.29.3/images/windows_cmds.pdf +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/LICENSE +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/MANIFEST.in +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE1.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE2.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE2RTC.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE3.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE4.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ALE_backup.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/AlignmentPruner.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/AssessMarker.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/AssessMarkerPA.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/BMGE.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/CompareMCMC.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ConcateMSA.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/Dating.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/Dir.rb +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/FastRoot.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/FastRoot_backup.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/GTDB_tree.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/KEGG_Luo17.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/LcaToLeaves.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/MCMCtreeR.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/MarkerRef2Tree.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ModifyTopo.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/PMSF.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/PlotMcmcNode.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/RootTree.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SequentialDating.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SingleAleHGT.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SingleLinePhy.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SplitScore.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SplitScore1.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SplitScore1OMA.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/SplitScore2.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/TaxaCountStats.R +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/VisHPD95.R +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/VisHPD95.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ale_parser.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/ale_splitter.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/do_rrtc.rb +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/fa2phy.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/global_functions.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/pRTC.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/parse_deltall_stdout.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/plot_distruibution_th.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/print_leaves.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/replace_clades.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/root_with_out_group.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/subsample_drep_gnms.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/subset_tree.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/test_1.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/test_2.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/tmp_1.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/tmp_2.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/tmp_3.py +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK/weighted_rand.rb +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/setup.cfg +0 -0
- {TreeSAK-1.29.3 → TreeSAK-1.29.4}/setup.py +0 -0
TreeSAK-1.29.4/PKG-INFO
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: TreeSAK
|
|
3
|
+
Version: 1.29.4
|
|
4
|
+
Summary: BioSAK
|
|
5
|
+
Home-page: https://github.com/songweizhi/TreeSAK
|
|
6
|
+
Author: Weizhi Song
|
|
7
|
+
Author-email: songwz03@gmail.com
|
|
8
|
+
License: GPL3+
|
|
9
|
+
Keywords: Bioinformatics
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: biopython
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: itolapi
|
|
16
|
+
Requires-Dist: networkx
|
|
17
|
+
Requires-Dist: seaborn
|
|
18
|
+
Requires-Dist: lxml
|
|
19
|
+
Requires-Dist: beautifulsoup4
|
|
20
|
+
Requires-Dist: ete3
|
|
21
|
+
Requires-Dist: arviz
|
|
22
|
+
Requires-Dist: plotly
|
|
23
|
+
Requires-Dist: kaleido
|
|
24
|
+
Requires-Dist: PyPDF3
|
|
25
|
+
|
|
26
|
+
TreeSAK v1.29.4
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
Contact
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
+
|
|
11
|
-
+
|
|
10
|
+
+ Dr Weizhi Song
|
|
11
|
+
+ Department of Ocean Science, Hong Kong University of Science and Technology, Hong Kong
|
|
12
12
|
+ E-mail: songwz03@gmail.com
|
|
13
13
|
|
|
14
14
|
|
|
@@ -2,7 +2,8 @@ import os
|
|
|
2
2
|
import glob
|
|
3
3
|
import operator
|
|
4
4
|
from ete3 import Tree
|
|
5
|
-
from itertools import chain
|
|
5
|
+
from itertools import chain
|
|
6
|
+
from itertools import combinations
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def sep_path_basename_ext(file_in):
|
|
@@ -20,7 +21,7 @@ def sep_path_basename_ext(file_in):
|
|
|
20
21
|
|
|
21
22
|
def powerset(iterable):
|
|
22
23
|
|
|
23
|
-
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
|
|
24
|
+
" powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3) "
|
|
24
25
|
|
|
25
26
|
s = list(iterable) # allows duplicate elements
|
|
26
27
|
chain_obj = chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
|
|
@@ -92,14 +93,14 @@ color_list = ['dodgerblue', 'goldenrod1', 'darkorange1', 'seagreen3
|
|
|
92
93
|
min_detected_times = 2
|
|
93
94
|
|
|
94
95
|
# file out
|
|
95
|
-
op_dir
|
|
96
|
+
op_dir = '/Users/songweizhi/Desktop/DateArTree/05_pRTC_wd/HGTs_5_rds_ALE'
|
|
96
97
|
|
|
97
98
|
########################################################################################################################
|
|
98
99
|
|
|
99
|
-
rscript
|
|
100
|
-
plot_file
|
|
101
|
-
rtc_txt
|
|
102
|
-
rtc_txt_highest
|
|
100
|
+
rscript = '%s/rscript.R' % op_dir
|
|
101
|
+
plot_file = '%s/Venn.pdf' % op_dir
|
|
102
|
+
rtc_txt = '%s/rrtc.txt' % op_dir
|
|
103
|
+
rtc_txt_highest = '%s/rrtc_uniq_by_highest_prob.txt' % op_dir
|
|
103
104
|
|
|
104
105
|
if os.path.isdir(op_dir):
|
|
105
106
|
os.system('rm -r %s' % op_dir)
|
|
@@ -121,7 +122,7 @@ for each_rd in round_list:
|
|
|
121
122
|
for each_pdf in pdf_file_list:
|
|
122
123
|
f_path, f_base, f_ext = sep_path_basename_ext(each_pdf)
|
|
123
124
|
f_base_split = f_base.split('_')
|
|
124
|
-
id_by_d_to_r = '%s_to_%s'
|
|
125
|
+
id_by_d_to_r = '%s_to_%s' % (f_base_split[3], f_base_split[5])
|
|
125
126
|
rd_og = '%s_%s' % (each_rd, f_base_split[0])
|
|
126
127
|
rd_og_value = '%s_%s_%s' % (each_rd, f_base_split[0], f_base_split[6])
|
|
127
128
|
|
|
@@ -4,11 +4,11 @@ import argparse
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
OMA_usage = '''
|
|
7
|
-
|
|
7
|
+
======================= OMA example commands =======================
|
|
8
8
|
|
|
9
9
|
TreeSAK OMA -i faa_files -x faa -og og_gnm.txt -o OMA_wd -f -t 32
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
====================================================================
|
|
12
12
|
'''
|
|
13
13
|
|
|
14
14
|
def sep_path_basename_ext(file_in):
|
|
@@ -102,16 +102,25 @@ def OMA(args):
|
|
|
102
102
|
exit()
|
|
103
103
|
|
|
104
104
|
# copy genome files into DB folder
|
|
105
|
-
pwd_gnm_rename_txt_handle = open(pwd_gnm_rename_txt, 'w')
|
|
106
105
|
gnm_id_rename_dict = dict()
|
|
106
|
+
rename_list = []
|
|
107
107
|
for each_gnm in gnm_file_list:
|
|
108
108
|
gnm_path, gnm_base, gnm_ext = sep_path_basename_ext(each_gnm)
|
|
109
109
|
gnm_base_renamed = gnm_base.replace('.', '_')
|
|
110
110
|
pwd_gnm_db = '%s/%s.fa' % (oma_input_dir, gnm_base_renamed)
|
|
111
|
-
|
|
111
|
+
if gnm_base != gnm_base_renamed:
|
|
112
|
+
rename_list.append('%s\t%s' % (gnm_base, gnm_base_renamed))
|
|
112
113
|
gnm_id_rename_dict[gnm_base] = gnm_base_renamed
|
|
113
114
|
os.system('cp %s %s' % (each_gnm, pwd_gnm_db))
|
|
114
|
-
|
|
115
|
+
|
|
116
|
+
# write out rename file
|
|
117
|
+
if len(rename_list) > 0:
|
|
118
|
+
pwd_gnm_rename_txt_handle = open(pwd_gnm_rename_txt, 'w')
|
|
119
|
+
for each_e in sorted(rename_list):
|
|
120
|
+
pwd_gnm_rename_txt_handle.write(each_e + '\n')
|
|
121
|
+
pwd_gnm_rename_txt_handle.close()
|
|
122
|
+
else:
|
|
123
|
+
print('Format of file names passed checking')
|
|
115
124
|
|
|
116
125
|
# get default_para_dict
|
|
117
126
|
default_para_dict = get_default_para_dict()
|
|
@@ -121,7 +130,6 @@ def OMA(args):
|
|
|
121
130
|
for each_og_gnm in open(og_gnm_txt):
|
|
122
131
|
og_gnm_renamed = gnm_id_rename_dict[each_og_gnm.strip()]
|
|
123
132
|
renamed_og_gnm_list.append(og_gnm_renamed)
|
|
124
|
-
print(renamed_og_gnm_list)
|
|
125
133
|
|
|
126
134
|
# write out parameter file
|
|
127
135
|
with open(pwd_parameter_file, 'w') as pwd_parameter_file_handle:
|
|
@@ -145,6 +153,7 @@ def OMA(args):
|
|
|
145
153
|
print('You can run OMA with:')
|
|
146
154
|
print('cd %s' % op_dir)
|
|
147
155
|
print('oma -n %s' % num_threads)
|
|
156
|
+
print('# You may want to customize parameters specified in %s ' % pwd_parameter_file)
|
|
148
157
|
|
|
149
158
|
|
|
150
159
|
if __name__ == '__main__':
|
|
@@ -153,10 +162,9 @@ if __name__ == '__main__':
|
|
|
153
162
|
OMA_parser.add_argument('-i', required=True, help='genome folder')
|
|
154
163
|
OMA_parser.add_argument('-x', required=True, help='genome file extension')
|
|
155
164
|
OMA_parser.add_argument('-st', required=False, default='AA', help='sequence type, AA or DNA, default: AA')
|
|
156
|
-
OMA_parser.add_argument('-og', required=True, help='
|
|
165
|
+
OMA_parser.add_argument('-og', required=True, help='outgroup genomes, without file extension')
|
|
157
166
|
OMA_parser.add_argument('-o', required=True, default=None, help='output dir, i.e., OMA working directory')
|
|
158
167
|
OMA_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
159
168
|
OMA_parser.add_argument('-t', required=False, type=int, default=6, help='number of threads for running OMA, default: 6')
|
|
160
169
|
args = vars(OMA_parser.parse_args())
|
|
161
170
|
OMA(args)
|
|
162
|
-
|
|
@@ -4,11 +4,11 @@ from Bio import SeqIO
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
OMA2_usage = '''
|
|
7
|
-
|
|
7
|
+
============================ OMA2 example commands ============================
|
|
8
8
|
|
|
9
|
-
TreeSAK OMA2 -i OrthologousGroups.txt -s
|
|
9
|
+
TreeSAK OMA2 -i OrthologousGroups.txt -s OrthologousGroupsFasta -o op_dir -f
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
===============================================================================
|
|
12
12
|
'''
|
|
13
13
|
|
|
14
14
|
|
|
@@ -46,15 +46,25 @@ def select_seq(seq_in, seq_id_list, seq_out):
|
|
|
46
46
|
|
|
47
47
|
def OMA2(args):
|
|
48
48
|
|
|
49
|
-
og_txt
|
|
50
|
-
|
|
51
|
-
gnm_txt
|
|
52
|
-
op_dir
|
|
53
|
-
force_overwrite
|
|
54
|
-
min_gene_num
|
|
49
|
+
og_txt = args['i']
|
|
50
|
+
og_seq_dir = args['s']
|
|
51
|
+
gnm_txt = args['g']
|
|
52
|
+
op_dir = args['o']
|
|
53
|
+
force_overwrite = args['f']
|
|
54
|
+
min_gene_num = args['n']
|
|
55
55
|
|
|
56
|
-
og_txt_out
|
|
57
|
-
|
|
56
|
+
og_txt_out = '%s/OrthologousGroups_min%s.txt' % (op_dir, min_gene_num)
|
|
57
|
+
filtered_seq_dir = '%s/OrthologousGroupsFasta_min%s' % (op_dir, min_gene_num)
|
|
58
|
+
|
|
59
|
+
# check genome files
|
|
60
|
+
interested_gnm_set = set()
|
|
61
|
+
if gnm_txt is not None:
|
|
62
|
+
if os.path.isfile(gnm_txt) is True:
|
|
63
|
+
for each_gnm in open(gnm_txt):
|
|
64
|
+
interested_gnm_set.add(each_gnm.strip())
|
|
65
|
+
else:
|
|
66
|
+
print('%s not found, program exited!' % gnm_txt)
|
|
67
|
+
exit()
|
|
58
68
|
|
|
59
69
|
# create dir
|
|
60
70
|
if os.path.isdir(op_dir) is True:
|
|
@@ -64,38 +74,37 @@ def OMA2(args):
|
|
|
64
74
|
print('output folder detected, program exited!')
|
|
65
75
|
exit()
|
|
66
76
|
os.system('mkdir %s' % op_dir)
|
|
77
|
+
os.system('mkdir %s' % filtered_seq_dir)
|
|
67
78
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
for each_gnm in open(gnm_txt):
|
|
71
|
-
interested_gnm_set.add(each_gnm.strip())
|
|
72
|
-
|
|
73
|
-
gene_set_to_extract = set()
|
|
74
|
-
og_to_gene_dict = dict()
|
|
79
|
+
id_to_name_dict = dict()
|
|
80
|
+
gene_to_extract_dict = dict()
|
|
75
81
|
og_txt_out_handle = open(og_txt_out, 'w')
|
|
76
82
|
for each_line in open(og_txt):
|
|
77
|
-
if each_line.startswith('#'):
|
|
78
|
-
og_txt_out_handle.write(each_line)
|
|
79
|
-
else:
|
|
83
|
+
if not each_line.startswith('#'):
|
|
80
84
|
each_line_split = each_line.strip().split('\t')
|
|
81
85
|
og_id = each_line_split[0]
|
|
86
|
+
filename = 'OG%s' % int(og_id[3:])
|
|
87
|
+
id_to_name_dict[og_id] = filename
|
|
82
88
|
gene_list = each_line_split[1:]
|
|
83
|
-
|
|
84
|
-
filtered_gene_list_only_id = set()
|
|
89
|
+
filtered_gene_set = set()
|
|
85
90
|
for each_gene in gene_list:
|
|
86
91
|
gene_gnm = each_gene.split(':')[0]
|
|
87
|
-
gene_id = each_gene.split(':')[
|
|
88
|
-
if
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
gene_id = each_gene.split(':')[1].split(' ')[0]
|
|
93
|
+
if len(interested_gnm_set) == 0:
|
|
94
|
+
filtered_gene_set.add(gene_id)
|
|
95
|
+
else:
|
|
96
|
+
if gene_gnm in interested_gnm_set:
|
|
97
|
+
filtered_gene_set.add(gene_id)
|
|
98
|
+
if len(filtered_gene_set) > min_gene_num:
|
|
99
|
+
og_txt_out_handle.write('%s\t%s\n' % (filename, ','.join(sorted(list(filtered_gene_set)))))
|
|
100
|
+
gene_to_extract_dict[og_id] = filtered_gene_set
|
|
95
101
|
og_txt_out_handle.close()
|
|
96
102
|
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
for each_og in gene_to_extract_dict:
|
|
104
|
+
seq_file_name = id_to_name_dict[each_og]
|
|
105
|
+
source_file = '%s/%s.fa' % (og_seq_dir, seq_file_name)
|
|
106
|
+
filtered_file = '%s/%s.fa' % (filtered_seq_dir, seq_file_name)
|
|
107
|
+
select_seq(source_file, gene_to_extract_dict[each_og], filtered_file)
|
|
99
108
|
|
|
100
109
|
print('Done!')
|
|
101
110
|
|
|
@@ -105,7 +114,7 @@ if __name__ == '__main__':
|
|
|
105
114
|
OMA_parser = argparse.ArgumentParser()
|
|
106
115
|
OMA_parser.add_argument('-i', required=True, help='OrthologousGroups.txt')
|
|
107
116
|
OMA_parser.add_argument('-s', required=True, help='sequence dir, OrthologousGroupsFasta')
|
|
108
|
-
OMA_parser.add_argument('-g', required=
|
|
117
|
+
OMA_parser.add_argument('-g', required=False, default=None, help='id of interested genomes')
|
|
109
118
|
OMA_parser.add_argument('-o', required=True, default=None, help='output directory')
|
|
110
119
|
OMA_parser.add_argument('-n', required=False, type=int, default=3, help='minimal number of gene in a OG, deafult: 3')
|
|
111
120
|
OMA_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import random
|
|
3
|
+
import dendropy
|
|
4
|
+
import argparse
|
|
5
|
+
from ete3 import Tree
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
tree_usage = '''
|
|
9
|
+
============================================ tree example command ============================================
|
|
10
|
+
|
|
11
|
+
TreeSAK gtdb_root -tree ar53.unrooted.tree -tax ar53.summary.tsv -db db_dir -d ar -o ar53.rooted.tree
|
|
12
|
+
TreeSAK gtdb_root -tree bac120.unrooted.tree -tax bac120.summary.tsv -db db_dir -d ar -o bac120.rooted.tree
|
|
13
|
+
|
|
14
|
+
# prepare GTDB database files
|
|
15
|
+
cd db_dir
|
|
16
|
+
wget https://data.ace.uq.edu.au/public/gtdb/data/releases/release214/214.1/ar53_r214.tree.tar.gz
|
|
17
|
+
wget https://data.ace.uq.edu.au/public/gtdb/data/releases/release214/214.1/bac120_r214.tree.tar.gz
|
|
18
|
+
wget https://data.ace.uq.edu.au/public/gtdb/data/releases/release214/214.1/ar53_metadata_r214.tsv.gz
|
|
19
|
+
wget https://data.ace.uq.edu.au/public/gtdb/data/releases/release214/214.1/bac120_metadata_r214.tsv.gz
|
|
20
|
+
tar -xzvf ar53_r214.tree.tar.gz
|
|
21
|
+
tar -xzvf bac120_r214.tree.tar.gz
|
|
22
|
+
gunzip ar53_metadata_r214.tsv.gz
|
|
23
|
+
gunzip bac120_metadata_r214.tsv.gz
|
|
24
|
+
|
|
25
|
+
==============================================================================================================
|
|
26
|
+
'''
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_smallest_outgroup(tree_object):
|
|
30
|
+
|
|
31
|
+
min_outgroup_leaf_num = 99999
|
|
32
|
+
for each_root_child in tree_object.children:
|
|
33
|
+
leaf_list = each_root_child.get_leaf_names()
|
|
34
|
+
if len(leaf_list) < min_outgroup_leaf_num:
|
|
35
|
+
min_outgroup_leaf_num = len(leaf_list)
|
|
36
|
+
|
|
37
|
+
out_group_leaf_list = []
|
|
38
|
+
for each_root_child in tree_object.children:
|
|
39
|
+
leaf_list = each_root_child.get_leaf_names()
|
|
40
|
+
if len(leaf_list) == min_outgroup_leaf_num:
|
|
41
|
+
out_group_leaf_list = leaf_list
|
|
42
|
+
|
|
43
|
+
return out_group_leaf_list
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def sep_taxon_str(taxon_string):
|
|
47
|
+
|
|
48
|
+
taxon_string_split = taxon_string.strip().split(';')
|
|
49
|
+
taxon_p = taxon_string_split[1]
|
|
50
|
+
taxon_c = taxon_string_split[2]
|
|
51
|
+
taxon_o = taxon_string_split[3]
|
|
52
|
+
taxon_f = taxon_string_split[4]
|
|
53
|
+
taxon_g = taxon_string_split[5]
|
|
54
|
+
|
|
55
|
+
return taxon_p, taxon_c, taxon_o, taxon_f, taxon_g
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def subset_and_rename_tree(tree_file_in, to_keep_leaf_list, rename_dict):
|
|
59
|
+
|
|
60
|
+
input_tree = Tree(tree_file_in, quoted_node_names=True, format=1)
|
|
61
|
+
|
|
62
|
+
# subset tree
|
|
63
|
+
subset_tree = input_tree.copy()
|
|
64
|
+
subset_tree.prune(to_keep_leaf_list, preserve_branch_length=True)
|
|
65
|
+
|
|
66
|
+
# rename leaf
|
|
67
|
+
for each_leaf in subset_tree:
|
|
68
|
+
leaf_name_new = rename_dict.get(each_leaf.name, each_leaf.name)
|
|
69
|
+
each_leaf.name = leaf_name_new
|
|
70
|
+
|
|
71
|
+
return subset_tree
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def root_with_outgroup(input_tree, out_group_list, tree_file_rooted):
|
|
75
|
+
|
|
76
|
+
"""
|
|
77
|
+
Reroot the tree using the given outgroup.
|
|
78
|
+
modified based on: https://github.com/Ecogenomics/GTDBTk/blob/master/gtdbtk/reroot_tree.py
|
|
79
|
+
|
|
80
|
+
input_tree: File containing Newick tree to rerooted.
|
|
81
|
+
output_tree: Name of file for rerooted tree.
|
|
82
|
+
outgroup: Labels of taxa in outgroup.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
tree = dendropy.Tree.get_from_path(input_tree, schema='newick', rooting='force-rooted', preserve_underscores=True)
|
|
86
|
+
|
|
87
|
+
outgroup_in_tree = set()
|
|
88
|
+
ingroup_leaves = set()
|
|
89
|
+
for n in tree.leaf_node_iter():
|
|
90
|
+
if n.taxon.label in out_group_list:
|
|
91
|
+
outgroup_in_tree.add(n.taxon)
|
|
92
|
+
else:
|
|
93
|
+
ingroup_leaves.add(n)
|
|
94
|
+
|
|
95
|
+
# Since finding the MRCA is a rooted tree operation, the tree is first rerooted on an ingroup taxa. This
|
|
96
|
+
# ensures the MRCA of the outgroup can be identified so long as the outgroup is monophyletic. If the
|
|
97
|
+
# outgroup is polyphyletic trying to root on it is ill-defined. To try and pick a "good" root for
|
|
98
|
+
# polyphyletic outgroups, random ingroup taxa are selected until two of them give the same size
|
|
99
|
+
# lineage. This will, likely, be the smallest bipartition possible for the given outgroup though
|
|
100
|
+
# this is not guaranteed.
|
|
101
|
+
|
|
102
|
+
mrca = tree.mrca(taxa=outgroup_in_tree)
|
|
103
|
+
mrca_leaves = len(mrca.leaf_nodes())
|
|
104
|
+
while True:
|
|
105
|
+
rnd_ingroup = random.sample(list(ingroup_leaves), 1)[0]
|
|
106
|
+
tree.reroot_at_edge(rnd_ingroup.edge, length1=0.5 * rnd_ingroup.edge_length, length2=0.5 * rnd_ingroup.edge_length)
|
|
107
|
+
mrca = tree.mrca(taxa=outgroup_in_tree)
|
|
108
|
+
if len(mrca.leaf_nodes()) == mrca_leaves:
|
|
109
|
+
break
|
|
110
|
+
|
|
111
|
+
mrca_leaves = len(mrca.leaf_nodes())
|
|
112
|
+
|
|
113
|
+
if mrca.edge_length is not None:
|
|
114
|
+
tree.reroot_at_edge(mrca.edge, length1=0.5 * mrca.edge_length, length2=0.5 * mrca.edge_length)
|
|
115
|
+
tree.write_to_path(tree_file_rooted, schema='newick', suppress_rooting=True, unquoted_underscores=True)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def gtdb_root(args):
|
|
119
|
+
|
|
120
|
+
input_unrooted_tree = args['tree']
|
|
121
|
+
user_gnm_taxon = args['tax']
|
|
122
|
+
db_dir = args['db']
|
|
123
|
+
gnm_domain = args['d']
|
|
124
|
+
rooted_tree = args['o']
|
|
125
|
+
|
|
126
|
+
# define file name
|
|
127
|
+
gtdb_ref_tree_ar = '%s/ar53_r214.tree' % db_dir
|
|
128
|
+
gtdb_ref_tree_bac = '%s/bac120_r214.tree' % db_dir
|
|
129
|
+
gtdb_gnm_meta_ar = '%s/ar53_metadata_r214.tsv' % db_dir
|
|
130
|
+
gtdb_gnm_meta_bac = '%s/bac120_metadata_r214.tsv' % db_dir
|
|
131
|
+
|
|
132
|
+
if gnm_domain == 'bac':
|
|
133
|
+
gtdb_ref_tree = gtdb_ref_tree_bac
|
|
134
|
+
gtdb_gnm_metadata = gtdb_gnm_meta_bac
|
|
135
|
+
elif gnm_domain == 'ar':
|
|
136
|
+
gtdb_ref_tree = gtdb_ref_tree_ar
|
|
137
|
+
gtdb_gnm_metadata = gtdb_gnm_meta_ar
|
|
138
|
+
else:
|
|
139
|
+
print('please provide either "ar" or "bac" to -d')
|
|
140
|
+
exit()
|
|
141
|
+
|
|
142
|
+
tree = Tree(gtdb_ref_tree, quoted_node_names=True, format=1)
|
|
143
|
+
ref_tree_gnm_list = tree.get_leaf_names()
|
|
144
|
+
ref_tree_gnm_set = {i for i in ref_tree_gnm_list}
|
|
145
|
+
|
|
146
|
+
# read in user_gnm_taxon
|
|
147
|
+
user_gnm_taxon_dict_p = dict()
|
|
148
|
+
user_gnm_taxon_dict_c = dict()
|
|
149
|
+
user_gnm_taxon_dict_o = dict()
|
|
150
|
+
user_gnm_taxon_dict_f = dict()
|
|
151
|
+
user_gnm_taxon_dict_g = dict()
|
|
152
|
+
for each_gnm in open(user_gnm_taxon):
|
|
153
|
+
if not each_gnm.startswith('user_genome\t'):
|
|
154
|
+
each_gnm_split = each_gnm.strip().split('\t')
|
|
155
|
+
gnm_id = each_gnm_split[0]
|
|
156
|
+
gnm_taxon = each_gnm_split[1]
|
|
157
|
+
|
|
158
|
+
count_current_gnm = False
|
|
159
|
+
if gnm_domain == 'bac':
|
|
160
|
+
if 'd__Bacteria' in gnm_taxon:
|
|
161
|
+
count_current_gnm = True
|
|
162
|
+
elif gnm_domain == 'ar':
|
|
163
|
+
if 'd__Archaea' in gnm_taxon:
|
|
164
|
+
count_current_gnm = True
|
|
165
|
+
|
|
166
|
+
if count_current_gnm is True:
|
|
167
|
+
|
|
168
|
+
gnm_p, gnm_c, gnm_o, gnm_f, gnm_g = sep_taxon_str(gnm_taxon)
|
|
169
|
+
|
|
170
|
+
if gnm_p not in user_gnm_taxon_dict_p:
|
|
171
|
+
user_gnm_taxon_dict_p[gnm_p] = set()
|
|
172
|
+
if gnm_c not in user_gnm_taxon_dict_c:
|
|
173
|
+
user_gnm_taxon_dict_c[gnm_c] = set()
|
|
174
|
+
if gnm_o not in user_gnm_taxon_dict_o:
|
|
175
|
+
user_gnm_taxon_dict_o[gnm_o] = set()
|
|
176
|
+
if gnm_f not in user_gnm_taxon_dict_f:
|
|
177
|
+
user_gnm_taxon_dict_f[gnm_f] = set()
|
|
178
|
+
if gnm_g not in user_gnm_taxon_dict_g:
|
|
179
|
+
user_gnm_taxon_dict_g[gnm_g] = set()
|
|
180
|
+
|
|
181
|
+
user_gnm_taxon_dict_p[gnm_p].add(gnm_id)
|
|
182
|
+
user_gnm_taxon_dict_c[gnm_c].add(gnm_id)
|
|
183
|
+
user_gnm_taxon_dict_o[gnm_o].add(gnm_id)
|
|
184
|
+
user_gnm_taxon_dict_f[gnm_f].add(gnm_id)
|
|
185
|
+
user_gnm_taxon_dict_g[gnm_g].add(gnm_id)
|
|
186
|
+
|
|
187
|
+
# determine rooting rank, start from phylum
|
|
188
|
+
rooting_rank = ''
|
|
189
|
+
rooting_rank_taxon_dict = dict()
|
|
190
|
+
if len(user_gnm_taxon_dict_p) > 1:
|
|
191
|
+
rooting_rank = 'p'
|
|
192
|
+
rooting_rank_taxon_dict = user_gnm_taxon_dict_p
|
|
193
|
+
elif len(user_gnm_taxon_dict_c) > 1:
|
|
194
|
+
rooting_rank = 'c'
|
|
195
|
+
rooting_rank_taxon_dict = user_gnm_taxon_dict_c
|
|
196
|
+
elif len(user_gnm_taxon_dict_o) > 1:
|
|
197
|
+
rooting_rank = 'o'
|
|
198
|
+
rooting_rank_taxon_dict = user_gnm_taxon_dict_o
|
|
199
|
+
elif len(user_gnm_taxon_dict_f) > 1:
|
|
200
|
+
rooting_rank = 'f'
|
|
201
|
+
rooting_rank_taxon_dict = user_gnm_taxon_dict_f
|
|
202
|
+
elif len(user_gnm_taxon_dict_g) > 1:
|
|
203
|
+
rooting_rank = 'g'
|
|
204
|
+
rooting_rank_taxon_dict = user_gnm_taxon_dict_g
|
|
205
|
+
|
|
206
|
+
if rooting_rank == '':
|
|
207
|
+
print('All user genomes are from the same genus, program exited!')
|
|
208
|
+
exit()
|
|
209
|
+
|
|
210
|
+
col_index = {}
|
|
211
|
+
canditate_gnms_rooting_rank = dict()
|
|
212
|
+
counted_taxons_rooting_rank = set()
|
|
213
|
+
for each_ref in open(gtdb_gnm_metadata):
|
|
214
|
+
each_ref_split = each_ref.strip().split('\t')
|
|
215
|
+
if each_ref.startswith('accession ambiguous_bases'):
|
|
216
|
+
col_index = {key: i for i, key in enumerate(each_ref_split)}
|
|
217
|
+
else:
|
|
218
|
+
ref_accession = each_ref_split[0]
|
|
219
|
+
gtdb_taxonomy = each_ref_split[col_index['gtdb_taxonomy']]
|
|
220
|
+
if ref_accession in ref_tree_gnm_set:
|
|
221
|
+
gnm_p, gnm_c, gnm_o, gnm_f, gnm_g = sep_taxon_str(gtdb_taxonomy)
|
|
222
|
+
|
|
223
|
+
gnm_rooting_rank = ''
|
|
224
|
+
if rooting_rank == 'p':
|
|
225
|
+
gnm_rooting_rank = gnm_p
|
|
226
|
+
elif rooting_rank == 'c':
|
|
227
|
+
gnm_rooting_rank = gnm_c
|
|
228
|
+
elif rooting_rank == 'o':
|
|
229
|
+
gnm_rooting_rank = gnm_o
|
|
230
|
+
elif rooting_rank == 'f':
|
|
231
|
+
gnm_rooting_rank = gnm_f
|
|
232
|
+
elif rooting_rank == 'g':
|
|
233
|
+
gnm_rooting_rank = gnm_g
|
|
234
|
+
|
|
235
|
+
# rooting_rank
|
|
236
|
+
if gnm_rooting_rank in rooting_rank_taxon_dict:
|
|
237
|
+
if gnm_rooting_rank not in counted_taxons_rooting_rank:
|
|
238
|
+
counted_taxons_rooting_rank.add(gnm_rooting_rank)
|
|
239
|
+
canditate_gnms_rooting_rank[ref_accession] = gnm_rooting_rank
|
|
240
|
+
|
|
241
|
+
ref_tree_rooting_rank = subset_and_rename_tree(gtdb_ref_tree, canditate_gnms_rooting_rank, canditate_gnms_rooting_rank)
|
|
242
|
+
|
|
243
|
+
# get the smallest out group taxon set
|
|
244
|
+
smallest_outgroup_taxon_list = get_smallest_outgroup(ref_tree_rooting_rank)
|
|
245
|
+
|
|
246
|
+
user_gnm_taxon_dict_rooting_rank = dict()
|
|
247
|
+
if rooting_rank == 'p':
|
|
248
|
+
user_gnm_taxon_dict_rooting_rank = user_gnm_taxon_dict_p
|
|
249
|
+
elif rooting_rank == 'c':
|
|
250
|
+
user_gnm_taxon_dict_rooting_rank = user_gnm_taxon_dict_c
|
|
251
|
+
elif rooting_rank == 'o':
|
|
252
|
+
user_gnm_taxon_dict_rooting_rank = user_gnm_taxon_dict_o
|
|
253
|
+
elif rooting_rank == 'f':
|
|
254
|
+
user_gnm_taxon_dict_rooting_rank = user_gnm_taxon_dict_f
|
|
255
|
+
elif rooting_rank == 'g':
|
|
256
|
+
user_gnm_taxon_dict_rooting_rank = user_gnm_taxon_dict_g
|
|
257
|
+
|
|
258
|
+
# get the smallest out group genome set
|
|
259
|
+
out_group_gnm_set_1 = set()
|
|
260
|
+
out_group_gnm_set_2 = set()
|
|
261
|
+
for each_rooting_rank_taxon in user_gnm_taxon_dict_rooting_rank:
|
|
262
|
+
gnm_member_set = user_gnm_taxon_dict_rooting_rank[each_rooting_rank_taxon]
|
|
263
|
+
if each_rooting_rank_taxon in smallest_outgroup_taxon_list:
|
|
264
|
+
out_group_gnm_set_1.update(gnm_member_set)
|
|
265
|
+
else:
|
|
266
|
+
out_group_gnm_set_2.update(gnm_member_set)
|
|
267
|
+
|
|
268
|
+
# select the smaller one as outgroup
|
|
269
|
+
if len(out_group_gnm_set_1) < len(out_group_gnm_set_2):
|
|
270
|
+
out_group_gnm_set = out_group_gnm_set_1
|
|
271
|
+
else:
|
|
272
|
+
out_group_gnm_set = out_group_gnm_set_2
|
|
273
|
+
|
|
274
|
+
# root user tree with identified out group genomes
|
|
275
|
+
root_with_outgroup(input_unrooted_tree, out_group_gnm_set, rooted_tree)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
if __name__ == '__main__':
|
|
279
|
+
|
|
280
|
+
tree_parser = argparse.ArgumentParser(usage=tree_usage)
|
|
281
|
+
tree_parser.add_argument('-tree', required=True, help='input unrooted tree')
|
|
282
|
+
tree_parser.add_argument('-tax', required=False, default='fna', help='leaf taxon')
|
|
283
|
+
tree_parser.add_argument('-db', required=True, help='GTDB database files')
|
|
284
|
+
tree_parser.add_argument('-d', required=False, default=None, help='domain, either ar or bac')
|
|
285
|
+
tree_parser.add_argument('-o', required=True, help='output folder')
|
|
286
|
+
args = vars(tree_parser.parse_args())
|
|
287
|
+
gtdb_root(args)
|
|
288
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: TreeSAK
|
|
3
|
+
Version: 1.29.4
|
|
4
|
+
Summary: BioSAK
|
|
5
|
+
Home-page: https://github.com/songweizhi/TreeSAK
|
|
6
|
+
Author: Weizhi Song
|
|
7
|
+
Author-email: songwz03@gmail.com
|
|
8
|
+
License: GPL3+
|
|
9
|
+
Keywords: Bioinformatics
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: biopython
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: itolapi
|
|
16
|
+
Requires-Dist: networkx
|
|
17
|
+
Requires-Dist: seaborn
|
|
18
|
+
Requires-Dist: lxml
|
|
19
|
+
Requires-Dist: beautifulsoup4
|
|
20
|
+
Requires-Dist: ete3
|
|
21
|
+
Requires-Dist: arviz
|
|
22
|
+
Requires-Dist: plotly
|
|
23
|
+
Requires-Dist: kaleido
|
|
24
|
+
Requires-Dist: PyPDF3
|
|
25
|
+
|
|
26
|
+
TreeSAK v1.29.4
|