TreeSAK 1.46.24__tar.gz → 1.46.26__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 (119) hide show
  1. {TreeSAK-1.46.24/TreeSAK.egg-info → TreeSAK-1.46.26}/PKG-INFO +2 -2
  2. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/VERSION +1 -1
  3. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/iTOL.py +6 -3
  4. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/pruneMSA.py +8 -10
  5. TreeSAK-1.46.26/TreeSAK/remove_bias.R +112 -0
  6. {TreeSAK-1.46.24 → TreeSAK-1.46.26/TreeSAK.egg-info}/PKG-INFO +2 -2
  7. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK.egg-info/SOURCES.txt +1 -0
  8. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/bin/TreeSAK +2 -0
  9. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/LICENSE +0 -0
  10. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/MANIFEST.in +0 -0
  11. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/README.md +0 -0
  12. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE.py +0 -0
  13. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE1.py +0 -0
  14. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE2.py +0 -0
  15. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE2RTC.py +0 -0
  16. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE3.py +0 -0
  17. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE4.py +0 -0
  18. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE5.py +0 -0
  19. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE6.py +0 -0
  20. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE7.py +0 -0
  21. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ALE_backup.py +0 -0
  22. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/AssessCVG.py +0 -0
  23. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/AssessMarker.py +0 -0
  24. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
  25. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/AssessMarkerPA.py +0 -0
  26. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/AssessPB.py +0 -0
  27. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/BMGE.jar +0 -0
  28. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/BMGE.py +0 -0
  29. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/CompareMCMC.py +0 -0
  30. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ConcateMSA.py +0 -0
  31. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ConvertMSA.py +0 -0
  32. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/Dir.rb +0 -0
  33. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ExtractMarkerSeq.py +0 -0
  34. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/FastRoot.py +0 -0
  35. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/FastRoot_backup.py +0 -0
  36. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/FigTree.py +0 -0
  37. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/GTDB_tree.py +0 -0
  38. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/KEGG_Luo17.py +0 -0
  39. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/LcaToLeaves.py +0 -0
  40. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/MarkerRef2Tree.py +0 -0
  41. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
  42. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/MarkerSeq2Tree.py +0 -0
  43. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/MarkerSeq2Tree_backup.py +0 -0
  44. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ModifyTopo.py +0 -0
  45. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/Newick_tree_plotter.py +0 -0
  46. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/OMA.py +0 -0
  47. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/OMA2.py +0 -0
  48. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/OneLineAln.py +0 -0
  49. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PB.py +0 -0
  50. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PMSF.py +0 -0
  51. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PhyloBiAssoc.R +0 -0
  52. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PhyloBiAssoc.py +0 -0
  53. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PlotMCMC.py +0 -0
  54. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PlotMcmcNode.py +0 -0
  55. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/PlotMcmcNode_old.py +0 -0
  56. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/RootTree.py +0 -0
  57. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/RootTreeGTDB214.py +0 -0
  58. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/RootTreeGTDB220.py +0 -0
  59. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SequentialDating.py +0 -0
  60. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SingleAleHGT.py +0 -0
  61. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SingleLinePhy.py +0 -0
  62. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SliceMSA.py +0 -0
  63. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SplitScore.py +0 -0
  64. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SplitScore1.py +0 -0
  65. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SplitScore1OMA.py +0 -0
  66. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/SplitScore2.py +0 -0
  67. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/TaxaCountStats.R +0 -0
  68. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/TaxonTree.py +0 -0
  69. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/TreeSAK_config.py +0 -0
  70. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/VisHPD95.R +0 -0
  71. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/VisHPD95.py +0 -0
  72. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/__init__.py +0 -0
  73. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ale_parser.py +0 -0
  74. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/ale_splitter.py +0 -0
  75. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/alignment_pruner.pl +0 -0
  76. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/assessOG.py +0 -0
  77. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/catfasta2phy.py +0 -0
  78. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/cogTree.py +0 -0
  79. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/compare_trees.R +0 -0
  80. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/compare_trees.py +0 -0
  81. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/dating.py +0 -0
  82. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/dating_ss.py +0 -0
  83. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/deltall.py +0 -0
  84. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/do_rrtc.rb +0 -0
  85. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/fa2phy.py +0 -0
  86. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/format_leaf_name.py +0 -0
  87. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/gap_stats.py +0 -0
  88. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/get_SCG_tree.py +0 -0
  89. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/get_arCOG_seq.py +0 -0
  90. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/global_functions.py +0 -0
  91. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/gnm_leaves.py +0 -0
  92. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/iTOL_gene_tree.py +0 -0
  93. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/keep_highest_rrtc.py +0 -0
  94. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/koTree.py +0 -0
  95. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/label_tree.R +0 -0
  96. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/label_tree.py +0 -0
  97. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/mad.py +0 -0
  98. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/mcmc2tree.py +0 -0
  99. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/mcmcTC.py +0 -0
  100. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/merge_pdf.py +0 -0
  101. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/pRTC.py +0 -0
  102. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/plot_distruibution_th.py +0 -0
  103. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/prep_mcmctree_ctl.py +0 -0
  104. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/print_leaves.py +0 -0
  105. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/recode.py +0 -0
  106. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/rename_leaves.py +0 -0
  107. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/replace_clade.py +0 -0
  108. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/root_with_out_group.py +0 -0
  109. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
  110. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/subsample_drep_gnms.py +0 -0
  111. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/subset.py +0 -0
  112. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
  113. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/supertree.py +0 -0
  114. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK/weighted_rand.rb +0 -0
  115. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK.egg-info/dependency_links.txt +0 -0
  116. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK.egg-info/requires.txt +0 -0
  117. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/TreeSAK.egg-info/top_level.txt +0 -0
  118. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/setup.cfg +0 -0
  119. {TreeSAK-1.46.24 → TreeSAK-1.46.26}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.46.24
