TreeSAK 1.40.5__tar.gz → 1.41.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 (111) hide show
  1. {TreeSAK-1.40.5/TreeSAK.egg-info → TreeSAK-1.41.0}/PKG-INFO +2 -2
  2. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/MarkerRef2Tree.py +26 -25
  3. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/VERSION +4 -1
  4. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/dating.py +21 -7
  5. TreeSAK-1.41.0/TreeSAK/mcmctree.py +2 -0
  6. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/replace_clade.py +2 -0
  7. TreeSAK-1.41.0/TreeSAK/tc.py +92 -0
  8. {TreeSAK-1.40.5 → TreeSAK-1.41.0/TreeSAK.egg-info}/PKG-INFO +2 -2
  9. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK.egg-info/SOURCES.txt +2 -0
  10. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/bin/TreeSAK +11 -1
  11. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/LICENSE +0 -0
  12. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/MANIFEST.in +0 -0
  13. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/README.md +0 -0
  14. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE.py +0 -0
  15. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE1.py +0 -0
  16. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE2.py +0 -0
  17. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE2RTC.py +0 -0
  18. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE3.py +0 -0
  19. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE4.py +0 -0
  20. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE5.py +0 -0
  21. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE6.py +0 -0
  22. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ALE_backup.py +0 -0
  23. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/AssessCVG.py +0 -0
  24. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/AssessMarker.py +0 -0
  25. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
  26. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/AssessMarkerPA.py +0 -0
  27. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/AssessPB.py +0 -0
  28. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/BMGE.jar +0 -0
  29. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/BMGE.py +0 -0
  30. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/CompareMCMC.py +0 -0
  31. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ConcateMSA.py +0 -0
  32. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ConvertMSA.py +0 -0
  33. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/Dir.rb +0 -0
  34. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ExtractMarkerSeq.py +0 -0
  35. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/FastRoot.py +0 -0
  36. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/FastRoot_backup.py +0 -0
  37. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/GTDB_tree.py +0 -0
  38. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/KEGG_Luo17.py +0 -0
  39. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/LcaToLeaves.py +0 -0
  40. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/MCMCtreeR.py +0 -0
  41. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
  42. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/MarkerSeq2Tree.py +0 -0
  43. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ModifyTopo.py +0 -0
  44. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/Newick_tree_plotter.py +0 -0
  45. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/OMA.py +0 -0
  46. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/OMA2.py +0 -0
  47. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/OneLineAln.py +0 -0
  48. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/PB.py +0 -0
  49. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/PMSF.py +0 -0
  50. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/PhyloBiAssoc.R +0 -0
  51. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/PhyloBiAssoc.py +0 -0
  52. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/PlotMCMC.py +0 -0
  53. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/PlotMcmcNode.py +0 -0
  54. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/RootTree.py +0 -0
  55. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/RootTreeGTDB214.py +0 -0
  56. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/RootTreeGTDB220.py +0 -0
  57. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SequentialDating.py +0 -0
  58. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SingleAleHGT.py +0 -0
  59. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SingleLinePhy.py +0 -0
  60. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SliceMSA.py +0 -0
  61. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SplitScore.py +0 -0
  62. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SplitScore1.py +0 -0
  63. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SplitScore1OMA.py +0 -0
  64. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/SplitScore2.py +0 -0
  65. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/TaxaCountStats.R +0 -0
  66. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/TaxonTree.py +0 -0
  67. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/TreeSAK_config.py +0 -0
  68. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/VisHPD95.R +0 -0
  69. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/VisHPD95.py +0 -0
  70. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/__init__.py +0 -0
  71. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ale_parser.py +0 -0
  72. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/ale_splitter.py +0 -0
  73. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/alignment_pruner.pl +0 -0
  74. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/aster.py +0 -0
  75. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/catfasta2phy.py +0 -0
  76. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/compare_trees.R +0 -0
  77. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/compare_trees.py +0 -0
  78. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/dating_ss.py +0 -0
  79. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/deltall.py +0 -0
  80. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/do_rrtc.rb +0 -0
  81. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/fa2phy.py +0 -0
  82. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/format_leaf_name.py +0 -0
  83. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/gap_stats.py +0 -0
  84. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/get_SCG_tree.py +0 -0
  85. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/get_arCOG_seq.py +0 -0
  86. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/global_functions.py +0 -0
  87. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/iTOL.py +0 -0
  88. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/keep_highest_rrtc.py +0 -0
  89. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/label_tree.R +0 -0
  90. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/label_tree.py +0 -0
  91. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/mad.py +0 -0
  92. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/merge_pdf.py +0 -0
  93. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/pRTC.py +0 -0
  94. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/plot_distruibution_th.py +0 -0
  95. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/prep_mcmctree_ctl.py +0 -0
  96. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/print_leaves.py +0 -0
  97. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/pruneMSA.py +0 -0
  98. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/recode.py +0 -0
  99. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/rename_leaves.py +0 -0
  100. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/root_with_out_group.py +0 -0
  101. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
  102. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/subsample_drep_gnms.py +0 -0
  103. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/subset.py +0 -0
  104. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
  105. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/tmp_1.py +0 -0
  106. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK/weighted_rand.rb +0 -0
  107. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK.egg-info/dependency_links.txt +0 -0
  108. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK.egg-info/requires.txt +0 -0
  109. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/TreeSAK.egg-info/top_level.txt +0 -0
  110. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/setup.cfg +0 -0
  111. {TreeSAK-1.40.5 → TreeSAK-1.41.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.40.5
3
+ Version: 1.41.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.40.5
27
+ TreeSAK v1.41.0
@@ -13,8 +13,8 @@ MarkerRef2Tree_usage = '''
13
13
  Dependencies: java, blastp, mafft-einsi, trimal, iqtree2
14
14
 
15
15
  # example commands
16
- TreeSAK MarkerRef2Tree -i faa_files -x faa -m marker_seq -mx fa -o output_dir -e 10 -t 6 -c 85
17
- TreeSAK MarkerRef2Tree -i faa_files -x faa -m marker_seq -mx fa -o output_dir -e 10 -t 6 -c 75,100
16
+ TreeSAK MarkerRef2Tree -i faa_files -x faa -m marker_seq -mx fa -o output_dir -bmge -e 10 -t 6 -c 85
17
+ TreeSAK MarkerRef2Tree -i faa_files -x faa -m marker_seq -mx fa -o output_dir -bmge -e 10 -t 6 -c 75,100
18
18
 
19
19
  # file extension need to be faa
20
20
 
@@ -341,12 +341,17 @@ def MarkerRef2Tree(args):
341
341
  minimal_marker_number = args['mmn']
342
342
  run_psiblast = args['psiblast']
343
343
  run_bmge = args['bmge']
344
+ trim_with_bmge = args['bmge']
344
345
  bmge_trim_model = args['bmge_m']
345
346
  bmge_entropy_score_cutoff = args['bmge_esc']
346
347
 
347
348
  # check dependencies
348
349
  check_dependencies(['java', 'psiblast', 'blastp', 'mafft-einsi', 'trimal', 'iqtree'])
349
350
 
351
+ # specify path to BMGE.jar
352
+ current_file_path = '/'.join(os.path.realpath(__file__).split('/')[:-1])
353
+ pwd_bmge_jar = '%s/BMGE.jar' % current_file_path
354
+
350
355
  # get marker id set
351
356
  marker_seq_re = '%s/*.%s' % (marker_seq_dir, marker_seq_ext)
352
357
  marker_seq_list = [os.path.basename(file_name) for file_name in glob.glob(marker_seq_re)]
@@ -389,18 +394,20 @@ def MarkerRef2Tree(args):
389
394
 
390
395
  ############################################## check file/folder name ##############################################
391
396
 
392
- blastp_cmd_txt = '%s/s01_blast_cmds_%s.txt' % (op_dir, (len(marker_seq_list)*len(faa_file_list)))
393
- pwd_combined_protein = '%s/combined.faa' % op_dir
394
- blast_op_dir = '%s/s01_blast' % op_dir
395
- best_hit_id_by_marker_dir = '%s/s02_marker_id' % op_dir
396
- best_hit_seq_by_marker_dir = '%s/s03_marker_seq' % op_dir
397
- best_hit_seq_by_marker_dir_renamed = '%s/s04_marker_seq_by_genome_name' % op_dir
398
- best_hit_aln_by_marker_dir = '%s/s05_marker_aln' % op_dir
399
- best_hit_aln_by_marker_dir_trimmed = '%s/s06_marker_aln_trimmed' % op_dir
400
- assess_marker_pa_dir = '%s/s07_assess_marker_PA' % op_dir
401
- trimmed_msa_PA_concatenated_dir = '%s/s08_iqtree_wd' % op_dir
402
- iqtree_dir = '%s/s08_iqtree_wd' % op_dir
403
- iqtree_cmd_txt = '%s/iqtree_cmds.txt' % iqtree_dir
397
+ blastp_cmd_txt = '%s/s01_blast_cmds_%s.txt' % (op_dir, (len(marker_seq_list)*len(faa_file_list)))
398
+ pwd_combined_protein = '%s/combined.faa' % op_dir
399
+ blast_op_dir = '%s/s01_blast' % op_dir
400
+ best_hit_id_by_marker_dir = '%s/s02_marker_id' % op_dir
401
+ best_hit_seq_by_marker_dir = '%s/s03_marker_seq' % op_dir
402
+ best_hit_seq_by_marker_dir_renamed = '%s/s04_marker_seq_by_genome_name' % op_dir
403
+ best_hit_aln_by_marker_dir = '%s/s05_marker_aln' % op_dir
404
+ best_hit_aln_by_marker_dir_trimmed = '%s/s06_marker_aln_trimal' % op_dir
405
+ if trim_with_bmge is True:
406
+ best_hit_aln_by_marker_dir_trimmed = '%s/s06_marker_aln_BMGE' % op_dir
407
+ assess_marker_pa_dir = '%s/s07_assess_marker_PA' % op_dir
408
+ trimmed_msa_PA_concatenated_dir = '%s/s08_iqtree_wd' % op_dir
409
+ iqtree_dir = '%s/s08_iqtree_wd' % op_dir
410
+ iqtree_cmd_txt = '%s/iqtree_cmds.txt' % iqtree_dir
404
411
 
405
412
  ####################################################################################################################
406
413
 
@@ -520,13 +527,13 @@ def MarkerRef2Tree(args):
520
527
 
521
528
  # run mafft-einsi
522
529
  mafft_cmd = 'mafft-einsi --thread %s --quiet %s > %s' % (num_of_threads, marker_hits_seq_renamed, marker_hits_aln)
523
- #print('running: ' + mafft_cmd)
524
530
  os.system(mafft_cmd)
525
531
 
526
532
  # trim msa
527
- trimal_cmd = 'trimal -in %s -out %s -automated1' % (marker_hits_aln, marker_hits_aln_trimmed)
528
- #print('running: ' + trimal_cmd)
529
- os.system(trimal_cmd)
533
+ trim_cmd = 'trimal -in %s -out %s -automated1' % (marker_hits_aln, marker_hits_aln_trimmed)
534
+ if trim_with_bmge is False:
535
+ trim_cmd = 'java -jar %s -i %s -m %s -t AA -h %s -of %s' % (pwd_bmge_jar, marker_hits_aln, bmge_trim_model, bmge_entropy_score_cutoff, marker_hits_aln_trimmed)
536
+ os.system(trim_cmd)
530
537
 
531
538
  ########## Assess marker by PA ##########
532
539
 
@@ -561,10 +568,6 @@ def MarkerRef2Tree(args):
561
568
  pwd_concatenated_marker_partition = '%s/marker_pa%s_partition.txt' % (trimmed_msa_PA_concatenated_dir, each_c)
562
569
  catfasta2phy(current_cutoff_trimmed_msa_dir, 'aln', pwd_concatenated_marker_phy, pwd_concatenated_marker_fasta, pwd_concatenated_marker_partition)
563
570
 
564
- if run_bmge is True:
565
- bmge_op_prefix = '%s/marker_pa%s' % (trimmed_msa_PA_concatenated_dir, each_c)
566
- BMGE(pwd_concatenated_marker_fasta, bmge_op_prefix, bmge_trim_model, bmge_entropy_score_cutoff)
567
-
568
571
  ########## get guide tree and C60+PMSF tree for each set of marker set ##########
569
572
 
570
573
  iqtree_cmd_txt_handle = open(iqtree_cmd_txt, 'w')
@@ -574,8 +577,6 @@ def MarkerRef2Tree(args):
574
577
  os.system('mkdir %s/PA%s_PMSF_C60_tree' % ((iqtree_dir, each_c)))
575
578
 
576
579
  msa_to_use = 'marker_pa%s.fasta' % each_c
577
- if run_bmge is True:
578
- msa_to_use = 'marker_pa%s.BMGE.fasta' % each_c
579
580
 
580
581
  get_guide_tree_cmd = 'iqtree2 --seqtype AA -B 1000 --alrt 1000 --quiet -T %s -s %s --prefix PA%s_guide_tree/PA%s_guide_tree -m LG' % (num_of_threads, msa_to_use, each_c, each_c)
581
582
  get_c60_tree_cmd = 'iqtree2 --seqtype AA -B 1000 --alrt 1000 --quiet -T %s -s %s --prefix PA%s_PMSF_C60_tree/PA%s_PMSF_C60 -m LG+C60+F+G -ft PA%s_guide_tree/PA%s_guide_tree.treefile' % (num_of_threads, msa_to_use, each_c, each_c, each_c, each_c)
@@ -608,7 +609,7 @@ if __name__ == '__main__':
608
609
  parser.add_argument('-t', required=True, type=int, help='num of threads')
609
610
  parser.add_argument('-mmn', required=False, default=1, type=int, help='minimal marker number, default: 1')
610
611
  parser.add_argument('-psiblast', required=False, action="store_true", help='run psiblast')
611
- parser.add_argument('-bmge', required=False, action="store_true", help='perform BMGE trimming on concatenated MSA')
612
+ parser.add_argument('-bmge', required=False, action="store_true", help='trim MSA with BMGE, default is trimal')
612
613
  parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='BMGE trim model, default: BLOSUM30')
613
614
  parser.add_argument('-bmge_esc', required=False, default='0.55', help='BMGE entropy score cutoff, default: 0.55')
614
615
  parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
@@ -1,4 +1,7 @@
1
- 1.40.5
1
+ 1.41.0
2
+ - new module added: tc
3
+
4
+ 1.40.6
2
5
  - fixed bugs
3
6
 
4
7
  1.40.0
@@ -1,12 +1,13 @@
1
1
  import os
2
2
  import argparse
3
3
  import itertools
4
+ from distutils.spawn import find_executable
4
5
 
5
6
 
6
7
  dating_usage = '''
7
8
  ======================== Dating example commands ========================
8
9
 
9
- # requireMENT: mcmctree, baseml and codeml (all from PAML)
10
+ # Requirement: PAML
10
11
 
11
12
  # example commands
12
13
  TreeSAK Dating -tree tree.treefile -msa markers.phylip -o dating_wd -f
@@ -14,6 +15,18 @@ TreeSAK Dating -tree tree.treefile -msa markers.phylip -o dating_wd -f
14
15
  =========================================================================
15
16
  '''
16
17
 
18
+ def check_dependencies(program_list):
19
+
20
+ # check whether executables exist
21
+ not_detected_programs = []
22
+ for needed_program in program_list:
23
+ if find_executable(needed_program) is None:
24
+ not_detected_programs.append(needed_program)
25
+
26
+ # report
27
+ if not_detected_programs != []:
28
+ print('%s not found, program exited!' % ','.join(not_detected_programs))
29
+ exit()
17
30
 
18
31
  def sep_path_basename_ext(file_in):
19
32
 
@@ -94,12 +107,14 @@ def get_parameter_combinations(para_to_test_dict):
94
107
 
95
108
  def dating(args):
96
109
 
97
- op_dir = args['o']
98
110
  tree_file = args['tree']
99
111
  msa_file = args['msa']
100
- force_overwrite = args['f']
112
+ op_dir = args['o']
101
113
  seq_type = args['st']
102
114
  settings_to_compare = args['s']
115
+ force_overwrite = args['f']
116
+
117
+ check_dependencies(['mcmctree'])
103
118
 
104
119
  para_to_test_dict = dict()
105
120
  for each_para in open(settings_to_compare):
@@ -194,12 +209,11 @@ def dating(args):
194
209
  if __name__ == '__main__':
195
210
 
196
211
  parser = argparse.ArgumentParser()
197
- parser.add_argument('-tree', required=True, help='outgroup leaves, one id per line')
198
- parser.add_argument('-msa', required=True, help='EU tree with time constraints')
199
- parser.add_argument('-o', required=True, help='dating wd')
212
+ parser.add_argument('-tree', required=True, help='tree file')
213
+ parser.add_argument('-msa', required=True, help='sequence alignments')
214
+ parser.add_argument('-o', required=True, help='output directory')
200
215
  parser.add_argument('-s', required=True, help='settings to compare')
201
216
  parser.add_argument('-st', required=False, default='2', help='sequence type, 0 for nucleotides, 1 for codons, 2 for AAs, default: 2')
202
217
  parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
203
218
  args = vars(parser.parse_args())
204
219
  dating(args)
205
-
@@ -0,0 +1,2 @@
1
+
2
+
@@ -41,6 +41,8 @@ def replace_clade(args):
41
41
  main_tre.write(outfile=tree_out, format=tree_out_fmt)
42
42
 
43
43
 
44
+
45
+
44
46
  if __name__ == '__main__':
45
47
 
46
48
  replace_clade_parser = argparse.ArgumentParser()
@@ -0,0 +1,92 @@
1
+ import argparse
2
+ from ete3 import Tree
3
+
4
+
5
+ tc_usage = '''
6
+ ======================= tc example commands =======================
7
+
8
+ TreeSAK tc -i in.tree -o out.tree -tc time_constraints.txt
9
+
10
+ # Format of constraint file (use tab to separate nodes and ages)
11
+ GCA226486700_1,GCF900696045_1 3.46-4.38
12
+ GCA000802205_2,GCF000299365_1 0.75-1.49
13
+ GCF000376445_1,GCF000172995_2 -1.579
14
+ GCF000152265_2,GCF000195915_1 2.32-
15
+
16
+ ===================================================================
17
+ '''
18
+
19
+
20
+ def tc(args):
21
+
22
+ tree_file_in = args['i']
23
+ time_constraint_txt = args['tc']
24
+ tree_file_out = args['o']
25
+
26
+ constraint_set = set()
27
+ constraint_dict = dict()
28
+ not_recognizable_time_constraint_set = set()
29
+ for each_constraint in open(time_constraint_txt):
30
+ each_constraint_split = each_constraint.strip().split('\t')
31
+ leaf_ids = each_constraint_split[0]
32
+ provided_age = each_constraint_split[1]
33
+
34
+ str_to_add = ''
35
+ if provided_age.startswith('-'):
36
+ str_to_add = '<%s' % provided_age[1:]
37
+ elif provided_age.endswith('-'):
38
+ str_to_add = '>%s' % provided_age[:-1]
39
+ elif '-' in provided_age:
40
+ provided_age_split = provided_age.split('-')
41
+ str_to_add = '>%s<%s' % (provided_age_split[0], provided_age_split[1])
42
+ else:
43
+ not_recognizable_time_constraint_set.add(provided_age)
44
+
45
+ constraint_dict[leaf_ids] = str_to_add
46
+ constraint_set.add(str_to_add)
47
+
48
+ if len(not_recognizable_time_constraint_set) > 0:
49
+ print('Format of the following time constraints are not recognizable, program exited')
50
+ print(','.join(not_recognizable_time_constraint_set))
51
+ exit()
52
+
53
+ # read in tree
54
+ tree_in = Tree(tree_file_in, quoted_node_names=True, format=1)
55
+
56
+ # add time constraints as node name
57
+ for each_node in constraint_dict:
58
+ node_age = constraint_dict[each_node]
59
+ node_split = each_node.split(',')
60
+ current_lca = tree_in.get_common_ancestor(node_split)
61
+ current_lca.add_features(custom_label=node_age)
62
+ current_lca.name = node_age
63
+
64
+ tree_out_str = tree_in.write(format=1)
65
+
66
+ # remove branch length of 1
67
+ tree_out_str = tree_out_str.replace(':1', '')
68
+
69
+ # quote constraint strings
70
+ for each_constraint in constraint_set:
71
+ tree_out_str = tree_out_str.replace(each_constraint, ("'%s'" % each_constraint))
72
+
73
+ # write tree to file
74
+ with open(tree_file_out, 'w') as tree_file_out_handle:
75
+ tree_file_out_handle.write(tree_out_str)
76
+
77
+
78
+ if __name__ == '__main__':
79
+
80
+ tc_parser = argparse.ArgumentParser()
81
+ tc_parser.add_argument('-i', required=True, help='input tree')
82
+ tc_parser.add_argument('-o', required=True, help='output tree')
83
+ tc_parser.add_argument('-tc', required=True, help='time constraint file')
84
+ args = vars(tc_parser.parse_args())
85
+ tc(args)
86
+
87
+
88
+ '''
89
+
90
+ python3 /Users/songweizhi/PycharmProjects/TreeSAK/TreeSAK/tc.py -i in.tree -o out.tree -tc /Users/songweizhi/Desktop/time_constraints.txt
91
+
92
+ '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.40.5
3
+ Version: 1.41.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.40.5
27
+ TreeSAK v1.41.0
@@ -83,6 +83,7 @@ TreeSAK/keep_highest_rrtc.py
83
83
  TreeSAK/label_tree.R
84
84
  TreeSAK/label_tree.py
85
85
  TreeSAK/mad.py
86
+ TreeSAK/mcmctree.py
86
87
  TreeSAK/merge_pdf.py
87
88
  TreeSAK/pRTC.py
88
89
  TreeSAK/plot_distruibution_th.py
@@ -97,6 +98,7 @@ TreeSAK/run_TaxaCountStats_R_s1.py
97
98
  TreeSAK/subsample_drep_gnms.py
98
99
  TreeSAK/subset.py
99
100
  TreeSAK/subset_tree_stupid_old_way.py
101
+ TreeSAK/tc.py
100
102
  TreeSAK/tmp_1.py
101
103
  TreeSAK/weighted_rand.rb
102
104
  TreeSAK.egg-info/PKG-INFO
@@ -89,6 +89,7 @@ def print_main_help():
89
89
  PlotMcmcNode -> distribution of node's age estimation
90
90
  VisHPD95 -> HPD95 of estimated node age
91
91
  pRTC -> Perform probabilistic RTC dating
92
+ tc -> adding time constraints to mcmctree tree
92
93
 
93
94
  Phylo-related stats
94
95
  PhyloBiAssoc -> A wrapper for binaryPGLMM test
@@ -248,7 +249,7 @@ if __name__ == '__main__':
248
249
  MarkerRef2Tree_parser.add_argument('-t', required=True, type=int, help='num of threads')
249
250
  MarkerRef2Tree_parser.add_argument('-mmn', required=False, default=1, type=int, help='minimal marker number, default: 1')
250
251
  MarkerRef2Tree_parser.add_argument('-psiblast', required=False, action="store_true", help='run psiblast')
251
- MarkerRef2Tree_parser.add_argument('-bmge', required=False, action="store_true", help='perform BMGE trimming on concatenated MSA')
252
+ MarkerRef2Tree_parser.add_argument('-bmge', required=False, action="store_true", help='trim MSA with BMGE, default is trimal')
252
253
  MarkerRef2Tree_parser.add_argument('-bmge_m', required=False, default='BLOSUM30', help='BMGE trim model, default: BLOSUM30')
253
254
  MarkerRef2Tree_parser.add_argument('-bmge_esc', required=False, default='0.55', help='BMGE entropy score cutoff, default: 0.55')
254
255
  MarkerRef2Tree_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
@@ -789,6 +790,15 @@ if __name__ == '__main__':
789
790
  args = vars(parser.parse_args())
790
791
  TaxonTree.TaxonTree(args)
791
792
 
793
+ elif sys.argv[1] == 'tc':
794
+ from TreeSAK import tc
795
+ tc_parser = subparsers.add_parser('tc', usage=tc.tc_usage)
796
+ tc_parser.add_argument('-i', required=True, help='input tree')
797
+ tc_parser.add_argument('-o', required=True, help='output tree')
798
+ tc_parser.add_argument('-tc', required=True, help='time constraint file')
799
+ args = vars(parser.parse_args())
800
+ tc.tc(args)
801
+
792
802
  else:
793
803
  print('Unrecognized module: %s, program exited' % sys.argv[1])
794
804
  exit()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes