TreeSAK 1.6.0__tar.gz → 1.7.1__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.6.0/TreeSAK.egg-info → TreeSAK-1.7.1}/PKG-INFO +2 -2
- TreeSAK-1.7.1/TreeSAK/AssessMarkerPA.py +137 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/Marker2Tree.py +8 -8
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/VERSION +8 -5
- {TreeSAK-1.6.0 → TreeSAK-1.7.1/TreeSAK.egg-info}/PKG-INFO +2 -2
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK.egg-info/SOURCES.txt +1 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/bin/TreeSAK +13 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/.gitignore +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/LICENSE +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/MANIFEST.in +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/README.md +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/AssessCVG.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/ConvertMSA.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/OneLineAln.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/SliceMSA.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/TreeSAK_config copy.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/TreeSAK_config.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/__init__.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/compare_trees.R +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/compare_trees.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/format_leaf_name.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/get_arCOG_seq.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/iTOL.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/parse_deltall_stdout.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/rename_leaves.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK/subset_tree.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK.egg-info/dependency_links.txt +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK.egg-info/requires.txt +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/TreeSAK.egg-info/top_level.txt +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/bin/__init__.py +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/images/Bioinformatics.jpg +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/images/windows_cmds.docx +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/images/windows_cmds.pdf +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/setup.cfg +0 -0
- {TreeSAK-1.6.0 → TreeSAK-1.7.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.1
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/TreeSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -10,5 +10,5 @@ Keywords: Bioinformatics
|
|
|
10
10
|
Platform: UNKNOWN
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
|
|
13
|
-
TreeSAK v1.
|
|
13
|
+
TreeSAK v1.7.1
|
|
14
14
|
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import glob
|
|
3
|
+
import argparse
|
|
4
|
+
from Bio import SeqIO
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
AssessMarkerPA_usage = '''
|
|
8
|
+
=========================== AssessMarkerPA example commands ===========================
|
|
9
|
+
|
|
10
|
+
BioSAK AssessMarkerPA -a trimmed_aln -x aln -g gnm_group.txt -c 25-50-75-100 -o s10_assess_marker_PA
|
|
11
|
+
|
|
12
|
+
Note
|
|
13
|
+
1. Extra genomes in gnm_metadata.txt won't affect assessment results.
|
|
14
|
+
2. Genomes can not be found in gnm_metadata.txt will trigger an error.
|
|
15
|
+
3. Alignments in {trimmed_aln_dir} need to be trimmed before assessment
|
|
16
|
+
4. Sequences in MSAs need to be named by genome id.
|
|
17
|
+
|
|
18
|
+
=======================================================================================
|
|
19
|
+
'''
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def AssessMarkerPA(args):
|
|
23
|
+
|
|
24
|
+
trimmed_aln_dir = args['a']
|
|
25
|
+
trimmed_aln_ext = args['x']
|
|
26
|
+
gnm_meta_txt = args['g']
|
|
27
|
+
cutoff_str = args['c']
|
|
28
|
+
op_dir = args['o']
|
|
29
|
+
force_overwriting = args['f']
|
|
30
|
+
|
|
31
|
+
# create folder
|
|
32
|
+
if force_overwriting is True:
|
|
33
|
+
if os.path.isdir(op_dir) is True:
|
|
34
|
+
os.system('rm -r %s' % op_dir)
|
|
35
|
+
else:
|
|
36
|
+
if os.path.isdir(op_dir) is True:
|
|
37
|
+
print('Output folder already exist, program exited!')
|
|
38
|
+
exit()
|
|
39
|
+
os.system('mkdir %s' % op_dir)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
present_pct_cutoff_list = [int(i) for i in cutoff_str.split('-')]
|
|
43
|
+
assess_summary_1_txt = '%s/assessment_PA.txt' % op_dir
|
|
44
|
+
assess_summary_2_txt = '%s/assessment_PA_summary.txt' % op_dir
|
|
45
|
+
|
|
46
|
+
trimmed_aln_file_re = '%s/*.%s' % (trimmed_aln_dir, trimmed_aln_ext)
|
|
47
|
+
trimmed_aln_file_list = [os.path.basename(file_name) for file_name in glob.glob(trimmed_aln_file_re)]
|
|
48
|
+
|
|
49
|
+
# read in genome metadata
|
|
50
|
+
domain_to_gnm_dict = dict()
|
|
51
|
+
gnm_to_domain_dict = dict()
|
|
52
|
+
for each_gnm in open(gnm_meta_txt):
|
|
53
|
+
each_gnm_split = each_gnm.strip().split('\t')
|
|
54
|
+
gnm_id = each_gnm_split[0]
|
|
55
|
+
domain_name = each_gnm_split[1]
|
|
56
|
+
gnm_to_domain_dict[gnm_id] = domain_name
|
|
57
|
+
|
|
58
|
+
if domain_name not in domain_to_gnm_dict:
|
|
59
|
+
domain_to_gnm_dict[domain_name] = {gnm_id}
|
|
60
|
+
else:
|
|
61
|
+
domain_to_gnm_dict[domain_name].add(gnm_id)
|
|
62
|
+
|
|
63
|
+
assess_summary_1_txt_handle = open(assess_summary_1_txt, 'w')
|
|
64
|
+
assess_summary_2_txt_handle = open(assess_summary_2_txt, 'w')
|
|
65
|
+
cutoff_to_qualified_marker_dict = dict()
|
|
66
|
+
assess_summary_1_txt_handle.write('Marker\tArchaea\tEukaryota\n')
|
|
67
|
+
assess_summary_2_txt_handle.write('Marker\t%s\n' % '\t'.join([str(i) for i in present_pct_cutoff_list]))
|
|
68
|
+
for each_aln in trimmed_aln_file_list:
|
|
69
|
+
marker_id = each_aln.split('.aln')[0]
|
|
70
|
+
pwd_aln = '%s/%s' % (trimmed_aln_dir, each_aln)
|
|
71
|
+
gnm_set = set()
|
|
72
|
+
for each_seq in SeqIO.parse(pwd_aln, 'fasta'):
|
|
73
|
+
gnm_id = each_seq.id
|
|
74
|
+
gnm_set.add(gnm_id)
|
|
75
|
+
|
|
76
|
+
gnm_num_ar = 0
|
|
77
|
+
gnm_num_eu = 0
|
|
78
|
+
for each_g in gnm_set:
|
|
79
|
+
g_domain = gnm_to_domain_dict[each_g]
|
|
80
|
+
if g_domain == 'Archaea':
|
|
81
|
+
gnm_num_ar += 1
|
|
82
|
+
if g_domain == 'Eukaryota':
|
|
83
|
+
gnm_num_eu += 1
|
|
84
|
+
gnm_pct_ar = float("{0:.2f}".format(gnm_num_ar / 133 * 100))
|
|
85
|
+
gnm_pct_eu = float("{0:.2f}".format(gnm_num_eu / 27 * 100))
|
|
86
|
+
|
|
87
|
+
# assessment
|
|
88
|
+
assessment_result_list = []
|
|
89
|
+
for present_pct_cutoff in present_pct_cutoff_list:
|
|
90
|
+
if (gnm_pct_ar >= present_pct_cutoff) and (gnm_pct_eu >= present_pct_cutoff):
|
|
91
|
+
assessment_result_list.append('1')
|
|
92
|
+
if str(present_pct_cutoff) not in cutoff_to_qualified_marker_dict:
|
|
93
|
+
cutoff_to_qualified_marker_dict[str(present_pct_cutoff)] = [marker_id]
|
|
94
|
+
else:
|
|
95
|
+
cutoff_to_qualified_marker_dict[str(present_pct_cutoff)].append(marker_id)
|
|
96
|
+
else:
|
|
97
|
+
assessment_result_list.append('0')
|
|
98
|
+
assess_summary_1_txt_handle.write('%s\t%s\t%s\n' % (marker_id, gnm_pct_ar, gnm_pct_eu))
|
|
99
|
+
assess_summary_2_txt_handle.write('%s\t%s\n' % (marker_id, '\t'.join(assessment_result_list)))
|
|
100
|
+
|
|
101
|
+
summary_list = [len(cutoff_to_qualified_marker_dict.get(str(i), [])) for i in present_pct_cutoff_list]
|
|
102
|
+
summary_list_str = [str(j) for j in summary_list]
|
|
103
|
+
assess_summary_2_txt_handle.write('Total\t%s\n' % ('\t'.join(summary_list_str)))
|
|
104
|
+
assess_summary_1_txt_handle.close()
|
|
105
|
+
assess_summary_2_txt_handle.close()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
if __name__ == '__main__':
|
|
109
|
+
|
|
110
|
+
parser = argparse.ArgumentParser()
|
|
111
|
+
parser.add_argument('-a', required=True, help='trimmed alignments')
|
|
112
|
+
parser.add_argument('-x', required=True, help='extension of trimmed alignments')
|
|
113
|
+
parser.add_argument('-g', required=True, help='genome group')
|
|
114
|
+
parser.add_argument('-c', required=False, default='25-50-75-85-100', help='cutoffs, default: 25-50-75-85-100')
|
|
115
|
+
parser.add_argument('-o', required=True, help='output dir')
|
|
116
|
+
parser.add_argument('-f', required=False, action="store_true", help='force overwrite existing output folder')
|
|
117
|
+
args = vars(parser.parse_args())
|
|
118
|
+
AssessMarkerPA(args)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# assess_marker_wd = '/home-user/wzsong/DateArTree/04_dating_Williams_2017_45_arCOG_assess_marker'
|
|
122
|
+
# trimmed_aln_dir = '/home-user/wzsong/DateArTree/02_identify_marker_gene_Williams_2017_45_arCOG/best_hit_by_marker_5_aln_trimmed'
|
|
123
|
+
# gnm_group_txt = '/home-user/wzsong/DateArTree/01_genome_selection/gnm_metadata.txt'
|
|
124
|
+
# deltall_stdout_txt = '/home-user/wzsong/DateArTree/02_identify_marker_gene_Williams_2017_45_arCOG_DeltaLL/nohup.out'
|
|
125
|
+
# present_pct_cutoff_list = [25, 50, 75, 85, 100]
|
|
126
|
+
# deltall_keep_pct_list = [25, 50, 75, 100]
|
|
127
|
+
# min_marker_pct_per_gnm = 75
|
|
128
|
+
# min_marker_num = 20
|
|
129
|
+
# force_create_dir = True
|
|
130
|
+
# #catfasta2phyml_pl = '/Users/songweizhi/PycharmProjects/Sponge_Hologenome/Scripts/catfasta2phyml.pl'
|
|
131
|
+
# catfasta2phyml_pl = '/home-user/wzsong/Scripts/catfasta2phyml.pl'
|
|
132
|
+
|
|
133
|
+
'''
|
|
134
|
+
cd
|
|
135
|
+
BioSAK AssessMarkerPA -a op2/s06_identified_marker_aln_trimmed -x aln -g gnm_group.txt -c 25-50-75-100 -o op2/s10_assess_marker_PA
|
|
136
|
+
|
|
137
|
+
'''
|
|
@@ -7,14 +7,14 @@ from distutils.spawn import find_executable
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Marker2Tree_usage = '''
|
|
10
|
-
|
|
10
|
+
============================= Marker2Tree example commands =============================
|
|
11
11
|
|
|
12
12
|
Dependencies: blastp, mafft-einsi, trimal, iqtree
|
|
13
13
|
|
|
14
14
|
# example commands
|
|
15
15
|
BioSAK Marker2Tree -m marker_seq -mx fa -aa gnm_faa_files -aax faa -o op_dir -e 30 -t 6 -pl /home-user/wzsong/Scripts/catfasta2phyml.pl
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
========================================================================================
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
|
|
@@ -121,12 +121,12 @@ def Marker2Tree(args):
|
|
|
121
121
|
blastp_cmd_txt = '%s/blastp_cmds_%s.txt' % (op_dir, (len(gnm_id_list_sorted)*len(marker_id_set)))
|
|
122
122
|
pwd_combined_protein = '%s/combined.faa' % op_dir
|
|
123
123
|
blast_op_dir = '%s/s01_blast_op' % op_dir
|
|
124
|
-
best_hit_id_by_marker_dir = '%s/
|
|
125
|
-
best_hit_seq_by_marker_dir = '%s/
|
|
126
|
-
best_hit_seq_by_marker_dir_renamed = '%s/
|
|
127
|
-
best_hit_aln_by_marker_dir = '%s/
|
|
128
|
-
best_hit_aln_by_marker_dir_trimmed = '%s/
|
|
129
|
-
best_hit_aln_by_marker_dir_trimmed_c = '%s/
|
|
124
|
+
best_hit_id_by_marker_dir = '%s/s02_identified_marker_id' % op_dir
|
|
125
|
+
best_hit_seq_by_marker_dir = '%s/s03_identified_marker_seq' % op_dir
|
|
126
|
+
best_hit_seq_by_marker_dir_renamed = '%s/s04_identified_marker_seq_renamed' % op_dir
|
|
127
|
+
best_hit_aln_by_marker_dir = '%s/s05_identified_marker_aln' % op_dir
|
|
128
|
+
best_hit_aln_by_marker_dir_trimmed = '%s/s06_identified_marker_aln_trimmed' % op_dir
|
|
129
|
+
best_hit_aln_by_marker_dir_trimmed_c = '%s/s07_identified_marker_aln_trimmed_concatenated' % op_dir
|
|
130
130
|
get_guide_tree_dir = '%s/s08_get_guide_tree' % op_dir
|
|
131
131
|
iqtree_dir = '%s/s09_iqtree_C60_PMSF' % op_dir
|
|
132
132
|
pwd_concatenate_phy = '%s/concatenated.phy' % best_hit_aln_by_marker_dir_trimmed_c
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: TreeSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.1
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/TreeSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -10,5 +10,5 @@ Keywords: Bioinformatics
|
|
|
10
10
|
Platform: UNKNOWN
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
|
|
13
|
-
TreeSAK v1.
|
|
13
|
+
TreeSAK v1.7.1
|
|
14
14
|
|
|
@@ -36,6 +36,8 @@ def print_main_help():
|
|
|
36
36
|
parse_deltall_stdout -> Parse stdout of deltaLL.rb
|
|
37
37
|
get_arCOG_seq -> Retrieve arCOG sequences
|
|
38
38
|
Marker2Tree -> Marker to Tree
|
|
39
|
+
AssessMarkerPA -> Assess Markers by P/A among groups
|
|
40
|
+
AssessMarkerDeltaLL -> Assess Markers by DeltaLL
|
|
39
41
|
|
|
40
42
|
Multiple Sequence Alignment
|
|
41
43
|
ConvertMSA -> Convert MSA format
|
|
@@ -204,6 +206,17 @@ if __name__ == '__main__':
|
|
|
204
206
|
args = vars(parser.parse_args())
|
|
205
207
|
Marker2Tree.Marker2Tree(args)
|
|
206
208
|
|
|
209
|
+
elif sys.argv[1] == 'AssessMarkerPA':
|
|
210
|
+
from TreeSAK import AssessMarkerPA
|
|
211
|
+
AssessMarkerPA_parser = subparsers.add_parser('AssessMarkerPA', usage=AssessMarkerPA.AssessMarkerPA_usage)
|
|
212
|
+
AssessMarkerPA_parser.add_argument('-a', required=True, help='trimmed alignments')
|
|
213
|
+
AssessMarkerPA_parser.add_argument('-x', required=True, help='extension of trimmed alignments')
|
|
214
|
+
AssessMarkerPA_parser.add_argument('-g', required=True, help='genome group')
|
|
215
|
+
AssessMarkerPA_parser.add_argument('-c', required=False, default='25-50-75-85-100', help='cutoffs, default: 25-50-75-85-100')
|
|
216
|
+
AssessMarkerPA_parser.add_argument('-o', required=True, help='output dir')
|
|
217
|
+
args = vars(parser.parse_args())
|
|
218
|
+
AssessMarkerPA.AssessMarkerPA(args)
|
|
219
|
+
|
|
207
220
|
else:
|
|
208
221
|
print('Unrecognized command: %s, program exited' % sys.argv[1])
|
|
209
222
|
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
|