3
+ Version: 1.46.26
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.46.24
27
+ TreeSAK v1.46.26
@@ -1,4 +1,4 @@
1
- 1.46.24
1
+ 1.46.26
2
2
  - fixed bugs
3
3
 
4
4
  1.46.0
@@ -141,6 +141,8 @@ def iTOL(args):
141
141
  LegendTitle = args['lt']
142
142
  show_strip_labels = args['show_strip_labels']
143
143
  FileOut = args['o']
144
+ BinaryShape = args['BinaryShape']
145
+ BinaryColor = args['BinaryColor']
144
146
 
145
147
  # General
146
148
  STRIP_WIDTH = 100
@@ -403,9 +405,9 @@ def iTOL(args):
403
405
  BinaryID_FileOut_handle.write('DATASET_BINARY\n\nSEPARATOR TAB\nDATASET_LABEL\t%s\nCOLOR\tred\n' % LegendTitle)
404
406
  BinaryID_FileOut_handle.write('SHOW_LABELS\t1\nLABEL_ROTATION\t45\nLABEL_SHIFT\t5\n')
405
407
  BinaryID_FileOut_handle.write('FIELD_LABELS\t%s\n' % LegendTitle)
406
- BinaryID_FileOut_handle.write('FIELD_COLORS\tred\n')
408
+ BinaryID_FileOut_handle.write('FIELD_COLORS\t%s\n' % BinaryColor)
407
409
  BinaryID_FileOut_handle.write('# FIELD_SHAPES: 1: rectangle; 2: circle; 3: star; 4: right pointing triangle; 5: left pointing triangle; 6: check mark\n')
408
- BinaryID_FileOut_handle.write('FIELD_SHAPES\t3\n')
410
+ BinaryID_FileOut_handle.write('FIELD_SHAPES\t%s\n' % BinaryShape)
409
411
  BinaryID_FileOut_handle.write('MARGIN\t10\n')
410
412
  BinaryID_FileOut_handle.write('\nDATA\n')
411
413
  for each_line in open(leaf_id_txt):
@@ -693,7 +695,6 @@ def iTOL(args):
693
695
 
694
696
  if __name__ == '__main__':
695
697
 
696
- # initialize the options parser
697
698
  iTOL_parser = argparse.ArgumentParser(usage=iTOL_usage)
