TreeSAK 1.53.3__tar.gz → 1.53.5__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.53.3 → treesak-1.53.5}/PKG-INFO +2 -2
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/VERSION +1 -1
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/batch_itol.py +3 -3
- treesak-1.53.5/TreeSAK/gap_stats.py +76 -0
- treesak-1.53.5/TreeSAK/tmp_5.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/bin/TreeSAK +5 -1
- {treesak-1.53.3 → treesak-1.53.5}/treesak.egg-info/PKG-INFO +2 -2
- treesak-1.53.3/TreeSAK/gap_stats.py +0 -38
- treesak-1.53.3/TreeSAK/tmp_5.py +0 -12
- {treesak-1.53.3 → treesak-1.53.5}/LICENSE +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/MANIFEST.in +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/README.md +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE1.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE2.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE2RTC.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE3.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE4.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE5.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE6.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE7.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ALE_backup.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/AssessCVG.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/AssessMarker.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/AssessMarkerPA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/AssessPB.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/BMGE.jar +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/BMGE.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/C60SR4.nex +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/CompareMCMC.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ConcateMSA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ConvertMSA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/Dir.rb +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/FastRoot.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/FastRoot_backup.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/FigTree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/GTDB_tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/GeneTree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/KEGG_Luo17.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/LcaToLeaves.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/MarkerRef2Tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/MarkerSeq2Tree_backup.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ModifyTopo.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/Newick_tree_plotter.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/OMA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/OMA2.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/OneLineAln.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PB.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PMSF.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PhyloBiAssoc.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PhyloBiAssoc.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PlotMCMC.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PlotMcmcNode.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/PlotMcmcNode_old.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/RootTree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/RootTreeGTDB.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/RootTreeGTDB214.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/RootTreeGTDB220.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SequentialDating.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SingleAleHGT.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SingleLinePhy.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SliceMSA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SplitScore.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SplitScore1.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SplitScore1OMA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/SplitScore2.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/TaxaCountStats.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/TaxonTree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/TreeSAK_config.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/VisHPD95.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/VisHPD95.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/__init__.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ale_parser.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/ale_splitter.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/alignment_pruner.pl +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/assessOG.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/catfasta2phy.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/cogTree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/compare_trees.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/compare_trees.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/dating.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/dating_ss.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/deltall.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/do_rrtc.rb +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/fa2phy.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/filter_rename_ar53.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/format_leaf_name.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/get_SCG_tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/get_arCOG_seq.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/global_functions.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/gnm_leaves.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/iTOL.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/iTOL_gene_tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/itol_msa_stats.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/keep_highest_rrtc.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/koTree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/label_gene_tree_by_gnm.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/label_tree.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/label_tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/mad.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/mcmc2tree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/mcmcTC copy.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/mcmcTC.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/mcmctree_vs_reltime.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/mcmctree_vs_reltime.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/merge_pdf.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/pRTC.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/parse_mcmctree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/parse_reltime.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/phy2fa.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/plot_distruibution_th.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/print_leaves.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/pruneMSA.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/recode.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/remove_bias.R +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/rename_leaves.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/replace_clade.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/root_with_out_group.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/subsample_drep_gnms.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/subset.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/supertree.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/tmp_1.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/tmp_2.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/tmp_3.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/tmp_4.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/TreeSAK/weighted_rand.rb +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/setup.cfg +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/setup.py +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/treesak.egg-info/SOURCES.txt +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/treesak.egg-info/dependency_links.txt +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/treesak.egg-info/requires.txt +0 -0
- {treesak-1.53.3 → treesak-1.53.5}/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.53.
|
|
3
|
+
Version: 1.53.5
|
|
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.53.
|
|
27
|
+
TreeSAK v1.53.5
|
|
@@ -16,7 +16,7 @@ https://github.com/albertyw/itolapi
|
|
|
16
16
|
http://itol.embl.de/help.cgi#batch
|
|
17
17
|
|
|
18
18
|
# An example of the parameter file is available here
|
|
19
|
-
|
|
19
|
+
https://github.com/songweizhi/TreeSAK/blob/master/DemoData/batch_itol/batch_itol_para.txt
|
|
20
20
|
|
|
21
21
|
===========================================================================================================
|
|
22
22
|
'''
|
|
@@ -116,7 +116,7 @@ def batch_itol(args):
|
|
|
116
116
|
|
|
117
117
|
para_dict = dict()
|
|
118
118
|
if para_txt is not None:
|
|
119
|
-
if os.path.isfile(
|
|
119
|
+
if os.path.isfile(para_txt) is False:
|
|
120
120
|
print('The specified parameter file does not exist, program exited!')
|
|
121
121
|
exit()
|
|
122
122
|
else:
|
|
@@ -146,7 +146,7 @@ def batch_itol(args):
|
|
|
146
146
|
exit()
|
|
147
147
|
os.system('mkdir %s' % op_file_dir)
|
|
148
148
|
|
|
149
|
-
for each_file in file_list:
|
|
149
|
+
for each_file in sorted(file_list):
|
|
150
150
|
f_name, f_path, f_base, f_ext = sep_path_basename_ext(each_file)
|
|
151
151
|
op_pdf = '%s/%s.pdf' % (op_file_dir, f_base)
|
|
152
152
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from Bio import SeqIO
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
gap_stats_usage = '''
|
|
6
|
+
================================== gap_stats example commands ==================================
|
|
7
|
+
|
|
8
|
+
TreeSAK gap_stats -i msa.fasta -c 40 -o1 stats.txt -o2 msa_maxgap40.fasta -o3 MSA_gap_iTOL.txt
|
|
9
|
+
|
|
10
|
+
================================================================================================
|
|
11
|
+
'''
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def gap_stats(args):
|
|
15
|
+
|
|
16
|
+
msa_in_fa = args['i']
|
|
17
|
+
gap_cutoff = args['c']
|
|
18
|
+
op_stats_txt = args['o1']
|
|
19
|
+
op_msa_file = args['o2']
|
|
20
|
+
op_itol_file = args['o3']
|
|
21
|
+
|
|
22
|
+
if gap_cutoff != 100:
|
|
23
|
+
op_msa_file_handle = open(op_msa_file, 'w')
|
|
24
|
+
|
|
25
|
+
qualified_seq_set = set()
|
|
26
|
+
gap_pct_dict = dict()
|
|
27
|
+
for each_seq in SeqIO.parse(msa_in_fa, 'fasta'):
|
|
28
|
+
seq_id = each_seq.id
|
|
29
|
+
seq_str = str(each_seq.seq)
|
|
30
|
+
gap_pct = seq_str.count('-')*100/len(seq_str)
|
|
31
|
+
gap_pct = float("{0:.2f}".format(gap_pct))
|
|
32
|
+
gap_pct_dict[seq_id] = gap_pct
|
|
33
|
+
|
|
34
|
+
if (gap_cutoff != 100) and (gap_pct <= gap_cutoff):
|
|
35
|
+
op_msa_file_handle.write('>%s\n' % (seq_id))
|
|
36
|
+
op_msa_file_handle.write('%s\n' % (seq_str))
|
|
37
|
+
qualified_seq_set.add(seq_id)
|
|
38
|
+
if gap_cutoff != 100:
|
|
39
|
+
op_msa_file_handle.close()
|
|
40
|
+
|
|
41
|
+
gap_pct_sorted = sorted(gap_pct_dict.items(), key=lambda x: x[1])
|
|
42
|
+
|
|
43
|
+
# write stats
|
|
44
|
+
op_stats_txt_handle = open(op_stats_txt, 'w')
|
|
45
|
+
op_stats_txt_handle.write('Sequence\tGap\n')
|
|
46
|
+
for each_seq in gap_pct_sorted:
|
|
47
|
+
op_stats_txt_handle.write('%s\t%s\n' % (each_seq[0], each_seq[1]))
|
|
48
|
+
op_stats_txt_handle.close()
|
|
49
|
+
|
|
50
|
+
# prepare itol file
|
|
51
|
+
if op_itol_file != None:
|
|
52
|
+
op_itol_file_handle = open(op_itol_file, 'w')
|
|
53
|
+
op_itol_file_handle.write('DATASET_BINARY\n\nSEPARATOR TAB\nDATASET_LABEL\tMSA_Gap_%s\nCOLOR\tred\n' % gap_cutoff)
|
|
54
|
+
op_itol_file_handle.write('SHOW_LABELS\t1\nLABEL_ROTATION\t45\nLABEL_SHIFT\t5\n')
|
|
55
|
+
op_itol_file_handle.write('FIELD_LABELS\tMSA_Gap_%s\n' % gap_cutoff)
|
|
56
|
+
op_itol_file_handle.write('FIELD_COLORS\tred\n')
|
|
57
|
+
op_itol_file_handle.write('FIELD_SHAPES\t2\n')
|
|
58
|
+
op_itol_file_handle.write('MARGIN\t10\n')
|
|
59
|
+
op_itol_file_handle.write('HORIZONTAL_GRID\t0\n')
|
|
60
|
+
op_itol_file_handle.write('VERTICAL_GRID\t0\n')
|
|
61
|
+
op_itol_file_handle.write('\nDATA\n')
|
|
62
|
+
for each in sorted(list(qualified_seq_set)):
|
|
63
|
+
op_itol_file_handle.write('%s\t1\n' % each)
|
|
64
|
+
op_itol_file_handle.close()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if __name__ == '__main__':
|
|
68
|
+
|
|
69
|
+
gap_stats_parser = argparse.ArgumentParser()
|
|
70
|
+
gap_stats_parser.add_argument('-i', required=True, help='MSA in fasta format')
|
|
71
|
+
gap_stats_parser.add_argument('-c', required=False, default=100, help='maximum gap allowed in MSAs, default is 100, i.e., no filtering')
|
|
72
|
+
gap_stats_parser.add_argument('-o1', required=True, help='output stats file')
|
|
73
|
+
gap_stats_parser.add_argument('-o2', required=False, default=None, help='filtered MSA')
|
|
74
|
+
gap_stats_parser.add_argument('-o3', required=False, default=None, help='iTOL file')
|
|
75
|
+
args = vars(gap_stats_parser.parse_args())
|
|
76
|
+
gap_stats(args)
|
|
File without changes
|
|
@@ -730,7 +730,11 @@ if __name__ == '__main__':
|
|
|
730
730
|
elif sys.argv[1] == 'gap_stats':
|
|
731
731
|
from TreeSAK import gap_stats
|
|
732
732
|
gap_stats_parser = subparsers.add_parser('gap_stats', usage=gap_stats.gap_stats_usage)
|
|
733
|
-
gap_stats_parser.add_argument('-i',
|
|
733
|
+
gap_stats_parser.add_argument('-i', required=True, help='MSA in fasta format')
|
|
734
|
+
gap_stats_parser.add_argument('-c', required=False, default=100, help='maximum gap allowed in MSAs, default is 100, i.e., no filtering')
|
|
735
|
+
gap_stats_parser.add_argument('-o1', required=True, help='output stats file')
|
|
736
|
+
gap_stats_parser.add_argument('-o2', required=False, default=None, help='filtered MSA')
|
|
737
|
+
gap_stats_parser.add_argument('-o3', required=False, default=None, help='iTOL file')
|
|
734
738
|
args = vars(parser.parse_args())
|
|
735
739
|
gap_stats.gap_stats(args)
|
|
736
740
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: treesak
|
|
3
|
-
Version: 1.53.
|
|
3
|
+
Version: 1.53.5
|
|
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.53.
|
|
27
|
+
TreeSAK v1.53.5
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import argparse
|
|
2
|
-
from Bio import SeqIO
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
gap_stats_usage = '''
|
|
6
|
-
======= gap_stats example commands =======
|
|
7
|
-
|
|
8
|
-
TreeSAK gap_stats -i msa.fasta
|
|
9
|
-
|
|
10
|
-
==========================================
|
|
11
|
-
'''
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def gap_stats(args):
|
|
15
|
-
|
|
16
|
-
msa_in_fa = args['i']
|
|
17
|
-
|
|
18
|
-
gap_pct_dict = dict()
|
|
19
|
-
for each_seq in SeqIO.parse(msa_in_fa, 'fasta'):
|
|
20
|
-
seq_id = each_seq.id
|
|
21
|
-
seq_str = str(each_seq.seq)
|
|
22
|
-
gap_pct = seq_str.count('-')*100/len(seq_str)
|
|
23
|
-
gap_pct = float("{0:.2f}".format(gap_pct))
|
|
24
|
-
gap_pct_dict[seq_id] = gap_pct
|
|
25
|
-
|
|
26
|
-
gap_pct_sorted = sorted(gap_pct_dict.items(), key=lambda x: x[1])
|
|
27
|
-
|
|
28
|
-
print('Sequence\tGap')
|
|
29
|
-
for each_seq in gap_pct_sorted:
|
|
30
|
-
print('%s\t%s' % (each_seq[0], each_seq[1]))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if __name__ == '__main__':
|
|
34
|
-
|
|
35
|
-
gap_stats_parser = argparse.ArgumentParser()
|
|
36
|
-
gap_stats_parser.add_argument('-i', required=True, help='MSA in fasta format')
|
|
37
|
-
args = vars(gap_stats_parser.parse_args())
|
|
38
|
-
gap_stats(args)
|
treesak-1.53.3/TreeSAK/tmp_5.py
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
para_txt = '/Users/songweizhi/Desktop/555/batch_itol_para.txt'
|
|
3
|
-
|
|
4
|
-
para_dict = dict()
|
|
5
|
-
for each_line in open(para_txt):
|
|
6
|
-
if not each_line.startswith('#'):
|
|
7
|
-
if len(each_line.strip()) > 0:
|
|
8
|
-
para_without_comment = each_line.strip().split('#')[0].strip()
|
|
9
|
-
para_without_comment_split = para_without_comment.split('\t')
|
|
10
|
-
para_dict[para_without_comment_split[0]] = para_without_comment_split[1]
|
|
11
|
-
|
|
12
|
-
print(para_dict)
|
|
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
|