TreeSAK 1.56.0__tar.gz → 1.56.2__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.56.0/treesak.egg-info → treesak-1.56.2}/PKG-INFO +2 -2
- treesak-1.56.2/TreeSAK/TimeScale.py +141 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/VERSION +3 -3
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/iTOL.py +143 -15
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mcmctree_out.py +10 -4
- {treesak-1.56.0 → treesak-1.56.2}/bin/TreeSAK +4 -0
- {treesak-1.56.0 → treesak-1.56.2/treesak.egg-info}/PKG-INFO +2 -2
- {treesak-1.56.0 → treesak-1.56.2}/treesak.egg-info/SOURCES.txt +1 -0
- {treesak-1.56.0 → treesak-1.56.2}/LICENSE +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/MANIFEST.in +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/README.md +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE1.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE2.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE2RTC.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE3.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE4.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE5.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE6.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE7.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ALE_backup.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/AssessCVG.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/AssessMarker.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/AssessMarkerPA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/BMGE.jar +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/BMGE.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/C60SR4.nex +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/CompareMCMC.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ConcateMSA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ConvertMSA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/Dir.rb +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/FastRoot.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/FastRoot_backup.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/FigTree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/GTDB_tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/GeneTree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/KEGG_Luo17.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/LcaToLeaves.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/MarkerRef2Tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/MarkerSeq2Tree_backup.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ModifyTopo.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/Newick_tree_plotter.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/OMA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/OMA2.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/OneLineAln.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PB.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PMSF.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PhyloBiAssoc.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PhyloBiAssoc.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PlotMCMC.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PlotMcmcNode.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/PlotMcmcNode_old.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/RootTree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/RootTreeGTDB.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/RootTreeGTDB214.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/RootTreeGTDB220.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SequentialDating.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SingleAleHGT.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SingleLinePhy.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SliceMSA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SplitScore.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SplitScore1.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SplitScore1OMA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/SplitScore2.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/TaxaCountStats.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/TaxonTree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/TreeSAK_config.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/VisHPD95.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/VisHPD95.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/__init__.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ale_parser.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/ale_splitter.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/alignment_pruner.pl +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/assessOG.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/assessPB.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/batch_itol.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/catfasta2phy.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/cogTree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/compare_trees.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/compare_trees.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/dating.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/dating_ss.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/deltall.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/do_rrtc.rb +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/fa2phy.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/filter_rename_ar53.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/format_leaf_name.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/gap_stats.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/get_SCG_tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/get_arCOG_seq.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/get_lca_id.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/global_functions.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/gnm_leaves.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/guide_tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/iTOL_gene_tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/itol_msa_stats.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/keep_highest_rrtc.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/koTree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/label_gene_tree_by_gnm.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/label_tree.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/label_tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mad.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mcmc2tree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mcmcTC copy.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mcmcTC.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mcmctree_vs_reltime.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/mcmctree_vs_reltime.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/merge_pdf.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/pRTC.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/parse_mcmctree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/parse_reltime.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/phy2fa.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/plot_distruibution_th.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/print_leaves.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/pruneMSA.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/recode.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/remove_bias.R +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/rename_leaves.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/replace_clade.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/root_with_out_group.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/subsample_drep_gnms.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/subset.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/supertree.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/tmp_1.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/tmp_2.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/tmp_3.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/tmp_4.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/TreeSAK/weighted_rand.rb +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/setup.cfg +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/setup.py +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/treesak.egg-info/dependency_links.txt +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/treesak.egg-info/requires.txt +0 -0
- {treesak-1.56.0 → treesak-1.56.2}/treesak.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: treesak
|
|
3
|
-
Version: 1.56.
|
|
3
|
+
Version: 1.56.2
|
|
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.56.
|
|
27
|
+
TreeSAK v1.56.2
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
|
|
2
|
+
def get_timescale_file(args):
|
|
3
|
+
|
|
4
|
+
# https://github.com/i-c-stratigraphy/chart/blob/main/chart.ttl
|
|
5
|
+
|
|
6
|
+
chart_ttl = args['i']
|
|
7
|
+
time_range = args['rg']
|
|
8
|
+
time_unit = args['u']
|
|
9
|
+
interested_rank = args['rk']
|
|
10
|
+
op_dir = '.'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
chart_ttl = '/Users/songweizhi/Desktop/chart.ttl'
|
|
15
|
+
time_range = '3.5-0'
|
|
16
|
+
time_unit = 'Ga' # choose from Ma and Ga
|
|
17
|
+
interested_rank = 'Era,Eon' # choose from Super-Eon, Eon, Era, Period, Sub-Period, Epoch and Age
|
|
18
|
+
op_dir = '/Users/songweizhi/Desktop'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
time_range_split = time_range.split('-')
|
|
23
|
+
specified_time_range_l = float(time_range_split[0])
|
|
24
|
+
specified_time_range_r = float(time_range_split[1])
|
|
25
|
+
|
|
26
|
+
dod = dict()
|
|
27
|
+
current_ns2_id = ''
|
|
28
|
+
current_ns1_rank = ''
|
|
29
|
+
current_range_start = ''
|
|
30
|
+
current_range_end = ''
|
|
31
|
+
current_color = ''
|
|
32
|
+
for each_line in open(chart_ttl):
|
|
33
|
+
if each_line.startswith('ns2:'):
|
|
34
|
+
current_ns2_id = each_line.strip()[len('ns2:'):]
|
|
35
|
+
if each_line.startswith(' ns1:rank '):
|
|
36
|
+
current_ns1_rank = each_line.strip().split('/rank/')[1].split('>')[0]
|
|
37
|
+
if each_line.startswith(' skos:definition "A time period from '):
|
|
38
|
+
if 'million years ago to the present"' in each_line:
|
|
39
|
+
current_range_start = each_line.split('A time period from ')[-1].split()[0]
|
|
40
|
+
current_range_end = '0'
|
|
41
|
+
else:
|
|
42
|
+
current_range_start = each_line.split(' to ')[0].split()[-1]
|
|
43
|
+
current_range_end = each_line.split(' to ')[1].split()[0]
|
|
44
|
+
if each_line.startswith(' schema:color "'):
|
|
45
|
+
current_color = each_line.strip().split('"')[1]
|
|
46
|
+
if current_ns1_rank not in dod:
|
|
47
|
+
dod[current_ns1_rank] = dict()
|
|
48
|
+
if current_ns2_id not in dod[current_ns1_rank]:
|
|
49
|
+
dod[current_ns1_rank][current_ns2_id] = dict()
|
|
50
|
+
dod[current_ns1_rank][current_ns2_id] = [float(current_range_start), float(current_range_end), current_color]
|
|
51
|
+
|
|
52
|
+
interested_rank_list = interested_rank.split(',')
|
|
53
|
+
for each_rank in dod:
|
|
54
|
+
|
|
55
|
+
if each_rank in interested_rank_list:
|
|
56
|
+
itol_file = '%s/iTOL_TimeScale_%s.txt' % (op_dir, each_rank)
|
|
57
|
+
itol_file_handle = open(itol_file, 'w')
|
|
58
|
+
itol_file_handle.write('DATASET_TIMESCALE\nSEPARATOR TAB\n')
|
|
59
|
+
itol_file_handle.write('\n')
|
|
60
|
+
|
|
61
|
+
itol_file_handle.write('# position related\n')
|
|
62
|
+
itol_file_handle.write('POSITION_ABOVE\t0\n')
|
|
63
|
+
vertical_shift_index = interested_rank_list.index(each_rank) + 1
|
|
64
|
+
vertical_shift_value = vertical_shift_index * 50
|
|
65
|
+
itol_file_handle.write('VERTICAL_SHIFT\t%s\n' % vertical_shift_value)
|
|
66
|
+
itol_file_handle.write('AUTO_SCALE\t0\n')
|
|
67
|
+
itol_file_handle.write('SCALING_FACTOR\t1\n')
|
|
68
|
+
itol_file_handle.write('COVER_TREE\t0\n')
|
|
69
|
+
itol_file_handle.write('\n')
|
|
70
|
+
|
|
71
|
+
itol_file_handle.write('# dataset label related\n')
|
|
72
|
+
itol_file_handle.write('DATASET_LABEL\t%s\n' % each_rank)
|
|
73
|
+
itol_file_handle.write('SHOW_LABELS\t1\n')
|
|
74
|
+
itol_file_handle.write('LABEL_POSITION\tend\n')
|
|
75
|
+
itol_file_handle.write('LABEL_SHIFT_X\t30\n')
|
|
76
|
+
itol_file_handle.write('LABEL_SHIFT_Y\t0\n')
|
|
77
|
+
itol_file_handle.write('SIZE_FACTOR\t2\n')
|
|
78
|
+
itol_file_handle.write('LABEL_ROTATION\t0\n')
|
|
79
|
+
itol_file_handle.write('\n')
|
|
80
|
+
|
|
81
|
+
itol_file_handle.write('# range label related\n')
|
|
82
|
+
itol_file_handle.write('SHOW_RANGE_LABELS\t1\n')
|
|
83
|
+
itol_file_handle.write('RANGE_LABEL_SIZE\t10\n')
|
|
84
|
+
itol_file_handle.write('RANGE_LABEL_ROTATION\t0\n')
|
|
85
|
+
itol_file_handle.write('RANGE_LABEL_POSITION\tcenter\n')
|
|
86
|
+
itol_file_handle.write('RANGE_LABEL_SHIFT_X\t0\n')
|
|
87
|
+
itol_file_handle.write('RANGE_LABEL_SHIFT_Y\t0\n')
|
|
88
|
+
itol_file_handle.write('RANGE_LABEL_COLOR\t#000000\n')
|
|
89
|
+
itol_file_handle.write('# RANGE_LABEL_AUTO_COLOR\t1\n')
|
|
90
|
+
itol_file_handle.write('\n')
|
|
91
|
+
|
|
92
|
+
itol_file_handle.write('# border related\n')
|
|
93
|
+
itol_file_handle.write('BORDER_WIDTH\t0\n')
|
|
94
|
+
itol_file_handle.write('BORDER_COLOR\t#000000\n')
|
|
95
|
+
itol_file_handle.write('BORDER_DASHED\t0\n')
|
|
96
|
+
itol_file_handle.write('\n')
|
|
97
|
+
|
|
98
|
+
itol_file_handle.write('# value label related\n')
|
|
99
|
+
itol_file_handle.write('SHOW_VALUE_LABELS\t0\n')
|
|
100
|
+
itol_file_handle.write('VALUE_LABEL_SIZE_FACTOR\t0.5\n')
|
|
101
|
+
itol_file_handle.write('VALUE_LABEL_ROTATION\t0\n')
|
|
102
|
+
itol_file_handle.write('VALUE_LABEL_SHIFT\t0\n')
|
|
103
|
+
itol_file_handle.write('\n')
|
|
104
|
+
|
|
105
|
+
itol_file_handle.write('\nDATA\n')
|
|
106
|
+
for each_range in dod[each_rank]:
|
|
107
|
+
current_range_color = dod[each_rank][each_range][2]
|
|
108
|
+
current_range_l = float(dod[each_rank][each_range][0])
|
|
109
|
+
current_range_r = float(dod[each_rank][each_range][1])
|
|
110
|
+
if current_range_l < current_range_r:
|
|
111
|
+
current_range_l = float(dod[each_rank][each_range][1])
|
|
112
|
+
current_range_r = float(dod[each_rank][each_range][0])
|
|
113
|
+
|
|
114
|
+
if time_unit == 'Ga':
|
|
115
|
+
current_range_l = current_range_l/1000
|
|
116
|
+
current_range_r = current_range_r/1000
|
|
117
|
+
|
|
118
|
+
range_l_to_write = ''
|
|
119
|
+
range_r_to_write = ''
|
|
120
|
+
if (current_range_l <= specified_time_range_l) and (current_range_r >= specified_time_range_r):
|
|
121
|
+
range_l_to_write = current_range_l
|
|
122
|
+
range_r_to_write = current_range_r
|
|
123
|
+
elif (specified_time_range_l >= current_range_l >= specified_time_range_r) and (current_range_r <= specified_time_range_r):
|
|
124
|
+
range_l_to_write = current_range_l
|
|
125
|
+
range_r_to_write = specified_time_range_r
|
|
126
|
+
elif (current_range_l >= specified_time_range_l) and (specified_time_range_l >= current_range_r >= specified_time_range_r):
|
|
127
|
+
range_l_to_write = specified_time_range_l
|
|
128
|
+
range_r_to_write = current_range_r
|
|
129
|
+
elif (current_range_l <= specified_time_range_r):
|
|
130
|
+
pass
|
|
131
|
+
elif (current_range_r >= specified_time_range_l):
|
|
132
|
+
pass
|
|
133
|
+
elif (current_range_l >= specified_time_range_l) and (current_range_r<= specified_time_range_r):
|
|
134
|
+
range_l_to_write = specified_time_range_l
|
|
135
|
+
range_r_to_write = specified_time_range_r
|
|
136
|
+
|
|
137
|
+
if (range_l_to_write != '') and (range_r_to_write != ''):
|
|
138
|
+
itol_data_str = '%s\t%s\t\t\t%s\t%s\t%s\tnormal' % (range_l_to_write, range_r_to_write, current_range_color, current_range_color, each_range)
|
|
139
|
+
itol_file_handle.write(itol_data_str + '\n')
|
|
140
|
+
itol_file_handle.close()
|
|
141
|
+
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import math
|
|
2
|
-
import os.path
|
|
3
2
|
import random
|
|
3
|
+
import os.path
|
|
4
4
|
import argparse
|
|
5
5
|
import seaborn as sns
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
'''
|
|
9
|
-
TreeSAK iTOL -ColorLabel -lg Mag_genus.txt -gc genus_color.txt-o ColorLabel_genus.txt
|
|
10
|
-
'''
|
|
11
|
-
|
|
12
8
|
iTOL_usage = '''
|
|
13
9
|
==================================== iTOL example commands ====================================
|
|
14
10
|
|
|
@@ -28,6 +24,7 @@ TreeSAK iTOL -ColorClade -lg Mag_genus.txt -gc genus_color.txt-o ColorClade_genu
|
|
|
28
24
|
TreeSAK iTOL -ExternalShape -lm identity_matrix.txt -lt Identity -scale 25-50-75-100 -o ExternalShape_identity.txt
|
|
29
25
|
TreeSAK iTOL -PieChart -lv MagCompleteness.txt -lt Completeness -o PieChart_completeness.txt
|
|
30
26
|
TreeSAK iTOL -Collapse -lg MagTaxon.txt -o Collapse_by_taxon.txt
|
|
27
|
+
TreeSAK iTOL -TimeScale -rg 3.5-0 -u Ga -rk Era,Eon -ct /Users/songweizhi/DB/chart.ttl
|
|
31
28
|
|
|
32
29
|
# Leaf-to-Group file format (-lg, tab separated, no header)
|
|
33
30
|
genome_1 Bacteria
|
|
@@ -51,10 +48,137 @@ Genome_id SampleA SampleB SampleC
|
|
|
51
48
|
genome_1 6.15 2.23 1.56
|
|
52
49
|
genome_2 6.63 1.72 2.55
|
|
53
50
|
|
|
51
|
+
# chart.ttl is available at https://github.com/i-c-stratigraphy/chart/blob/main/chart.ttl
|
|
52
|
+
|
|
54
53
|
===============================================================================================
|
|
55
54
|
'''
|
|
56
55
|
|
|
57
56
|
|
|
57
|
+
def get_timescale_file(chart_ttl, time_range, time_unit, interested_rank):
|
|
58
|
+
|
|
59
|
+
# https://github.com/i-c-stratigraphy/chart/blob/main/chart.ttl
|
|
60
|
+
op_dir = '.'
|
|
61
|
+
|
|
62
|
+
time_range_split = time_range.split('-')
|
|
63
|
+
specified_time_range_l = float(time_range_split[0])
|
|
64
|
+
specified_time_range_r = float(time_range_split[1])
|
|
65
|
+
|
|
66
|
+
dod = dict()
|
|
67
|
+
current_ns2_id = ''
|
|
68
|
+
current_ns1_rank = ''
|
|
69
|
+
current_range_start = ''
|
|
70
|
+
current_range_end = ''
|
|
71
|
+
current_color = ''
|
|
72
|
+
for each_line in open(chart_ttl):
|
|
73
|
+
if each_line.startswith('ns2:'):
|
|
74
|
+
current_ns2_id = each_line.strip()[len('ns2:'):]
|
|
75
|
+
if each_line.startswith(' ns1:rank '):
|
|
76
|
+
current_ns1_rank = each_line.strip().split('/rank/')[1].split('>')[0]
|
|
77
|
+
if each_line.startswith(' skos:definition "A time period from '):
|
|
78
|
+
if 'million years ago to the present"' in each_line:
|
|
79
|
+
current_range_start = each_line.split('A time period from ')[-1].split()[0]
|
|
80
|
+
current_range_end = '0'
|
|
81
|
+
else:
|
|
82
|
+
current_range_start = each_line.split(' to ')[0].split()[-1]
|
|
83
|
+
current_range_end = each_line.split(' to ')[1].split()[0]
|
|
84
|
+
if each_line.startswith(' schema:color "'):
|
|
85
|
+
current_color = each_line.strip().split('"')[1]
|
|
86
|
+
if current_ns1_rank not in dod:
|
|
87
|
+
dod[current_ns1_rank] = dict()
|
|
88
|
+
if current_ns2_id not in dod[current_ns1_rank]:
|
|
89
|
+
dod[current_ns1_rank][current_ns2_id] = dict()
|
|
90
|
+
dod[current_ns1_rank][current_ns2_id] = [float(current_range_start), float(current_range_end), current_color]
|
|
91
|
+
|
|
92
|
+
interested_rank_list = interested_rank.split(',')
|
|
93
|
+
for each_rank in dod:
|
|
94
|
+
if each_rank in interested_rank_list:
|
|
95
|
+
itol_file = './iTOL_TimeScale_%s.txt' % each_rank
|
|
96
|
+
itol_file_handle = open(itol_file, 'w')
|
|
97
|
+
itol_file_handle.write('DATASET_TIMESCALE\nSEPARATOR TAB\n')
|
|
98
|
+
itol_file_handle.write('\n')
|
|
99
|
+
|
|
100
|
+
itol_file_handle.write('# position related\n')
|
|
101
|
+
itol_file_handle.write('POSITION_ABOVE\t0\n')
|
|
102
|
+
vertical_shift_index = interested_rank_list.index(each_rank) + 1
|
|
103
|
+
vertical_shift_value = vertical_shift_index * 50
|
|
104
|
+
itol_file_handle.write('VERTICAL_SHIFT\t%s\n' % vertical_shift_value)
|
|
105
|
+
itol_file_handle.write('AUTO_SCALE\t0\n')
|
|
106
|
+
itol_file_handle.write('SCALING_FACTOR\t1\n')
|
|
107
|
+
itol_file_handle.write('COVER_TREE\t0\n')
|
|
108
|
+
itol_file_handle.write('\n')
|
|
109
|
+
|
|
110
|
+
itol_file_handle.write('# dataset label related\n')
|
|
111
|
+
itol_file_handle.write('DATASET_LABEL\t%s\n' % each_rank)
|
|
112
|
+
itol_file_handle.write('SHOW_LABELS\t1\n')
|
|
113
|
+
itol_file_handle.write('LABEL_POSITION\tend\n')
|
|
114
|
+
itol_file_handle.write('LABEL_SHIFT_X\t30\n')
|
|
115
|
+
itol_file_handle.write('LABEL_SHIFT_Y\t0\n')
|
|
116
|
+
itol_file_handle.write('SIZE_FACTOR\t2\n')
|
|
117
|
+
itol_file_handle.write('LABEL_ROTATION\t0\n')
|
|
118
|
+
itol_file_handle.write('\n')
|
|
119
|
+
|
|
120
|
+
itol_file_handle.write('# range label related\n')
|
|
121
|
+
itol_file_handle.write('SHOW_RANGE_LABELS\t1\n')
|
|
122
|
+
itol_file_handle.write('RANGE_LABEL_SIZE\t10\n')
|
|
123
|
+
itol_file_handle.write('RANGE_LABEL_ROTATION\t0\n')
|
|
124
|
+
itol_file_handle.write('RANGE_LABEL_POSITION\tcenter\n')
|
|
125
|
+
itol_file_handle.write('RANGE_LABEL_SHIFT_X\t0\n')
|
|
126
|
+
itol_file_handle.write('RANGE_LABEL_SHIFT_Y\t0\n')
|
|
127
|
+
itol_file_handle.write('RANGE_LABEL_COLOR\t#000000\n')
|
|
128
|
+
itol_file_handle.write('# RANGE_LABEL_AUTO_COLOR\t1\n')
|
|
129
|
+
itol_file_handle.write('\n')
|
|
130
|
+
|
|
131
|
+
itol_file_handle.write('# border related\n')
|
|
132
|
+
itol_file_handle.write('BORDER_WIDTH\t0\n')
|
|
133
|
+
itol_file_handle.write('BORDER_COLOR\t#000000\n')
|
|
134
|
+
itol_file_handle.write('BORDER_DASHED\t0\n')
|
|
135
|
+
itol_file_handle.write('\n')
|
|
136
|
+
|
|
137
|
+
itol_file_handle.write('# value label related\n')
|
|
138
|
+
itol_file_handle.write('SHOW_VALUE_LABELS\t0\n')
|
|
139
|
+
itol_file_handle.write('VALUE_LABEL_SIZE_FACTOR\t0.5\n')
|
|
140
|
+
itol_file_handle.write('VALUE_LABEL_ROTATION\t0\n')
|
|
141
|
+
itol_file_handle.write('VALUE_LABEL_SHIFT\t0\n')
|
|
142
|
+
itol_file_handle.write('\n')
|
|
143
|
+
|
|
144
|
+
itol_file_handle.write('\nDATA\n')
|
|
145
|
+
for each_range in dod[each_rank]:
|
|
146
|
+
current_range_color = dod[each_rank][each_range][2]
|
|
147
|
+
current_range_l = float(dod[each_rank][each_range][0])
|
|
148
|
+
current_range_r = float(dod[each_rank][each_range][1])
|
|
149
|
+
if current_range_l < current_range_r:
|
|
150
|
+
current_range_l = float(dod[each_rank][each_range][1])
|
|
151
|
+
current_range_r = float(dod[each_rank][each_range][0])
|
|
152
|
+
|
|
153
|
+
if time_unit == 'Ga':
|
|
154
|
+
current_range_l = current_range_l/1000
|
|
155
|
+
current_range_r = current_range_r/1000
|
|
156
|
+
|
|
157
|
+
range_l_to_write = ''
|
|
158
|
+
range_r_to_write = ''
|
|
159
|
+
if (current_range_l <= specified_time_range_l) and (current_range_r >= specified_time_range_r):
|
|
160
|
+
range_l_to_write = current_range_l
|
|
161
|
+
range_r_to_write = current_range_r
|
|
162
|
+
elif (specified_time_range_l >= current_range_l >= specified_time_range_r) and (current_range_r <= specified_time_range_r):
|
|
163
|
+
range_l_to_write = current_range_l
|
|
164
|
+
range_r_to_write = specified_time_range_r
|
|
165
|
+
elif (current_range_l >= specified_time_range_l) and (specified_time_range_l >= current_range_r >= specified_time_range_r):
|
|
166
|
+
range_l_to_write = specified_time_range_l
|
|
167
|
+
range_r_to_write = current_range_r
|
|
168
|
+
elif (current_range_l <= specified_time_range_r):
|
|
169
|
+
pass
|
|
170
|
+
elif (current_range_r >= specified_time_range_l):
|
|
171
|
+
pass
|
|
172
|
+
elif (current_range_l >= specified_time_range_l) and (current_range_r<= specified_time_range_r):
|
|
173
|
+
range_l_to_write = specified_time_range_l
|
|
174
|
+
range_r_to_write = specified_time_range_r
|
|
175
|
+
|
|
176
|
+
if (range_l_to_write != '') and (range_r_to_write != ''):
|
|
177
|
+
itol_data_str = '%s\t%s\t\t\t%s\t%s\t%s\tnormal' % (range_l_to_write, range_r_to_write, current_range_color, current_range_color, each_range)
|
|
178
|
+
itol_file_handle.write(itol_data_str + '\n')
|
|
179
|
+
itol_file_handle.close()
|
|
180
|
+
|
|
181
|
+
|
|
58
182
|
def get_color_list(color_num):
|
|
59
183
|
|
|
60
184
|
if color_num <= 8:
|
|
@@ -135,6 +259,7 @@ def iTOL(args):
|
|
|
135
259
|
PieChart = args['PieChart']
|
|
136
260
|
Collapse = args['Collapse']
|
|
137
261
|
MultiStyleLabel = args['MultiStyleLabel']
|
|
262
|
+
TimeScale = args['TimeScale']
|
|
138
263
|
leaf_id_txt = args['id']
|
|
139
264
|
LeafGroup = args['lg']
|
|
140
265
|
GroupColor = args['gc']
|
|
@@ -151,6 +276,10 @@ def iTOL(args):
|
|
|
151
276
|
BinaryShape = args['BinaryShape']
|
|
152
277
|
BinaryColor = args['BinaryColor']
|
|
153
278
|
STRIP_WIDTH = args['strip_width']
|
|
279
|
+
chart_ttl = args['ct']
|
|
280
|
+
time_range = args['rg']
|
|
281
|
+
time_unit = args['u']
|
|
282
|
+
interested_rank = args['rk']
|
|
154
283
|
|
|
155
284
|
# General
|
|
156
285
|
MARGIN = 20
|
|
@@ -662,6 +791,11 @@ def iTOL(args):
|
|
|
662
791
|
|
|
663
792
|
####################################################################################################################
|
|
664
793
|
|
|
794
|
+
if TimeScale is True:
|
|
795
|
+
get_timescale_file(chart_ttl, time_range, time_unit, interested_rank)
|
|
796
|
+
|
|
797
|
+
####################################################################################################################
|
|
798
|
+
|
|
665
799
|
# Prepare ExternalShape file
|
|
666
800
|
if ExternalShape is True:
|
|
667
801
|
|
|
@@ -783,15 +917,9 @@ if __name__ == '__main__':
|
|
|
783
917
|
iTOL_parser.add_argument('-show_label', required=False, action='store_true', help='show label on ColorStrip')
|
|
784
918
|
iTOL_parser.add_argument('-strip_width', required=False, default=100, help='width of ColorStrip, default is 100')
|
|
785
919
|
iTOL_parser.add_argument('-o', required=True, help='Output filename')
|
|
920
|
+
iTOL_parser.add_argument('-ct', required=False, default=None, help='TimeScale, chart.ttl file')
|
|
921
|
+
iTOL_parser.add_argument('-rg', required=False, default=None, help='TimeScale, time range, e.g., 3.5-0')
|
|
922
|
+
iTOL_parser.add_argument('-u', required=False, default='Ga', help='TimeScale, time unit, choose from Ga and Ma, default is Ga')
|
|
923
|
+
iTOL_parser.add_argument('-rk', required=False, default='Era,Eon', help='TimeScale, interested rank, default is Era,Eon')
|
|
786
924
|
args = vars(iTOL_parser.parse_args())
|
|
787
925
|
iTOL(args)
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
'''
|
|
791
|
-
|
|
792
|
-
python3 /Users/songweizhi/PycharmProjects/TreeSAK/TreeSAK/iTOL.py -ColorStrip -strip_width 300 -hide_legend -show_label -lg /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/tmp/gnm_habitat_2.txt -gc /Users/songweizhi/Desktop/Sponge_r226/00_metadata/color_code_habitat.txt -lt habitat_2 -o /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/iTOL_habitat_2.txt
|
|
793
|
-
python3 /Users/songweizhi/PycharmProjects/TreeSAK/TreeSAK/iTOL.py -ColorStrip -strip_width 180 -hide_legend -show_label -lg /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/tmp/gnm_habitat_2.txt -gc /Users/songweizhi/Desktop/Sponge_r226/00_metadata/color_code_habitat.txt -lt habitat_2 -o /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/iTOL_habitat_2.txt
|
|
794
|
-
python3 /Users/songweizhi/PycharmProjects/TreeSAK/TreeSAK/iTOL.py -ColorStrip -strip_width 180 -hide_legend -show_label -lg /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/tmp/gnm_habitat_2.txt -gc /Users/songweizhi/Desktop/Sponge_r226/00_metadata/color_code_habitat.txt -lt habitat_2 -o /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/iTOL_habitat_2.txt
|
|
795
|
-
python3 /Users/songweizhi/PycharmProjects/TreeSAK/TreeSAK/iTOL.py -ColorStrip -strip_width 180 -hide_legend -show_label -lg /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/tmp/gnm_habitat_2.txt -gc /Users/songweizhi/Desktop/Sponge_r226/00_metadata/color_code_habitat.txt -lt habitat_2 -o /Users/songweizhi/Desktop/Sponge_r226/00_metadata/iTOL_2284/iTOL_habitat_2.txt
|
|
796
|
-
|
|
797
|
-
'''
|
|
@@ -4,12 +4,18 @@ import argparse
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
mcmctree_out_usage = '''
|
|
7
|
-
|
|
7
|
+
===================== mcmctree_out example commands =====================
|
|
8
8
|
|
|
9
|
-
TreeSAK mcmctree_out -i -n -o
|
|
10
|
-
TreeSAK mcmctree_out -i -n -o
|
|
9
|
+
TreeSAK mcmctree_out -i topo1_out.txt -n important_nodes.txt -o op.txt
|
|
10
|
+
TreeSAK mcmctree_out -i dating_result -n important_nodes.txt -o op.txt
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
# The input file need to be in the format of *_out.txt
|
|
13
|
+
|
|
14
|
+
# Format of node file
|
|
15
|
+
t_n141 Oxygen Age Constraint, Thermoproteales
|
|
16
|
+
t_n201 Emergence of the D1 clade
|
|
17
|
+
|
|
18
|
+
=========================================================================
|
|
13
19
|
'''
|
|
14
20
|
|
|
15
21
|
|
|
@@ -804,6 +804,10 @@ if __name__ == '__main__':
|
|
|
804
804
|
iTOL_parser.add_argument('-show_label', required=False, action='store_true', help='show label on ColorStrip')
|
|
805
805
|
iTOL_parser.add_argument('-strip_width', required=False, default=100, help='width of ColorStrip, default is 100')
|
|
806
806
|
iTOL_parser.add_argument('-o', required=True, help='Output filename')
|
|
807
|
+
iTOL_parser.add_argument('-ct', required=False, default=None, help='TimeScale, chart.ttl file')
|
|
808
|
+
iTOL_parser.add_argument('-rg', required=False, default=None, help='TimeScale, time range, e.g., 3.5-0')
|
|
809
|
+
iTOL_parser.add_argument('-u', required=False, default='Ga', help='TimeScale, time unit, choose from Ga and Ma, default is Ga')
|
|
810
|
+
iTOL_parser.add_argument('-rk', required=False, default='Era,Eon', help='TimeScale, interested rank, default is Era,Eon')
|
|
807
811
|
args = vars(parser.parse_args())
|
|
808
812
|
iTOL.iTOL(args)
|
|
809
813
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: treesak
|
|
3
|
-
Version: 1.56.
|
|
3
|
+
Version: 1.56.2
|
|
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.56.
|
|
27
|
+
TreeSAK v1.56.2
|
|
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
|
|
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
|
|
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
|