698
699
  iTOL_parser.add_argument('-Labels', required=False, action='store_true', help='Labels')
699
700
  iTOL_parser.add_argument('-ColorStrip', required=False, action='store_true', help='ColorStrip')
@@ -706,6 +707,8 @@ if __name__ == '__main__':
706
707
  iTOL_parser.add_argument('-ExternalShape', required=False, action='store_true', help='ExternalShape')
707
708
  iTOL_parser.add_argument('-Binary', required=False, action='store_true', help='Binary')
708
709
  iTOL_parser.add_argument('-BinaryID', required=False, action='store_true', help='Binary specified IDs as 1')
710
+ iTOL_parser.add_argument('-BinaryShape', required=False, default='2', help='Binary Shape, choose from 1(rectangle), 2(circle), 3(star), 4, 5 and 6, default is 2')
711
+ iTOL_parser.add_argument('-BinaryColor', required=False, default='red', help='Binary Color, default is red')
709
712
  iTOL_parser.add_argument('-Connection', required=False, action='store_true', help='Connection')
710
713
  iTOL_parser.add_argument('-PieChart', required=False, action='store_true', help='PieChart')
711
714
  iTOL_parser.add_argument('-Collapse', required=False, action='store_true', help='Collapse')
@@ -3,18 +3,18 @@ import argparse
3
3
 
4
4
 
5
5
  pruneMSA_usage = '''
6
- =================== pruneMSA example commands ===================
6
+ ==================== pruneMSA example commands ====================
7
7
 
8
8
  # Dependencies: perl and alignment_pruner.pl
9
9
 
10
- TreeSAK pruneMSA -i input_msa.fa -c 10
11
- TreeSAK pruneMSA -i input_msa.fa -c 10,20,30,40
10
+ TreeSAK pruneMSA -i input_msa.fasta -c 10
11
+ TreeSAK pruneMSA -i input_msa.fasta -c 5,10,20,30,40
12
12
 
13
13
  Note:
14
14
  1. This is a wrapper for alignment_pruner.pl (--chi2_prune mode)
15
15
  2. For details: https://doi.org/10.1038/s41467-020-17408-w
16
16
 
17
- =================================================================
17
+ ===================================================================
18
18
  '''
19
19
 
20
20
 
@@ -42,13 +42,11 @@ def pruneMSA(args):
42
42
  op_file_list = []
43
43
  for each_cutoff in cutoff_list:
44
44
  cutoff_formatted = str(float(each_cutoff)/100)
45
- current_msa_out = '%s/%s.chi2prune%s.%s' % (msa_path, msa_base, each_cutoff, msa_ext)
46
- # perl_cmd = 'perl %s --file %s --conserved_threshold %s > %s' % (alignment_pruner_pl, msa_in, cutoff_formatted, current_msa_out)
47
- # perl_cmd_for_report = 'perl %s --file %s --conserved_threshold %s > %s' % ('alignment_pruner.pl', msa_in, cutoff_formatted, current_msa_out)
48
- perl_cmd = 'perl %s --file %s --chi2_prune f%s > %s' % (alignment_pruner_pl, msa_in, cutoff_formatted, current_msa_out)
49
- perl_cmd_for_report = 'perl %s --file %s --chi2_prune f%s > %s' % ('alignment_pruner.pl', msa_in, cutoff_formatted, current_msa_out)
45
+ current_msa_out = '%s/%s.chi2p%s.%s' % (msa_path, msa_base, each_cutoff, msa_ext)
46
+ perl_cmd = 'perl %s --file %s --chi2_prune f%s > %s' % (alignment_pruner_pl, msa_in, cutoff_formatted, current_msa_out)
47
+ perl_cmd_to_print = 'perl %s --file %s --chi2_prune f%s > %s' % ('alignment_pruner.pl', msa_in, cutoff_formatted, current_msa_out)
50
48
  op_file_list.append(current_msa_out)
51
- print(perl_cmd_for_report)
49
+ print(perl_cmd_to_print)
52
50
  os.system(perl_cmd)
53
51
 
54
52
  # report
