TreeSAK 1.52.8__tar.gz → 1.52.9__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.52.8/treesak.egg-info → treesak-1.52.9}/PKG-INFO +2 -2
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/VERSION +1 -1
- treesak-1.52.9/TreeSAK/ar53.py +118 -0
- {treesak-1.52.8 → treesak-1.52.9}/bin/TreeSAK +2 -1
- {treesak-1.52.8 → treesak-1.52.9/treesak.egg-info}/PKG-INFO +2 -2
- treesak-1.52.8/TreeSAK/ar53.py +0 -89
- {treesak-1.52.8 → treesak-1.52.9}/LICENSE +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/MANIFEST.in +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/README.md +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE1.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE2.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE2RTC.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE3.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE4.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE5.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE6.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE7.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ALE_backup.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/AssessCVG.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/AssessMarker.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/AssessMarkerPA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/AssessPB.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/BMGE.jar +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/BMGE.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/C60SR4.nex +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/CompareMCMC.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ConcateMSA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ConvertMSA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/Dir.rb +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/FastRoot.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/FastRoot_backup.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/FigTree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/GTDB_tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/GeneTree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/KEGG_Luo17.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/LcaToLeaves.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/MarkerRef2Tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/MarkerSeq2Tree_backup.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ModifyTopo.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/Newick_tree_plotter.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/OMA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/OMA2.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/OneLineAln.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PB.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PMSF.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PhyloBiAssoc.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PhyloBiAssoc.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PlotMCMC.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PlotMcmcNode.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/PlotMcmcNode_old.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/RootTree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/RootTreeGTDB214.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/RootTreeGTDB220.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/RootTreeGTDB226.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SequentialDating.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SingleAleHGT.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SingleLinePhy.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SliceMSA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SplitScore.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SplitScore1.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SplitScore1OMA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/SplitScore2.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/TaxaCountStats.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/TaxonTree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/TreeSAK_config.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/VisHPD95.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/VisHPD95.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/__init__.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ale_parser.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/ale_splitter.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/alignment_pruner.pl +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/assessOG.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/catfasta2phy.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/cogTree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/compare_trees.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/compare_trees.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/dating.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/dating_ss.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/deltall.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/do_rrtc.rb +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/fa2phy.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/format_leaf_name.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/gap_stats.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/get_SCG_tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/get_arCOG_seq.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/global_functions.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/gnm_leaves.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/iTOL.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/iTOL_gene_tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/itol_msa_stats.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/keep_highest_rrtc.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/koTree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/label_tree.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/label_tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/mad.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/mcmc2tree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/mcmcTC copy.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/mcmcTC.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/mcmctree_vs_reltime.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/mcmctree_vs_reltime.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/merge_pdf.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/pRTC.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/parse_mcmctree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/parse_reltime.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/phy2fa.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/plot_distruibution_th.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/print_leaves.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/pruneMSA.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/recode.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/remove_bias.R +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/rename_leaves.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/replace_clade.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/root_with_out_group.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/subsample_drep_gnms.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/subset.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/supertree.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/tmp_1.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/tmp_2.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/tmp_3.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/tmp_4.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/TreeSAK/weighted_rand.rb +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/setup.cfg +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/setup.py +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/treesak.egg-info/SOURCES.txt +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/treesak.egg-info/dependency_links.txt +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/treesak.egg-info/requires.txt +0 -0
- {treesak-1.52.8 → treesak-1.52.9}/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.52.
|
|
3
|
+
Version: 1.52.9
|
|
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.52.
|
|
27
|
+
TreeSAK v1.52.9
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import glob
|
|
3
|
+
import argparse
|
|
4
|
+
from Bio import SeqIO
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
ar53_usage = '''
|
|
8
|
+
===================================== ar53 example commands =====================================
|
|
9
|
+
|
|
10
|
+
TreeSAK ar53 -i seq_dir -x fa -g interested_gnms.txt -m interested_marker.txt -o seq_dir_renamed
|
|
11
|
+
|
|
12
|
+
=================================================================================================
|
|
13
|
+
'''
|
|
14
|
+
|
|
15
|
+
def sep_path_basename_ext(file_in):
|
|
16
|
+
|
|
17
|
+
f_path, f_name = os.path.split(file_in)
|
|
18
|
+
if f_path == '':
|
|
19
|
+
f_path = '.'
|
|
20
|
+
f_base, f_ext = os.path.splitext(f_name)
|
|
21
|
+
f_ext = f_ext[1:]
|
|
22
|
+
|
|
23
|
+
return f_name, f_path, f_base, f_ext
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_shared_uniq_elements(list_1, list_2):
|
|
27
|
+
shared_set = set(list_1).intersection(list_2)
|
|
28
|
+
list_1_uniq = []
|
|
29
|
+
for e1 in list_1:
|
|
30
|
+
if e1 not in shared_set:
|
|
31
|
+
list_1_uniq.append(e1)
|
|
32
|
+
list_2_uniq = []
|
|
33
|
+
for e2 in list_2:
|
|
34
|
+
if e2 not in shared_set:
|
|
35
|
+
list_2_uniq.append(e2)
|
|
36
|
+
return shared_set, list_1_uniq, list_2_uniq
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def ar53(args):
|
|
40
|
+
|
|
41
|
+
marker_seq_dir = args['i']
|
|
42
|
+
marker_seq_ext = args['x']
|
|
43
|
+
interested_gnm_txt = args['g']
|
|
44
|
+
interested_marker_txt = args['m']
|
|
45
|
+
op_dir = args['o']
|
|
46
|
+
force_overwrite = args['f']
|
|
47
|
+
|
|
48
|
+
# create output folder
|
|
49
|
+
if os.path.isdir(op_dir) is True:
|
|
50
|
+
if force_overwrite is True:
|
|
51
|
+
os.system('rm -r %s' % op_dir)
|
|
52
|
+
else:
|
|
53
|
+
print('%s exist, program exited!' % op_dir)
|
|
54
|
+
exit()
|
|
55
|
+
os.mkdir(op_dir)
|
|
56
|
+
|
|
57
|
+
interested_marker_set = set()
|
|
58
|
+
if os.path.isfile(interested_marker_txt) is True:
|
|
59
|
+
for each_marker in open(interested_marker_txt):
|
|
60
|
+
interested_marker_set.add(each_marker.strip())
|
|
61
|
+
if len(interested_marker_set) == 0:
|
|
62
|
+
print('No marker provided in %s, program exited!' % interested_gnm_txt)
|
|
63
|
+
exit()
|
|
64
|
+
|
|
65
|
+
interested_gnm_set = set()
|
|
66
|
+
if os.path.isfile(interested_gnm_txt) is True:
|
|
67
|
+
for each_gnm in open(interested_gnm_txt):
|
|
68
|
+
interested_gnm_set.add(each_gnm.strip())
|
|
69
|
+
if len(interested_gnm_set) == 0:
|
|
70
|
+
print('No genome provided in %s, program exited!' % interested_gnm_txt)
|
|
71
|
+
exit()
|
|
72
|
+
|
|
73
|
+
marker_seq_re = '%s/*.%s' % (marker_seq_dir, marker_seq_ext)
|
|
74
|
+
marker_seq_list = [os.path.basename(i) for i in glob.glob(marker_seq_re)]
|
|
75
|
+
marker_seq_id_list = [('.'.join(i.split('.')[:-1])) for i in marker_seq_list]
|
|
76
|
+
if len(marker_seq_list) == 0:
|
|
77
|
+
print('No file found in %s, program exited!' % marker_seq_dir)
|
|
78
|
+
exit()
|
|
79
|
+
|
|
80
|
+
marker_to_process = set()
|
|
81
|
+
if len(interested_marker_set) == 0:
|
|
82
|
+
marker_to_process = marker_seq_id_list
|
|
83
|
+
else:
|
|
84
|
+
shared_set, marker_seq_uniq, interested_marker_uniq = get_shared_uniq_elements(marker_seq_id_list, interested_marker_set)
|
|
85
|
+
if len(interested_marker_uniq) > 0:
|
|
86
|
+
print('Sequences for the following interested markers were not found:')
|
|
87
|
+
print(','.join(interested_marker_uniq))
|
|
88
|
+
marker_to_process = shared_set
|
|
89
|
+
|
|
90
|
+
for marker_id in marker_to_process:
|
|
91
|
+
pwd_file_in = '%s/%s.%s' % (marker_seq_dir, marker_id, marker_seq_ext)
|
|
92
|
+
pwd_file_out = '%s/%s.%s' % (op_dir, marker_id, marker_seq_ext)
|
|
93
|
+
pwd_op_file_handle = open(pwd_file_out, 'w')
|
|
94
|
+
for each_seq in SeqIO.parse(pwd_file_in, 'fasta'):
|
|
95
|
+
gnm_id = each_seq.id
|
|
96
|
+
if os.path.isfile(interested_gnm_txt) is False:
|
|
97
|
+
pwd_op_file_handle.write('>%s_XXX\n' % gnm_id)
|
|
98
|
+
pwd_op_file_handle.write('%s\n' % str(each_seq.seq))
|
|
99
|
+
else:
|
|
100
|
+
if gnm_id in interested_gnm_set:
|
|
101
|
+
pwd_op_file_handle.write('>%s_XXX\n' % gnm_id)
|
|
102
|
+
pwd_op_file_handle.write('%s\n' % str(each_seq.seq))
|
|
103
|
+
pwd_op_file_handle.close()
|
|
104
|
+
|
|
105
|
+
print('Done!')
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
if __name__ == '__main__':
|
|
109
|
+
|
|
110
|
+
ar53_parser = argparse.ArgumentParser()
|
|
111
|
+
ar53_parser.add_argument('-i', required=True, help='sequence folder')
|
|
112
|
+
ar53_parser.add_argument('-x', required=True, help='file extension')
|
|
113
|
+
ar53_parser.add_argument('-g', required=False, default=None, help='interested genome, no extension, one id per line')
|
|
114
|
+
ar53_parser.add_argument('-m', required=False, default=None, help='interested marker, no extension, one id per line')
|
|
115
|
+
ar53_parser.add_argument('-o', required=True, help='output folder')
|
|
116
|
+
ar53_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
117
|
+
args = vars(ar53_parser.parse_args())
|
|
118
|
+
ar53(args)
|
|
@@ -940,7 +940,8 @@ if __name__ == '__main__':
|
|
|
940
940
|
ar53_parser = subparsers.add_parser('ar53', usage=ar53.ar53_usage)
|
|
941
941
|
ar53_parser.add_argument('-i', required=True, help='sequence folder')
|
|
942
942
|
ar53_parser.add_argument('-x', required=True, help='file extension')
|
|
943
|
-
ar53_parser.add_argument('-g', required=False, default=None, help='interested
|
|
943
|
+
ar53_parser.add_argument('-g', required=False, default=None, help='interested genome, no extension, one id per line')
|
|
944
|
+
ar53_parser.add_argument('-m', required=False, default=None, help='interested marker, no extension, one id per line')
|
|
944
945
|
ar53_parser.add_argument('-o', required=True, help='output folder')
|
|
945
946
|
ar53_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
946
947
|
args = vars(parser.parse_args())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: treesak
|
|
3
|
-
Version: 1.52.
|
|
3
|
+
Version: 1.52.9
|
|
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.52.
|
|
27
|
+
TreeSAK v1.52.9
|
treesak-1.52.8/TreeSAK/ar53.py
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import glob
|
|
3
|
-
import argparse
|
|
4
|
-
from Bio import SeqIO
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ar53_usage = '''
|
|
8
|
-
========================= ar53 example commands =========================
|
|
9
|
-
|
|
10
|
-
TreeSAK ar53 -i seq_dir -x fa -g interested_gnms.txt -o seq_dir_renamed
|
|
11
|
-
|
|
12
|
-
=========================================================================
|
|
13
|
-
'''
|
|
14
|
-
|
|
15
|
-
def sep_path_basename_ext(file_in):
|
|
16
|
-
|
|
17
|
-
f_path, f_name = os.path.split(file_in)
|
|
18
|
-
if f_path == '':
|
|
19
|
-
f_path = '.'
|
|
20
|
-
f_base, f_ext = os.path.splitext(f_name)
|
|
21
|
-
f_ext = f_ext[1:]
|
|
22
|
-
|
|
23
|
-
return f_name, f_path, f_base, f_ext
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def ar53(args):
|
|
27
|
-
|
|
28
|
-
marker_seq_dir = args['i']
|
|
29
|
-
marker_seq_ext = args['x']
|
|
30
|
-
interested_gnm_txt = args['g']
|
|
31
|
-
op_dir = args['o']
|
|
32
|
-
force_overwrite = args['f']
|
|
33
|
-
|
|
34
|
-
# create output folder
|
|
35
|
-
if os.path.isdir(op_dir) is True:
|
|
36
|
-
if force_overwrite is True:
|
|
37
|
-
os.system('rm -r %s' % op_dir)
|
|
38
|
-
else:
|
|
39
|
-
print('%s exist, program exited!' % op_dir)
|
|
40
|
-
exit()
|
|
41
|
-
os.mkdir(op_dir)
|
|
42
|
-
|
|
43
|
-
interested_gnm_set = set()
|
|
44
|
-
if os.path.isfile(interested_gnm_txt) is True:
|
|
45
|
-
for each_gnm in open(interested_gnm_txt):
|
|
46
|
-
interested_gnm_set.add(each_gnm.strip())
|
|
47
|
-
if len(interested_gnm_set) == 0:
|
|
48
|
-
print('No genome provided in %s, program exited!' % interested_gnm_txt)
|
|
49
|
-
exit()
|
|
50
|
-
|
|
51
|
-
marker_seq_re = '%s/*.%s' % (marker_seq_dir, marker_seq_ext)
|
|
52
|
-
marker_seq_list = sorted(glob.glob(marker_seq_re))
|
|
53
|
-
|
|
54
|
-
if len(marker_seq_list) == 0:
|
|
55
|
-
print('No file found in %s, program exited!' % marker_seq_dir)
|
|
56
|
-
exit()
|
|
57
|
-
|
|
58
|
-
for marker_seq in marker_seq_list:
|
|
59
|
-
|
|
60
|
-
f_name, _, _, _ = sep_path_basename_ext(marker_seq)
|
|
61
|
-
pwd_op_file = '%s/%s' % (op_dir, f_name)
|
|
62
|
-
|
|
63
|
-
pwd_op_file_handle = open(pwd_op_file, 'w')
|
|
64
|
-
for each_seq in SeqIO.parse(marker_seq, 'fasta'):
|
|
65
|
-
gnm_id = each_seq.id
|
|
66
|
-
|
|
67
|
-
if os.path.isfile(interested_gnm_txt) is False:
|
|
68
|
-
pwd_op_file_handle.write('>%s_XXX\n' % gnm_id)
|
|
69
|
-
pwd_op_file_handle.write('%s\n' % str(each_seq.seq))
|
|
70
|
-
else:
|
|
71
|
-
if gnm_id in interested_gnm_set:
|
|
72
|
-
pwd_op_file_handle.write('>%s_XXX\n' % gnm_id)
|
|
73
|
-
pwd_op_file_handle.write('%s\n' % str(each_seq.seq))
|
|
74
|
-
pwd_op_file_handle.close()
|
|
75
|
-
|
|
76
|
-
print('Done!')
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if __name__ == '__main__':
|
|
80
|
-
|
|
81
|
-
ar53_parser = argparse.ArgumentParser()
|
|
82
|
-
ar53_parser.add_argument('-i', required=True, help='sequence folder')
|
|
83
|
-
ar53_parser.add_argument('-x', required=True, help='file extension')
|
|
84
|
-
ar53_parser.add_argument('-g', required=False, default=None, help='interested genomes, no file extension, one id per line')
|
|
85
|
-
ar53_parser.add_argument('-o', required=True, help='output folder')
|
|
86
|
-
ar53_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
87
|
-
args = vars(ar53_parser.parse_args())
|
|
88
|
-
ar53(args)
|
|
89
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|