TreeSAK 1.59.2__tar.gz → 1.60.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.
- {treesak-1.59.2/treesak.egg-info → treesak-1.60.0}/PKG-INFO +2 -2
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE.py +6 -2
- treesak-1.60.0/TreeSAK/ALE9.py +446 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/VERSION +3 -0
- {treesak-1.59.2 → treesak-1.60.0}/bin/TreeSAK +13 -0
- {treesak-1.59.2 → treesak-1.60.0/treesak.egg-info}/PKG-INFO +2 -2
- {treesak-1.59.2 → treesak-1.60.0}/treesak.egg-info/SOURCES.txt +1 -0
- {treesak-1.59.2 → treesak-1.60.0}/LICENSE +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/MANIFEST.in +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/README.md +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE1.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE2.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE2RTC.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE3.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE4.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE5.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE6.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE7.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE8.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ALE_backup.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/AssessCVG.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/AssessMarker.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/AssessMarkerDeltaLL.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/AssessMarkerPA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/BMGE.jar +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/BMGE.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/C60SR4.nex +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ClockModel.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/CompareMCMC.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ConcateMSA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ConvertMSA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/Dir.rb +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ExtractMarkerSeq.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/FastRoot.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/FastRoot_backup.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/FigTree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/GTDB_tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/GeneTree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/KEGG_Luo17.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/LcaToLeaves.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/MarkerRef2Tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/MarkerRef2Tree_backup.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/MarkerSeq2Tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/MarkerSeq2Tree_backup.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ModifyTopo.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/Newick_tree_plotter.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/OMA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/OMA2.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/OneLineAln.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PB.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PMSF.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PhyloBiAssoc.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PhyloBiAssoc.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PhyloHessian.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PlotMCMC.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PlotMcmcNode.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/PlotMcmcNode_old.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/RootTree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/RootTreeGTDB.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/RootTreeGTDB214.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/RootTreeGTDB220.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SequentialDating.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SingleAleHGT.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SingleLinePhy.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SliceMSA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SplitScore.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SplitScore1.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SplitScore1OMA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/SplitScore2.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/TaxaCountStats.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/TaxonTree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/TreeSAK_config.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/Untitled.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/VisHPD95.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/VisHPD95.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/__init__.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ale_parser.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/ale_splitter.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/alignment_pruner.pl +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/assessOG.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/assessPB.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/batch_itol.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/catfasta2phy.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/cogTree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/compare_trees.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/compare_trees.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/cophyloplot.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/cophyloplot.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/dating.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/dating_ss.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/deltall.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/do_rrtc.rb +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/fa2phy.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/filter_rename_ar53.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/format_leaf_name.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/gap_stats.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/get_SCG_tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/get_arCOG_seq.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/get_lca_id.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/global_functions.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/gnm_leaves.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/guide_tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/iTOL.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/iTOL_Tanglegram.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/iTOL_gene_tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/itol_msa_stats.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/keep_highest_rrtc.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/koTree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/label_gene_tree_by_gnm.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/label_tree.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/label_tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mad.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mcmc2tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mcmcTC copy.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mcmcTC.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mcmctree_out.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mcmctree_vs_reltime.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/mcmctree_vs_reltime.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/merge_pdf.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/pRTC.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/parse_mcmctree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/phy2fa.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/plot_distruibution_th.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/prep_mcmctree_ctl.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/print_leaves.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/pruneMSA.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/recode.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/reltime.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/remove_bias.R +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/rename_leaves.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/replace_clade.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/rm_leaf.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/root_with_out_group.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/run_TaxaCountStats_R_s1.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/subsample_drep_gnms.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/subset_tree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/subset_tree_stupid_old_way.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/supertree.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tmp_1.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tmp_2.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tmp_3.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tmp_4.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tmp_6.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tmp_7.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/tree_fmt.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/TreeSAK/weighted_rand.rb +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/setup.cfg +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/setup.py +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/treesak.egg-info/dependency_links.txt +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/treesak.egg-info/requires.txt +0 -0
- {treesak-1.59.2 → treesak-1.60.0}/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.
|
|
3
|
+
Version: 1.60.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.
|
|
27
|
+
TreeSAK v1.60.0
|
|
@@ -10,8 +10,9 @@ TreeSAK ALE4 -> Filter ALE identified HGTs
|
|
|
10
10
|
TreeSAK ALE5 -> Get RTC file based on ALE detected HGTs
|
|
11
11
|
TreeSAK SingleAleHGT -> Perform HGT analysis using ALE for single protein family
|
|
12
12
|
TreeSAK ALE6 -> faa ancestral genomes
|
|
13
|
-
TreeSAK ALE7 ->
|
|
14
|
-
TreeSAK ALE8 ->
|
|
13
|
+
TreeSAK ALE7 -> Get function P/A in ancestral genomes
|
|
14
|
+
TreeSAK ALE8 -> Gene gain and loss
|
|
15
|
+
TreeSAK ALE9 -> Annotate and plot gene gain and loss
|
|
15
16
|
|
|
16
17
|
# Example commands
|
|
17
18
|
TreeSAK ALE1 -i OrthologousGroups.txt -s combined_d__Archaea_o_rs.faa -p oma -m 50 -t 12 -jst 3 -f -o ALE1_op_dir
|
|
@@ -23,6 +24,9 @@ TreeSAK ALE4 -i1 ALE1_op_dir -i2 ALE2_op_dir -c genome_taxon.txt -color phylum_c
|
|
|
23
24
|
TreeSAK ALE7 -6 ALE6_op_dir -fun ko.txt -node internal_node.txt -o Fun_PA.txt
|
|
24
25
|
TreeSAK ALE7 -6 ALE6_op_dir -fun K01995,K01995 -node 359,466,470 -o Fun_PA.txt
|
|
25
26
|
TreeSAK ALE7 -6 ALE6_op_dir -fun arCOG07811,K01995 -node 359,466,470 -o Fun_PA.txt
|
|
27
|
+
TreeSAK ALE8 -3 ALE3_op_dir_30 -o ALE8_op_dir_30 -l genome_tree_leaf_rename.txt -f
|
|
28
|
+
TreeSAK ALE8 -3 ALE3_op_dir_75 -o ALE8_op_dir_75 -l genome_tree_leaf_rename.txt -f
|
|
29
|
+
TreeSAK ALE9 -1 ALE1_op_dir -8 ALE8_op_dir -o ALE9_op_dir -cog AOA_genomes_faa_arCOG_wd -kegg AOA_genomes_faa_KEGG_wd -cog_db /Users/songweizhi/DB/arCOG18 -f
|
|
26
30
|
TreeSAK SingleAleHGT -i OMA00001.aln -s genome.treefile -fc 0.3 -c genome_taxon.txt -color phylum_color.txt -api S1kZZuDHc0d5M7J5vLnUNQ -t 9 -f -o OMA00001_ALE_HGT_wd
|
|
27
31
|
|
|
28
32
|
Note:
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import glob
|
|
3
|
+
import argparse
|
|
4
|
+
import numpy as np
|
|
5
|
+
from Bio import SeqIO
|
|
6
|
+
import matplotlib as mpl
|
|
7
|
+
mpl.use('Agg')
|
|
8
|
+
import matplotlib.pyplot as plt
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
ALE9_usage = '''
|
|
12
|
+
=============================== ALE9 example commands ===============================
|
|
13
|
+
|
|
14
|
+
TreeSAK ALE9 -1 ALE1_op_dir -8 ALE8_op_dir -o ALE9_op_dir -cog AOA_genomes_faa_arCOG_wd -kegg AOA_genomes_faa_KEGG_wd -cog_db /Users/songweizhi/DB/arCOG18 -f
|
|
15
|
+
|
|
16
|
+
=====================================================================================
|
|
17
|
+
'''
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def sep_path_basename_ext(file_in):
|
|
21
|
+
|
|
22
|
+
f_path, f_name = os.path.split(file_in)
|
|
23
|
+
if f_path == '':
|
|
24
|
+
f_path = '.'
|
|
25
|
+
f_base, f_ext = os.path.splitext(f_name)
|
|
26
|
+
f_ext = f_ext[1:]
|
|
27
|
+
|
|
28
|
+
return f_name, f_path, f_base, f_ext
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_bar_plot_vertical(num_list_1, num_list_1_label, num_list_2, num_list_2_label, label_list, title_str, fig_width, fig_height, output_plot):
|
|
32
|
+
|
|
33
|
+
x = np.arange(len(label_list)) # the label locations
|
|
34
|
+
width = 0.3 # the width of the bars
|
|
35
|
+
|
|
36
|
+
fig, ax = plt.subplots(figsize=(fig_width, fig_height))
|
|
37
|
+
ax.bar(x - width/2, num_list_1, color='#90EE90', width=width, label=num_list_1_label)
|
|
38
|
+
ax.bar(x + width/2, num_list_2, color='#F87C63', width=width, label=num_list_2_label)
|
|
39
|
+
|
|
40
|
+
# Add some text for labels, title and custom x-axis tick labels, etc.
|
|
41
|
+
ax.set_ylabel('Gene number')
|
|
42
|
+
ax.set_title(title_str)
|
|
43
|
+
ax.set_xticks(x)
|
|
44
|
+
ax.set_xticklabels(label_list, rotation=270, ha='left', rotation_mode='anchor')
|
|
45
|
+
ax.legend()
|
|
46
|
+
fig.tight_layout()
|
|
47
|
+
plt.savefig(output_plot)
|
|
48
|
+
plt.close()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def get_bar_plot(num_list_1, num_list_1_label, num_list_2, num_list_2_label, label_list, title_str, output_plot):
|
|
52
|
+
|
|
53
|
+
num_list_1 = num_list_1[::-1]
|
|
54
|
+
num_list_2 = num_list_2[::-1]
|
|
55
|
+
label_list = label_list[::-1]
|
|
56
|
+
|
|
57
|
+
y = np.arange(len(label_list)) # The label locations
|
|
58
|
+
height = 0.3 # The height of the bars
|
|
59
|
+
fig, ax = plt.subplots(figsize=(8, (len(label_list)*0.3)))
|
|
60
|
+
|
|
61
|
+
# Plot horizontal bars
|
|
62
|
+
ax.barh(y - height / 2, num_list_1, color='#90EE90', height=height, label=num_list_1_label)
|
|
63
|
+
ax.barh(y + height / 2, num_list_2, color='#F87C63', height=height, label=num_list_2_label)
|
|
64
|
+
|
|
65
|
+
# Add text for labels and title
|
|
66
|
+
ax.set_xlabel('Gene number')
|
|
67
|
+
ax.set_title(title_str)
|
|
68
|
+
|
|
69
|
+
# Configure the Y-axis ticks on the right side
|
|
70
|
+
ax.set_yticks(y)
|
|
71
|
+
ax.set_yticklabels(label_list)
|
|
72
|
+
ax.yaxis.tick_right()
|
|
73
|
+
ax.yaxis.set_label_position("right")
|
|
74
|
+
|
|
75
|
+
# CRITICAL: Invert the X-axis to align bars to the right and put 0 on the right
|
|
76
|
+
ax.invert_xaxis()
|
|
77
|
+
|
|
78
|
+
ax.legend()
|
|
79
|
+
fig.tight_layout()
|
|
80
|
+
plt.savefig(output_plot)
|
|
81
|
+
plt.close()
|
|
82
|
+
|
|
83
|
+
def get_og_fun(faa_dir, faa_ext, cog_annotation_dir, kegg_annotation_dir, op_dir):
|
|
84
|
+
|
|
85
|
+
faa_file_re = '%s/*.%s' % (faa_dir, faa_ext)
|
|
86
|
+
faa_file_list = glob.glob(faa_file_re)
|
|
87
|
+
og_to_gene_dict = dict()
|
|
88
|
+
for each_faa_file in faa_file_list:
|
|
89
|
+
_, _, f_base, _ = sep_path_basename_ext(each_faa_file)
|
|
90
|
+
og_to_gene_dict[f_base] = set()
|
|
91
|
+
for each_seq in SeqIO.parse(each_faa_file, 'fasta'):
|
|
92
|
+
seq_id = each_seq.id
|
|
93
|
+
og_to_gene_dict[f_base].add(seq_id)
|
|
94
|
+
|
|
95
|
+
query_to_cog_txt_re = '%s/*COG_wd/*_query_to_cog.txt' % cog_annotation_dir
|
|
96
|
+
query_to_cog_txt_list = glob.glob(query_to_cog_txt_re)
|
|
97
|
+
gene_to_cog_dict = dict()
|
|
98
|
+
cog_cate_dict = dict()
|
|
99
|
+
cog_desc_dict = dict()
|
|
100
|
+
for each_cog_file in query_to_cog_txt_list:
|
|
101
|
+
for each_line in open(each_cog_file):
|
|
102
|
+
if not each_line.startswith('Query\t'):
|
|
103
|
+
each_line_split = each_line.strip().split('\t')
|
|
104
|
+
if len(each_line_split) == 4:
|
|
105
|
+
gene_id = each_line_split[0]
|
|
106
|
+
cog_id = each_line_split[1]
|
|
107
|
+
cog_cate = each_line_split[2]
|
|
108
|
+
cog_desc = each_line_split[3]
|
|
109
|
+
gene_to_cog_dict[gene_id] = cog_id
|
|
110
|
+
cog_cate_dict[cog_id] = cog_cate
|
|
111
|
+
cog_desc_dict[cog_id] = cog_desc
|
|
112
|
+
|
|
113
|
+
ko_assignment_abcd_txt_re = '%s/*KEGG_wd/*_ko_assignment_ABCD.txt' % kegg_annotation_dir
|
|
114
|
+
ko_assignment_abcd_txt_list = glob.glob(ko_assignment_abcd_txt_re)
|
|
115
|
+
gene_to_kegg_dict = dict()
|
|
116
|
+
ko_desc_dict = dict()
|
|
117
|
+
ko_d_to_b_dict = dict()
|
|
118
|
+
ko_d_to_c_dict = dict()
|
|
119
|
+
for each_kegg_file in ko_assignment_abcd_txt_list:
|
|
120
|
+
for each_line in open(each_kegg_file):
|
|
121
|
+
if not each_line.startswith('Gene_id\t'):
|
|
122
|
+
each_line_split = each_line.strip().split('\t')
|
|
123
|
+
if len(each_line_split) == 9:
|
|
124
|
+
gene_id = each_line_split[0]
|
|
125
|
+
ko_id_b = each_line_split[2][2:]
|
|
126
|
+
ko_id_c = each_line_split[3][2:]
|
|
127
|
+
ko_id_d = each_line_split[4][2:]
|
|
128
|
+
ko_desc_b = each_line_split[6]
|
|
129
|
+
ko_desc_c = each_line_split[7]
|
|
130
|
+
ko_desc_d = each_line_split[8]
|
|
131
|
+
gene_to_kegg_dict[gene_id] = ko_id_d
|
|
132
|
+
ko_desc_dict[ko_id_b] = ko_desc_b
|
|
133
|
+
ko_desc_dict[ko_id_c] = ko_desc_c
|
|
134
|
+
ko_desc_dict[ko_id_d] = ko_desc_d
|
|
135
|
+
ko_d_to_b_dict[ko_id_d] = ko_id_b
|
|
136
|
+
ko_d_to_c_dict[ko_id_d] = ko_id_c
|
|
137
|
+
|
|
138
|
+
og_to_cog_dict = dict()
|
|
139
|
+
og_to_kegg_dict = dict()
|
|
140
|
+
for each_og in og_to_gene_dict:
|
|
141
|
+
gene_member = og_to_gene_dict[each_og]
|
|
142
|
+
matched_cog_set = set()
|
|
143
|
+
matched_kegg_set_d = set()
|
|
144
|
+
for each_gene in gene_member:
|
|
145
|
+
assigned_cog = gene_to_cog_dict.get(each_gene, None)
|
|
146
|
+
assigned_kegg = gene_to_kegg_dict.get(each_gene, None)
|
|
147
|
+
if assigned_cog is not None:
|
|
148
|
+
matched_cog_set.add(assigned_cog)
|
|
149
|
+
if assigned_kegg is not None:
|
|
150
|
+
matched_kegg_set_d.add(assigned_kegg)
|
|
151
|
+
if len(matched_cog_set) > 0:
|
|
152
|
+
og_to_cog_dict[each_og] = matched_cog_set
|
|
153
|
+
if len(matched_kegg_set_d) > 0:
|
|
154
|
+
og_to_kegg_dict[each_og] = matched_kegg_set_d
|
|
155
|
+
|
|
156
|
+
# filter og_to_cog_dict
|
|
157
|
+
og_to_cog_dict_filtered = dict()
|
|
158
|
+
for each_og in og_to_cog_dict:
|
|
159
|
+
matched_cog_set = og_to_cog_dict[each_og]
|
|
160
|
+
if len(matched_cog_set) == 1:
|
|
161
|
+
matched_cog = list(matched_cog_set)[0]
|
|
162
|
+
matched_cog_desc = cog_desc_dict[matched_cog]
|
|
163
|
+
if matched_cog_desc not in ['Uncharacterized protein']:
|
|
164
|
+
og_to_cog_dict_filtered[each_og] = matched_cog_set
|
|
165
|
+
else:
|
|
166
|
+
current_desc_to_cog_dict = dict()
|
|
167
|
+
for each_matched_cog in matched_cog_set:
|
|
168
|
+
each_matched_cog_desc = cog_desc_dict[each_matched_cog]
|
|
169
|
+
if each_matched_cog_desc not in ['Uncharacterized protein']:
|
|
170
|
+
if each_matched_cog_desc not in current_desc_to_cog_dict:
|
|
171
|
+
current_desc_to_cog_dict[each_matched_cog_desc] = set()
|
|
172
|
+
current_desc_to_cog_dict[each_matched_cog_desc].add(each_matched_cog)
|
|
173
|
+
|
|
174
|
+
matched_cog_set_filtered = set()
|
|
175
|
+
for each_desc in current_desc_to_cog_dict:
|
|
176
|
+
same_desc_cog_list = sorted(list(current_desc_to_cog_dict[each_desc]))
|
|
177
|
+
matched_cog_set_filtered.add(same_desc_cog_list[0])
|
|
178
|
+
|
|
179
|
+
if len(matched_cog_set_filtered) > 0:
|
|
180
|
+
og_to_cog_dict_filtered[each_og] = matched_cog_set_filtered
|
|
181
|
+
|
|
182
|
+
# filter og_to_kegg_dict
|
|
183
|
+
og_to_kegg_dict_filtered_b = dict()
|
|
184
|
+
og_to_kegg_dict_filtered_c = dict()
|
|
185
|
+
og_to_kegg_dict_filtered_d = dict()
|
|
186
|
+
for each_og in og_to_kegg_dict:
|
|
187
|
+
matched_kegg_set_d = og_to_kegg_dict[each_og]
|
|
188
|
+
matched_kegg_set_b_filtered = set()
|
|
189
|
+
matched_kegg_set_c_filtered = set()
|
|
190
|
+
matched_kegg_set_d_filtered = set()
|
|
191
|
+
for each_matched_ko_d in matched_kegg_set_d:
|
|
192
|
+
each_matched_ko_b = ko_d_to_b_dict[each_matched_ko_d]
|
|
193
|
+
each_matched_ko_c = ko_d_to_c_dict[each_matched_ko_d]
|
|
194
|
+
each_matched_ko_d_desc = ko_desc_dict[each_matched_ko_d]
|
|
195
|
+
if 'uncharacterized protein' not in each_matched_ko_d_desc:
|
|
196
|
+
matched_kegg_set_b_filtered.add(each_matched_ko_b)
|
|
197
|
+
matched_kegg_set_c_filtered.add(each_matched_ko_c)
|
|
198
|
+
matched_kegg_set_d_filtered.add(each_matched_ko_d)
|
|
199
|
+
if len(matched_kegg_set_d_filtered) > 0:
|
|
200
|
+
og_to_kegg_dict_filtered_b[each_og] = matched_kegg_set_b_filtered
|
|
201
|
+
og_to_kegg_dict_filtered_c[each_og] = matched_kegg_set_c_filtered
|
|
202
|
+
og_to_kegg_dict_filtered_d[each_og] = matched_kegg_set_d_filtered
|
|
203
|
+
|
|
204
|
+
op_txt_cog = '%s/OG_COG.txt' % op_dir
|
|
205
|
+
op_txt_ko_b = '%s/OG_ko_B.txt' % op_dir
|
|
206
|
+
op_txt_ko_c = '%s/OG_ko_C.txt' % op_dir
|
|
207
|
+
op_txt_ko_d = '%s/OG_ko_D.txt' % op_dir
|
|
208
|
+
|
|
209
|
+
op_txt_cog_handle = open(op_txt_cog, 'w')
|
|
210
|
+
for i in sorted(list(og_to_cog_dict_filtered.keys())):
|
|
211
|
+
matched_cog_set = og_to_cog_dict_filtered[i]
|
|
212
|
+
for each_matched_cog in matched_cog_set:
|
|
213
|
+
cog_desc = cog_desc_dict[each_matched_cog]
|
|
214
|
+
op_txt_cog_handle.write('%s\t%s\t%s\n' % (i, each_matched_cog, cog_desc))
|
|
215
|
+
op_txt_cog_handle.close()
|
|
216
|
+
|
|
217
|
+
op_txt_ko_d_handle = open(op_txt_ko_d, 'w')
|
|
218
|
+
for i in sorted(list(og_to_kegg_dict_filtered_d.keys())):
|
|
219
|
+
matched_ko_d_set = og_to_kegg_dict_filtered_d[i]
|
|
220
|
+
for each_ko_d in matched_ko_d_set:
|
|
221
|
+
ko_d_desc = ko_desc_dict[each_ko_d]
|
|
222
|
+
op_txt_ko_d_handle.write('%s\t%s\t%s\n' % (i, each_ko_d, ko_d_desc))
|
|
223
|
+
op_txt_ko_d_handle.close()
|
|
224
|
+
|
|
225
|
+
op_txt_ko_c_handle = open(op_txt_ko_c, 'w')
|
|
226
|
+
for i in sorted(list(og_to_kegg_dict_filtered_c.keys())):
|
|
227
|
+
matched_ko_c_set = og_to_kegg_dict_filtered_c[i]
|
|
228
|
+
for each_ko_c in matched_ko_c_set:
|
|
229
|
+
ko_c_desc = ko_desc_dict[each_ko_c]
|
|
230
|
+
op_txt_ko_c_handle.write('%s\t%s\t%s\n' % (i, each_ko_c, ko_c_desc))
|
|
231
|
+
op_txt_ko_c_handle.close()
|
|
232
|
+
|
|
233
|
+
op_txt_ko_b_handle = open(op_txt_ko_b, 'w')
|
|
234
|
+
for i in sorted(list(og_to_kegg_dict_filtered_b.keys())):
|
|
235
|
+
matched_ko_b_set = og_to_kegg_dict_filtered_b[i]
|
|
236
|
+
for each_ko_b in matched_ko_b_set:
|
|
237
|
+
ko_b_desc = ko_desc_dict[each_ko_b]
|
|
238
|
+
op_txt_ko_b_handle.write('%s\t%s\t%s\n' % (i, each_ko_b, ko_b_desc))
|
|
239
|
+
op_txt_ko_b_handle.close()
|
|
240
|
+
|
|
241
|
+
return og_to_cog_dict_filtered, cog_cate_dict, cog_desc_dict, og_to_kegg_dict_filtered_b, og_to_kegg_dict_filtered_c, og_to_kegg_dict_filtered_d, ko_desc_dict
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def plot_gain_loss_plot_cog(og_set_gain, og_set_loss, og_cog_dict, cog_cate_dict, cog_cate_desc_dict, title_text, op_plot_cog):
|
|
245
|
+
|
|
246
|
+
cog_cate_list = ['C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X']
|
|
247
|
+
|
|
248
|
+
og_gain_cog_cate_stats_dict = dict()
|
|
249
|
+
for each_gain in og_set_gain:
|
|
250
|
+
gain_cog_set = og_cog_dict.get(each_gain, set())
|
|
251
|
+
for each_gain_cog in gain_cog_set:
|
|
252
|
+
each_gain_cate_str = cog_cate_dict[each_gain_cog]
|
|
253
|
+
for each_gain_cate in list(each_gain_cate_str):
|
|
254
|
+
if each_gain_cate not in og_gain_cog_cate_stats_dict:
|
|
255
|
+
og_gain_cog_cate_stats_dict[each_gain_cate] = 0
|
|
256
|
+
og_gain_cog_cate_stats_dict[each_gain_cate] += 1
|
|
257
|
+
|
|
258
|
+
og_loss_cog_cate_stats_dict = dict()
|
|
259
|
+
for each_loss in og_set_loss:
|
|
260
|
+
loss_cog_set = og_cog_dict.get(each_loss, set())
|
|
261
|
+
for each_loss_cog in loss_cog_set:
|
|
262
|
+
each_loss_cate_str = cog_cate_dict[each_loss_cog]
|
|
263
|
+
for each_loss_cate in list(each_loss_cate_str):
|
|
264
|
+
if each_loss_cate not in og_loss_cog_cate_stats_dict:
|
|
265
|
+
og_loss_cog_cate_stats_dict[each_loss_cate] = 0
|
|
266
|
+
og_loss_cog_cate_stats_dict[each_loss_cate] += 1
|
|
267
|
+
|
|
268
|
+
label_list = []
|
|
269
|
+
num_list_gain = []
|
|
270
|
+
num_list_loss = []
|
|
271
|
+
for l in cog_cate_list:
|
|
272
|
+
num_list_gain.append(og_gain_cog_cate_stats_dict.get(l, 0))
|
|
273
|
+
num_list_loss.append(og_loss_cog_cate_stats_dict.get(l, 0))
|
|
274
|
+
long_label = '%s - %s' % (l, cog_cate_desc_dict[l])
|
|
275
|
+
long_label = long_label[:50]
|
|
276
|
+
label_list.append(long_label)
|
|
277
|
+
|
|
278
|
+
get_bar_plot(num_list_gain, 'Gain', num_list_loss, 'Loss', label_list, title_text, op_plot_cog)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def plot_gain_loss_plot_kegg(og_set_gain, og_set_loss, og_ko_b_dict, og_ko_c_dict, og_ko_d_dict, ko_desc_dict, gnm_id, op_plot_ko_b, op_plot_ko_c):
|
|
282
|
+
|
|
283
|
+
ko_b_set_all = set()
|
|
284
|
+
ko_c_set_all = set()
|
|
285
|
+
og_gain_stats_dict_b = dict()
|
|
286
|
+
og_gain_stats_dict_c = dict()
|
|
287
|
+
for each_gain in og_set_gain:
|
|
288
|
+
gain_ko_b_set = og_ko_b_dict.get(each_gain, set())
|
|
289
|
+
gain_ko_c_set = og_ko_c_dict.get(each_gain, set())
|
|
290
|
+
for each_ko_b in gain_ko_b_set:
|
|
291
|
+
ko_b_set_all.add(each_ko_b)
|
|
292
|
+
if each_ko_b not in og_gain_stats_dict_b:
|
|
293
|
+
og_gain_stats_dict_b[each_ko_b] = 0
|
|
294
|
+
og_gain_stats_dict_b[each_ko_b] += 1
|
|
295
|
+
for each_ko_c in gain_ko_c_set:
|
|
296
|
+
ko_c_set_all.add(each_ko_c)
|
|
297
|
+
if each_ko_c not in og_gain_stats_dict_c:
|
|
298
|
+
og_gain_stats_dict_c[each_ko_c] = 0
|
|
299
|
+
og_gain_stats_dict_c[each_ko_c] += 1
|
|
300
|
+
|
|
301
|
+
og_loss_stats_dict_b = dict()
|
|
302
|
+
og_loss_stats_dict_c = dict()
|
|
303
|
+
for each_loss in og_set_loss:
|
|
304
|
+
loss_ko_b_set = og_ko_b_dict.get(each_loss, set())
|
|
305
|
+
loss_ko_c_set = og_ko_c_dict.get(each_loss, set())
|
|
306
|
+
for each_ko_b in loss_ko_b_set:
|
|
307
|
+
ko_b_set_all.add(each_ko_b)
|
|
308
|
+
if each_ko_b not in og_loss_stats_dict_b:
|
|
309
|
+
og_loss_stats_dict_b[each_ko_b] = 0
|
|
310
|
+
og_loss_stats_dict_b[each_ko_b] += 1
|
|
311
|
+
for each_ko_c in loss_ko_c_set:
|
|
312
|
+
ko_c_set_all.add(each_ko_c)
|
|
313
|
+
if each_ko_c not in og_loss_stats_dict_c:
|
|
314
|
+
og_loss_stats_dict_c[each_ko_c] = 0
|
|
315
|
+
og_loss_stats_dict_c[each_ko_c] += 1
|
|
316
|
+
|
|
317
|
+
ko_b_list_all_sorted = sorted(list(ko_b_set_all))
|
|
318
|
+
ko_c_list_all_sorted = sorted(list(ko_c_set_all))
|
|
319
|
+
|
|
320
|
+
ko_b_label_list = []
|
|
321
|
+
ko_b_num_list_gain = []
|
|
322
|
+
ko_b_num_list_loss = []
|
|
323
|
+
for b in ko_b_list_all_sorted:
|
|
324
|
+
ko_b_num_list_gain.append(og_gain_stats_dict_b.get(b, 0))
|
|
325
|
+
ko_b_num_list_loss.append(og_loss_stats_dict_b.get(b, 0))
|
|
326
|
+
long_label = '%s - %s' % (b, ko_desc_dict[b])
|
|
327
|
+
long_label = long_label[:50]
|
|
328
|
+
ko_b_label_list.append(long_label)
|
|
329
|
+
get_bar_plot(ko_b_num_list_gain, 'Gain', ko_b_num_list_loss, 'Loss', ko_b_label_list, gnm_id, op_plot_ko_b)
|
|
330
|
+
|
|
331
|
+
ko_c_label_list = []
|
|
332
|
+
ko_c_num_list_gain = []
|
|
333
|
+
ko_c_num_list_loss = []
|
|
334
|
+
for c in ko_c_list_all_sorted:
|
|
335
|
+
ko_c_num_list_gain.append(og_gain_stats_dict_c.get(c, 0))
|
|
336
|
+
ko_c_num_list_loss.append(og_loss_stats_dict_c.get(c, 0))
|
|
337
|
+
long_label = '%s - %s' % (c, ko_desc_dict[c])
|
|
338
|
+
long_label = long_label[:50]
|
|
339
|
+
ko_c_label_list.append(long_label)
|
|
340
|
+
get_bar_plot(ko_c_num_list_gain, 'Gain', ko_c_num_list_loss, 'Loss', ko_c_label_list, gnm_id, op_plot_ko_c)
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
def ALE9(args):
|
|
344
|
+
|
|
345
|
+
ale1_op_dir = args['1']
|
|
346
|
+
ale8_op_dir = args['8']
|
|
347
|
+
force_create_op_dir = args['f']
|
|
348
|
+
op_dir = args['o']
|
|
349
|
+
cog_annotation_dir = args['cog']
|
|
350
|
+
kegg_annotation_dir = args['kegg']
|
|
351
|
+
cog_db_dir = args['cog_db']
|
|
352
|
+
|
|
353
|
+
gene_gain_loss_txt_dir = '%s/Gene_gain_loss' % ale8_op_dir
|
|
354
|
+
fun_20_tab = '%s/fun-20.tab' % cog_db_dir
|
|
355
|
+
|
|
356
|
+
# create op_dir
|
|
357
|
+
if os.path.isdir(op_dir) is True:
|
|
358
|
+
if force_create_op_dir is True:
|
|
359
|
+
os.system('rm -r %s' % op_dir)
|
|
360
|
+
else:
|
|
361
|
+
print('Output folder detected, program exited!')
|
|
362
|
+
exit()
|
|
363
|
+
os.system('mkdir %s' % op_dir)
|
|
364
|
+
|
|
365
|
+
cog_cate_desc_dict = dict()
|
|
366
|
+
for each_line in open(fun_20_tab):
|
|
367
|
+
each_line_split = each_line.strip().split('\t')
|
|
368
|
+
cog_cate_desc_dict[each_line_split[0]] = each_line_split[2]
|
|
369
|
+
|
|
370
|
+
og_cog_dict, cog_cate_dict, cog_desc_dict, og_ko_b_dict, og_ko_c_dict, og_ko_d_dict, ko_desc_dict = get_og_fun(ale1_op_dir, 'faa', cog_annotation_dir, kegg_annotation_dir, op_dir)
|
|
371
|
+
|
|
372
|
+
gene_gain_txt_re = '%s/*_gene_gain.txt' % gene_gain_loss_txt_dir
|
|
373
|
+
gene_gain_txt_list = glob.glob(gene_gain_txt_re)
|
|
374
|
+
|
|
375
|
+
for gene_gain_txt in gene_gain_txt_list:
|
|
376
|
+
_, _, f_base, _ = sep_path_basename_ext(gene_gain_txt)
|
|
377
|
+
gnm_id = f_base.split('_gene_gain')[0]
|
|
378
|
+
gene_loss_txt = gene_gain_txt.replace('_gene_gain.txt', '_gene_loss.txt')
|
|
379
|
+
op_plot_cog = '%s/%s_COG.pdf' % (op_dir, gnm_id)
|
|
380
|
+
op_plot_ko_b = '%s/%s_KEGG_B.pdf' % (op_dir, gnm_id)
|
|
381
|
+
op_plot_ko_c = '%s/%s_KEGG_C.pdf' % (op_dir, gnm_id)
|
|
382
|
+
|
|
383
|
+
og_set_gain = set()
|
|
384
|
+
for each_line in open(gene_gain_txt):
|
|
385
|
+
og_set_gain.add(each_line.strip())
|
|
386
|
+
|
|
387
|
+
og_set_loss = set()
|
|
388
|
+
for each_line in open(gene_loss_txt):
|
|
389
|
+
og_set_loss.add(each_line.strip())
|
|
390
|
+
|
|
391
|
+
plot_gain_loss_plot_cog(og_set_gain, og_set_loss, og_cog_dict, cog_cate_dict, cog_cate_desc_dict, gnm_id, op_plot_cog)
|
|
392
|
+
plot_gain_loss_plot_kegg(og_set_gain, og_set_loss, og_ko_b_dict, og_ko_c_dict, og_ko_d_dict, ko_desc_dict, gnm_id, op_plot_ko_b, op_plot_ko_c)
|
|
393
|
+
|
|
394
|
+
_, _, gain_txt_base, _ = sep_path_basename_ext(gene_gain_txt)
|
|
395
|
+
_, _, loss_txt_base, _ = sep_path_basename_ext(gene_loss_txt)
|
|
396
|
+
|
|
397
|
+
op_gene_gain_txt_cog = '%s/%s_COG.txt' % (op_dir, gain_txt_base)
|
|
398
|
+
op_gene_loss_txt_cog = '%s/%s_COG.txt' % (op_dir, loss_txt_base)
|
|
399
|
+
op_gene_gain_txt_kegg = '%s/%s_KEGG.txt' % (op_dir, gain_txt_base)
|
|
400
|
+
op_gene_loss_txt_kegg = '%s/%s_KEGG.txt' % (op_dir, loss_txt_base)
|
|
401
|
+
|
|
402
|
+
op_gene_gain_txt_cog_handle = open(op_gene_gain_txt_cog, 'w')
|
|
403
|
+
op_gene_gain_txt_kegg_handle = open(op_gene_gain_txt_kegg, 'w')
|
|
404
|
+
for each_gain in sorted(list(og_set_gain)):
|
|
405
|
+
# write out cog
|
|
406
|
+
gain_cog_set = og_cog_dict.get(each_gain, set())
|
|
407
|
+
for gain_cog in gain_cog_set:
|
|
408
|
+
gain_cog_desc = cog_desc_dict.get(gain_cog, '')
|
|
409
|
+
op_gene_gain_txt_cog_handle.write('%s\t%s\t%s\n' % (each_gain, gain_cog, gain_cog_desc))
|
|
410
|
+
# write out kegg
|
|
411
|
+
gain_ko_d_set = og_ko_d_dict.get(each_gain, set())
|
|
412
|
+
for gain_ko_d in gain_ko_d_set:
|
|
413
|
+
gain_ko_d_desc = ko_desc_dict.get(gain_ko_d, '')
|
|
414
|
+
op_gene_gain_txt_kegg_handle.write('%s\t%s\t%s\n' % (each_gain, gain_ko_d, gain_ko_d_desc))
|
|
415
|
+
op_gene_gain_txt_cog_handle.close()
|
|
416
|
+
op_gene_gain_txt_kegg_handle.close()
|
|
417
|
+
|
|
418
|
+
op_gene_loss_txt_cog_handle = open(op_gene_loss_txt_cog, 'w')
|
|
419
|
+
op_gene_loss_txt_kegg_handle = open(op_gene_loss_txt_kegg, 'w')
|
|
420
|
+
for each_loss in sorted(list(og_set_loss)):
|
|
421
|
+
# write out cog
|
|
422
|
+
loss_cog_set = og_cog_dict.get(each_loss, set())
|
|
423
|
+
for loss_cog in loss_cog_set:
|
|
424
|
+
loss_cog_desc = cog_desc_dict.get(loss_cog, '')
|
|
425
|
+
op_gene_loss_txt_cog_handle.write('%s\t%s\t%s\n' % (each_loss, loss_cog, loss_cog_desc))
|
|
426
|
+
# write out kegg
|
|
427
|
+
loss_ko_d_set = og_ko_d_dict.get(each_loss, set())
|
|
428
|
+
for loss_ko_d in loss_ko_d_set:
|
|
429
|
+
loss_ko_d_desc = ko_desc_dict.get(loss_ko_d, '')
|
|
430
|
+
op_gene_loss_txt_kegg_handle.write('%s\t%s\t%s\n' % (each_loss, loss_ko_d, loss_ko_d_desc))
|
|
431
|
+
op_gene_loss_txt_cog_handle.close()
|
|
432
|
+
op_gene_loss_txt_kegg_handle.close()
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
if __name__ == '__main__':
|
|
436
|
+
|
|
437
|
+
ALE9_parser = argparse.ArgumentParser()
|
|
438
|
+
ALE9_parser.add_argument('-1', required=True, help='ALE1 output directory')
|
|
439
|
+
ALE9_parser.add_argument('-8', required=True, help='ALE8 output directory')
|
|
440
|
+
ALE9_parser.add_argument('-cog', required=False, default=None, help='COG annotation dir')
|
|
441
|
+
ALE9_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation dir')
|
|
442
|
+
ALE9_parser.add_argument('-cog_db', required=False, default=None, help='COG database dir')
|
|
443
|
+
ALE9_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
444
|
+
ALE9_parser.add_argument('-o', required=True, help='output directory')
|
|
445
|
+
args = vars(ALE9_parser.parse_args())
|
|
446
|
+
ALE9(args)
|
|
@@ -622,6 +622,19 @@ if __name__ == '__main__':
|
|
|
622
622
|
args = vars(parser.parse_args())
|
|
623
623
|
ALE8.ALE8(args)
|
|
624
624
|
|
|
625
|
+
elif sys.argv[1] == 'ALE9':
|
|
626
|
+
from TreeSAK import ALE9
|
|
627
|
+
ALE9_parser = subparsers.add_parser('ALE9', usage=ALE9.ALE9_usage)
|
|
628
|
+
ALE9_parser.add_argument('-1', required=True, help='ALE1 output directory')
|
|
629
|
+
ALE9_parser.add_argument('-8', required=True, help='ALE8 output directory')
|
|
630
|
+
ALE9_parser.add_argument('-cog', required=False, default=None, help='COG annotation dir')
|
|
631
|
+
ALE9_parser.add_argument('-kegg', required=False, default=None, help='KEGG annotation dir')
|
|
632
|
+
ALE9_parser.add_argument('-cog_db', required=False, default=None, help='COG database dir')
|
|
633
|
+
ALE9_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
634
|
+
ALE9_parser.add_argument('-o', required=True, help='output directory')
|
|
635
|
+
args = vars(parser.parse_args())
|
|
636
|
+
ALE9.ALE9(args)
|
|
637
|
+
|
|
625
638
|
elif sys.argv[1] == 'RootTree':
|
|
626
639
|
from TreeSAK import RootTree
|
|
627
640
|
RootTree_parser = subparsers.add_parser('RootTree', usage=RootTree.RootTree_usage)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: treesak
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.60.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.
|
|
27
|
+
TreeSAK v1.60.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|