@@ -0,0 +1,112 @@
1
+ library(Biostrings)
2
+ options(digits=8)
3
+ protein <- readAAStringSet("/lomi_home/wenxiu/RIS_virus/workdir/27_ortho_RIStree/ortho_tree/v1/tree_workdir/test.aln")
4
+ outgroup <- c()
5
+ protein <- protein[setdiff(names(protein),outgroup)]
6
+ library(stringr)
7
+ chi2_2 <- function(set,taxa_number,all_amino,amino_number){
8
+ O <- str_count(set[[taxa_number]],all_amino[amino_number])##某个物种中(已经除去一个位置的氨基酸之后)的全部氨基酸
9
+ E <- sum(str_count(set,all_amino[amino_number]))/sum(nchar(str_replace_all(set,"-","")))*nchar(str_replace_all(set[[taxa_number]],"-",""))###
10
+ return((O-E)^2/E)
11
+ }
12
+
13
+ chi2_1 <- function(set,taxa_number){
14
+ all_amino <- unique(strsplit(as.character(str_replace_all(set,"-","")),"")[[1]])
15
+ return(sum(sapply(1:length(all_amino),chi2_2,taxa_number=taxa_number,set=set,all_amino=all_amino)))
16
+ }
17
+
18
+ untrim <- sum(sapply(1:length(protein),chi2_1,set=protein))
19
+
20
+ #13746.9
21
+
22
+ trimmed_chi2 <- function(x){
23
+ library(Biostrings)
24
+ protein <- readAAStringSet("/lomi_home/wenxiu/RIS_virus/workdir/27_ortho_RIStree/ortho_tree/v1/tree_workdir/test.aln")
25
+ outgroup <- c()
26
+ protein <- protein[setdiff(names(protein),outgroup)]
27
+ library(stringr)
28
+ chi2_2 <- function(set,taxa_number,all_amino,amino_number){
29
+ O <- str_count(set[[taxa_number]],all_amino[amino_number])#某一个氨基酸(传进来的)在这个物种出现的频次
30
+ E <- sum(str_count(set,all_amino[amino_number]))/sum(nchar(str_replace_all(set,"-","")))*nchar(str_replace_all(set[[taxa_number]],"-",""))##氨基酸出现在配对中出现的的总次数/总氨基酸数*这个序列的氨基酸数
31
+ return((O-E)^2/E)
32
+ }
33
+
34
+ chi2_1 <- function(set,taxa_number){###
35
+ all_amino <- unique(strsplit(as.character(str_replace_all(set,"-","")),"")[[1]])##除去补空位的,在该位置的所有氨基酸
36
+ return(sum(sapply(1:length(all_amino),chi2_2,taxa_number=taxa_number,set=set,all_amino=all_amino)))###对于其中的每一种氨基酸
37
+ }
38
+
39
+ end_pos_1 <- x-1
40
+ start_pos_2 <- x+1
41
+ if (end_pos_1>=1 & start_pos_2<=width(protein)[1]){
42
+ trimmed_protein <- str_c(substr(protein,1,end_pos_1),substr(protein,start_pos_2,width(protein)[1]))###str_c元素对元素的合并列表
43
+ print(trimmed_protein)
44
+ }else if(start_pos_2<=width(protein)[1]){
45
+ trimmed_protein <- substr(protein,start_pos_2,width(protein)[1])#从start到全长
46
+ }else {
47
+ trimmed_protein <- substr(protein,1,end_pos_1)#从起始到end
48
+ }#到此截取了想要的氨基酸(所有序列的)
49
+ return(sum(sapply(1:length(trimmed_protein),chi2_1,set=trimmed_protein)))###对于每一个物种
50
+ }
51
+
52
+
53
+ library(parallel)
54
+
55
+ cl<-makeCluster(48)
56
+
57
+ trimmed_chi2_set <- parLapply(cl,1:width(protein)[1],trimmed_chi2)
58
+
59
+ stopCluster(cl)
60
+
61
+ save.image("/lomi_home/wenxiu/RIS_virus/workdir/27_ortho_RIStree/ortho_tree/v1/tree_workdir/test_removed_bias.aln")
62
+
63
+
64
+ ###删除对应的位点
65
+ trim_site<-function(percentage){
66
+ protein1<-protein
67
+ realnum=c()
68
+ for (i in 1:length(trimmed_chi2_set)) {
69
+ realnum= c(realnum,trimmed_chi2_set[[i]])
70
+ }
71
+ #realnum=abs(realnum-untrim)
72
+ print(percentage*length(realnum))
73
+ kafang<-realnum[order(realnum,decreasing = F)[round(percentage*length(realnum))]]
74
+ site_to_be_removed=which(realnum<=kafang)
75
+ site<-IRanges(start=site_to_be_removed, end=site_to_be_removed, width=1)
76
+ protein
77
+ replaceAt(protein1,site,'')
78
+ protein1<-replaceAt(protein1,site,'')
79
+ substr(protein1[1],start=1,stop=width(protein1)[1])
80
+ #10:5984
81
+ #print(paste0('~/removed_bias_dataset3_concatenate_',percentage,'.txt'))
82
+ writeXStringSet(protein1,paste0('/lomi_home/wenxiu/RIS_virus/workdir/27_ortho_RIStree/ortho_tree/v1/tree_workdir/test_removed_bias.trimmed.concat_',percentage*100,'%.fas'))
83
+ }
84
+
85
+
86
+ for (cutoff in c(0.05,0.1,0.2,0.3,0.4,0.6,0.8,0.9)) {
87
+ trim_site(cutoff)
88
+ }
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ ###先分成两份,再取5%
98
+ # protein1<-protein
99
+ # realnum=c()
100
+ # for (i in 1:length(trimmed_chi2_set)) {
101
+ # realnum= c(realnum,trimmed_chi2_set[[i]])
102
+ # }
103
+ # realnumplus<-realnum[which(realnum-untrim>0)]
104
+ # realnummiuis<-realnum[which(realnum-untrim<0)]
105
+ # plus<-realnumplus[order(realnumplus,decreasing = T)[1:(0.1*length(realnumplus)+1)]]
106
+ # miuis<-realnummiuis[order(realnummiuis,decreasing = F)[1:(0.1*length(realnummiuis)+1)]]
107
+ # site_to_be_removed=which(realnum %in% c(plus,miuis))
108
+ # site<-IRanges(start=site_to_be_removed, end=site_to_be_removed, width=1)
109
+ # protein
110
+ # replaceAt(protein1,site,'')
111
+ # protein1<-replaceAt(protein1,site,'')
112
+ # substr(protein1[1],start=1,stop=5984)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TreeSAK
3
- Version: 1.46.24
3
+ Version: 1.46.26
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.46.24
27
+ TreeSAK v1.46.26
@@ -99,6 +99,7 @@ TreeSAK/prep_mcmctree_ctl.py
99
99
  TreeSAK/print_leaves.py
100
100
  TreeSAK/pruneMSA.py
101
101
  TreeSAK/recode.py
102
+ TreeSAK/remove_bias.R
102
103
  TreeSAK/rename_leaves.py
103
104
  TreeSAK/replace_clade.py
104
105
  TreeSAK/root_with_out_group.py
@@ -772,6 +772,8 @@ if __name__ == '__main__':
772
772
  iTOL_parser.add_argument('-ExternalShape', required=False, action='store_true', help='ExternalShape')
773
773
  iTOL_parser.add_argument('-Binary', required=False, action='store_true', help='Binary')
774
774
  iTOL_parser.add_argument('-BinaryID', required=False, action='store_true', help='Binary specified IDs as 1')
775
+ iTOL_parser.add_argument('-BinaryShape', required=False, default='2', help='Binary Shape, choose from 1(rectangle), 2(circle), 3(star), 4, 5 and 6, default is 2')
776
+ iTOL_parser.add_argument('-BinaryColor', required=False, default='red', help='Binary Color, default is red')
775
777
  iTOL_parser.add_argument('-Connection', required=False, action='store_true', help='Connection')
776
778
  iTOL_parser.add_argument('-PieChart', required=False, action='store_true', help='PieChart')
777
779
  iTOL_parser.add_argument('-Collapse', required=False, action='store_true', help='Collapse')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes