BioSAK 1.95.2__tar.gz → 1.96.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.
- BioSAK-1.96.0/BioSAK/Combine_KEGG_arCOG.py +191 -0
- BioSAK-1.96.0/BioSAK/DendroDF.py +25 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/VERSION +4 -1
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/enrich.py +7 -8
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK.egg-info/PKG-INFO +2 -2
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK.egg-info/SOURCES.txt +2 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/PKG-INFO +2 -2
- {BioSAK-1.95.2 → BioSAK-1.96.0}/bin/BioSAK +11 -2
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/BLCA_op_parser.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/BioSAK_config.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/COG2020.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/COG_boxplot_last1row.R +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/COG_boxplot_last2row.R +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/CheckM.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/DnaFeaturesViewer.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/FastaSplitler_by_num.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/FastaSplitler_by_size.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/GTDB_for_BLCA.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/Gene2Ctg.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/KEGG.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/KEGG_boxplot_last1row.R +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/KEGG_get_eukaryotic_kos.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/KeepRemovingTmp.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/MeanMappingDepth.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/MetaBiosample.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/MetaCHIP_phylo.hmm +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/MetaCyc_reactions_with_ec.txt +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/NetEnzymes.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/Prodigal.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/Reads_simulator.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/RunGraphMB.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/SILVA_for_BLCA.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/SankeyTaxon.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/SubsampleLongReads.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/Tax4Fun2IndOTU.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/VisBlastOp.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/VisGeneFlk.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/__init__.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/add_desc.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/arCOG.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/bam2reads.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/boxplot.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/boxplot_last1row.R +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/boxplot_matrix_COG.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/boxplot_matrix_COG_backup.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/boxplot_matrix_KEGG.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/boxplot_matrix_dbCAN.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/cat_fa.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/cdd2cog.pl +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/checkm_marker.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/compare_sets.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/count_num.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/cross_link_seqs.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/dbCAN.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/download_GenBank_genome_subset_prokaryotes_csv.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/dwnld_sra_reads.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/exe_cmds.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/ezaai2mat.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/fa2id.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/fastaai.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/format_converter.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/fq2fa.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gapseq.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gbk2faa.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gbk2ffn.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gbk2fna.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gbk2gff.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gbk_to_ffn_faa.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gc.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_EC_from_ko_stats_D.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_GTDB_taxon_gnm.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_MAG_reads_long.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_Pfam_hmms.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_TopHits_taxonomy.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_aa_composition.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_bin_abundance copy.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_data_matrix.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_gene_depth.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_genome_GTDB.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_genome_NCBI.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_genome_NCBI_v1.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_genome_NCBI_v2.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_gnm_size.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_ko_gene_seqs.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_krona_plot.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_reads_from_sam.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_reads_id_in_sam.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_top_hit.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/get_total_length.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/gff2chrom.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/global_functions.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/hpc3.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/js_cmds.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/js_hpc3.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/keep_best_hit.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/ko00001.keg +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/koala.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/link_16S_MAG.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/magabund.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/magabund2.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/manipulator_fasta.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/manipulator_msa.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/manipulator_newick.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/manipulator_sam.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/mann_whitney_u.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/mean_MAG_cov.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/merge_df.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/merge_seq.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/metaAssembly.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/metabat2concoct.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/metabat2maxbin.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/msa_to_distance_matrix.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/ncbi_dataset.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/odp.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/parse_MetaCyc_RxnDB.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/parse_mmseqs_tsv.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/plot_mag.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/plot_sam_depth.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/plot_tree.R +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/prefix_file.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/prefix_seq_by_file_name.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/prokka.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/reads2bam.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/rename_reads_for_Reago.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/rename_seq.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/ribbon.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/sam2bam.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/sampling_GTDB_gnms.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/sankey.R +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/sankey.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/select_seq.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/sep_reads_by_barcode.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/slice_seq.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/split_fasta.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/split_folder.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/split_sam.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/srun.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/statsTaxa.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/stats_arcog.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/stats_ko.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/submitHPC.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/subset_GTDB_meta.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/subset_df.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/subset_tree.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/tmp_1.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/tmp_2.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/tmp_3.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/top_16S_hits.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/top_hits_in_a_group.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/transpose.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/usearch_uc.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK/wilcox.py +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK.egg-info/dependency_links.txt +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK.egg-info/requires.txt +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/BioSAK.egg-info/top_level.txt +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/LICENSE +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/MANIFEST.in +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/README.md +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/setup.cfg +0 -0
- {BioSAK-1.95.2 → BioSAK-1.96.0}/setup.py +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import glob
|
|
3
|
+
import argparse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Combine_KEGG_arCOG_usage = '''
|
|
7
|
+
================ Combine_KEGG_arCOG example commands ================
|
|
8
|
+
|
|
9
|
+
BioSAK Combine_KEGG_arCOG -kegg KEGG_wd -arcog arCOG_wd -o op_dir -f
|
|
10
|
+
|
|
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
|
+
|
|
22
|
+
return f_name, f_path, f_base, f_ext[1:]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def Combine_KEGG_arCOG(args):
|
|
26
|
+
|
|
27
|
+
output_folder = args['o']
|
|
28
|
+
kegg_annotation_wd = args['kegg']
|
|
29
|
+
arcog_annotation_wd = args['arcog']
|
|
30
|
+
force_create_op_dir = args['f']
|
|
31
|
+
|
|
32
|
+
############################################## define output file name #############################################
|
|
33
|
+
|
|
34
|
+
fun_assignment_dir = '%s/fun_assignment' % output_folder
|
|
35
|
+
stats_dir_num = '%s/fun_stats_num' % output_folder
|
|
36
|
+
stats_dir_pct = '%s/fun_stats_pct' % output_folder
|
|
37
|
+
|
|
38
|
+
# create output folder
|
|
39
|
+
if os.path.isdir(output_folder) is True:
|
|
40
|
+
if force_create_op_dir is True:
|
|
41
|
+
os.system('rm -r %s' % output_folder)
|
|
42
|
+
else:
|
|
43
|
+
print('Output folder detected, program exited!')
|
|
44
|
+
exit()
|
|
45
|
+
os.system('mkdir %s' % output_folder)
|
|
46
|
+
os.system('mkdir %s' % fun_assignment_dir)
|
|
47
|
+
os.system('mkdir %s' % stats_dir_num)
|
|
48
|
+
os.system('mkdir %s' % stats_dir_pct)
|
|
49
|
+
|
|
50
|
+
################################################### get file list ##################################################
|
|
51
|
+
|
|
52
|
+
arcog_assignment_re = '%s/*_arCOG_wd/*_query_to_cog.txt' % arcog_annotation_wd
|
|
53
|
+
ko_assignment_re = '%s/*_KEGG_wd/*_ko_assignment_ABCD.txt' % kegg_annotation_wd
|
|
54
|
+
|
|
55
|
+
arcog_assignment_file_list = glob.glob(arcog_assignment_re)
|
|
56
|
+
ko_assignment_file_list = glob.glob(ko_assignment_re)
|
|
57
|
+
|
|
58
|
+
######################################### read in kegg annotation results ##########################################
|
|
59
|
+
|
|
60
|
+
fun_id_to_description_dict = dict()
|
|
61
|
+
|
|
62
|
+
gnm_to_gene_dict = dict()
|
|
63
|
+
ko_assignment_dod = dict()
|
|
64
|
+
for each_file in ko_assignment_file_list:
|
|
65
|
+
f_name, f_path, f_base, f_ext = sep_path_basename_ext(each_file)
|
|
66
|
+
gnm_id = f_base[:-len('_ko_assignment_ABCD')]
|
|
67
|
+
|
|
68
|
+
if gnm_id not in gnm_to_gene_dict:
|
|
69
|
+
gnm_to_gene_dict[gnm_id] = set()
|
|
70
|
+
|
|
71
|
+
current_genome_ko_assignment_dict = dict()
|
|
72
|
+
for each_line in open(each_file):
|
|
73
|
+
if not each_line.startswith('Gene_id\t'):
|
|
74
|
+
each_line_split = each_line.strip().split('\t')
|
|
75
|
+
gene_id = each_line_split[0]
|
|
76
|
+
gnm_to_gene_dict[gnm_id].add(gene_id)
|
|
77
|
+
if len(each_line_split) > 1:
|
|
78
|
+
ko_id = each_line_split[4][2:]
|
|
79
|
+
ko_desc = each_line_split[8].strip()
|
|
80
|
+
fun_id_to_description_dict[ko_id] = ko_desc
|
|
81
|
+
current_genome_ko_assignment_dict[gene_id] = ko_id
|
|
82
|
+
ko_assignment_dod[gnm_id] = current_genome_ko_assignment_dict
|
|
83
|
+
|
|
84
|
+
######################################### read in arcog annotation results #########################################
|
|
85
|
+
|
|
86
|
+
arcog_assignment_dod = dict()
|
|
87
|
+
for each_file in arcog_assignment_file_list:
|
|
88
|
+
|
|
89
|
+
f_name, f_path, f_base, f_ext = sep_path_basename_ext(each_file)
|
|
90
|
+
gnm_id = f_base[:-len('_query_to_cog')]
|
|
91
|
+
|
|
92
|
+
if gnm_id not in gnm_to_gene_dict:
|
|
93
|
+
gnm_to_gene_dict[gnm_id] = set()
|
|
94
|
+
|
|
95
|
+
current_genome_arcog_assignment_dict = dict()
|
|
96
|
+
for each_line in open(each_file):
|
|
97
|
+
if not each_line.startswith('Query\tarCOG'):
|
|
98
|
+
each_line_split = each_line.strip().split('\t')
|
|
99
|
+
gene_id = each_line_split[0]
|
|
100
|
+
gnm_to_gene_dict[gnm_id].add(gene_id)
|
|
101
|
+
if len(each_line_split) > 1:
|
|
102
|
+
arcog_id = each_line_split[1]
|
|
103
|
+
arcog_desc = each_line_split[3]
|
|
104
|
+
fun_id_to_description_dict[arcog_id] = arcog_desc
|
|
105
|
+
current_genome_arcog_assignment_dict[gene_id] = arcog_id
|
|
106
|
+
arcog_assignment_dod[gnm_id] = current_genome_arcog_assignment_dict
|
|
107
|
+
|
|
108
|
+
###################################### write out combined annotation results #######################################
|
|
109
|
+
|
|
110
|
+
# write out combined annotation results
|
|
111
|
+
combined_annotation_dod = dict()
|
|
112
|
+
for each_gnm in sorted(list(gnm_to_gene_dict.keys())):
|
|
113
|
+
gnm_arcog_dict = arcog_assignment_dod[each_gnm]
|
|
114
|
+
gnm_kegg_dict = ko_assignment_dod[each_gnm]
|
|
115
|
+
gnm_gene_list = sorted(list(gnm_to_gene_dict[each_gnm]))
|
|
116
|
+
combined_annotation_dict = dict()
|
|
117
|
+
combined_annotation_txt = '%s/%s.txt' % (fun_assignment_dir, each_gnm)
|
|
118
|
+
combined_annotation_txt_handle = open(combined_annotation_txt, 'w')
|
|
119
|
+
for each_gene in gnm_gene_list:
|
|
120
|
+
if each_gene in gnm_kegg_dict:
|
|
121
|
+
fun_assignment = gnm_kegg_dict[each_gene]
|
|
122
|
+
fun_desc = fun_id_to_description_dict[fun_assignment]
|
|
123
|
+
combined_annotation_txt_handle.write('%s\t%s\t%s\n' % (each_gene, fun_assignment, fun_desc))
|
|
124
|
+
combined_annotation_dict[each_gene] = gnm_kegg_dict[each_gene]
|
|
125
|
+
elif each_gene in gnm_arcog_dict:
|
|
126
|
+
fun_assignment = gnm_arcog_dict[each_gene]
|
|
127
|
+
fun_desc = fun_id_to_description_dict[fun_assignment]
|
|
128
|
+
combined_annotation_txt_handle.write('%s\t%s\t%s\n' % (each_gene, fun_assignment, fun_desc))
|
|
129
|
+
combined_annotation_dict[each_gene] = gnm_arcog_dict[each_gene]
|
|
130
|
+
else:
|
|
131
|
+
combined_annotation_txt_handle.write(each_gene + '\n')
|
|
132
|
+
combined_annotation_txt_handle.close()
|
|
133
|
+
|
|
134
|
+
combined_annotation_dod[each_gnm] = combined_annotation_dict
|
|
135
|
+
|
|
136
|
+
############################################ write out annotation stats ############################################
|
|
137
|
+
|
|
138
|
+
for each_gnm in sorted(list(gnm_to_gene_dict.keys())):
|
|
139
|
+
annotation_dict = combined_annotation_dod[each_gnm]
|
|
140
|
+
|
|
141
|
+
fun_stats_num_txt = '%s/%s.txt' % (stats_dir_num, each_gnm)
|
|
142
|
+
fun_stats_pct_txt = '%s/%s.txt' % (stats_dir_pct, each_gnm)
|
|
143
|
+
|
|
144
|
+
stats_dict = dict()
|
|
145
|
+
gene_num = 0
|
|
146
|
+
for each_gene in annotation_dict:
|
|
147
|
+
fun_id = annotation_dict[each_gene]
|
|
148
|
+
if fun_id not in stats_dict:
|
|
149
|
+
stats_dict[fun_id] = 1
|
|
150
|
+
else:
|
|
151
|
+
stats_dict[fun_id] += 1
|
|
152
|
+
gene_num += 1
|
|
153
|
+
|
|
154
|
+
stats_dict_pct = dict()
|
|
155
|
+
for each_fun in stats_dict:
|
|
156
|
+
fun_num = stats_dict[each_fun]
|
|
157
|
+
fun_pct = fun_num*100/gene_num
|
|
158
|
+
fun_pct = float("{0:.2f}".format(fun_pct))
|
|
159
|
+
stats_dict_pct[each_fun] = fun_pct
|
|
160
|
+
|
|
161
|
+
fun_stats_num_txt_handle = open(fun_stats_num_txt, 'w')
|
|
162
|
+
fun_stats_pct_txt_handle = open(fun_stats_pct_txt, 'w')
|
|
163
|
+
for each_fun in sorted(list(stats_dict.keys())):
|
|
164
|
+
fun_num = stats_dict[each_fun]
|
|
165
|
+
fun_pct = stats_dict_pct[each_fun]
|
|
166
|
+
fun_desc = fun_id_to_description_dict[each_fun]
|
|
167
|
+
fun_stats_num_txt_handle.write('%s\t%s\t%s\n' % (each_fun, fun_num, fun_desc))
|
|
168
|
+
fun_stats_pct_txt_handle.write('%s\t%s\t%s\n' % (each_fun, fun_pct, fun_desc))
|
|
169
|
+
fun_stats_num_txt_handle.close()
|
|
170
|
+
fun_stats_pct_txt_handle.close()
|
|
171
|
+
|
|
172
|
+
####################################################################################################################
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
if __name__ == '__main__':
|
|
176
|
+
|
|
177
|
+
Combine_KEGG_arCOG_parser = argparse.ArgumentParser(usage=Combine_KEGG_arCOG_usage)
|
|
178
|
+
Combine_KEGG_arCOG_parser.add_argument('-o', required=True, help='output directory')
|
|
179
|
+
Combine_KEGG_arCOG_parser.add_argument('-kegg', required=True, help='annotation results from KEGG module')
|
|
180
|
+
Combine_KEGG_arCOG_parser.add_argument('-arcog', required=True, help='annotation results from arCOG module')
|
|
181
|
+
Combine_KEGG_arCOG_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
182
|
+
args = vars(Combine_KEGG_arCOG_parser.parse_args())
|
|
183
|
+
Combine_KEGG_arCOG(args)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
'''
|
|
187
|
+
|
|
188
|
+
BioSAK Combine_KEGG_arCOG -kegg 3_combined_genomes_50_5_dRep97_284_KEGG_wd -arcog 3_combined_genomes_50_5_dRep97_284_arCOG_wd_0.0001 -o 3_combined_genomes_50_5_dRep97_284_combined_KEGG_arCOG -f
|
|
189
|
+
|
|
190
|
+
'''
|
|
191
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
DendroDF_usage = '''
|
|
5
|
+
================== DendroDF example commands ==================
|
|
6
|
+
|
|
7
|
+
BioSAK DendroDF -i matrix.txt -o Dendrogram.pdf
|
|
8
|
+
|
|
9
|
+
===============================================================
|
|
10
|
+
'''
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def DendroDF(args):
|
|
14
|
+
|
|
15
|
+
input_matrix_txt = args['i']
|
|
16
|
+
output_pdf_txt = args['o']
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if __name__ == '__main__':
|
|
20
|
+
|
|
21
|
+
DendroDF_parser = argparse.ArgumentParser(usage=DendroDF_usage)
|
|
22
|
+
DendroDF_parser.add_argument('-i', required=True, help='input data matrix')
|
|
23
|
+
DendroDF_parser.add_argument('-o', required=True, help='output plot, in pdf format')
|
|
24
|
+
args = vars(DendroDF_parser.parse_args())
|
|
25
|
+
DendroDF(args)
|
|
@@ -7,7 +7,7 @@ from statsmodels.stats.multitest import multipletests
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
enrich_usage = '''
|
|
10
|
-
|
|
10
|
+
======================================= enrich example commands =======================================
|
|
11
11
|
|
|
12
12
|
BioSAK enrich -i annotation_files -x txt -g grouping.txt -o output_dir
|
|
13
13
|
BioSAK enrich -i annotation_files -x txt -g grouping.txt -o output_dir -bc
|
|
@@ -25,7 +25,7 @@ significant. Only significantly different functions with greater than, by defaul
|
|
|
25
25
|
differences are considered to be enriched. Functions detected only in the genomes from one group
|
|
26
26
|
type are considered to be enriched if they existed in at least 50 percent of the genomes in the group.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
=======================================================================================================
|
|
29
29
|
'''
|
|
30
30
|
|
|
31
31
|
|
|
@@ -104,12 +104,10 @@ def summarize_stats(output_test, fold_diff_cutoff, ko_desc_dict, file_prefix, ou
|
|
|
104
104
|
enriched_in = sample_2_id
|
|
105
105
|
|
|
106
106
|
if enriched_in == sample_1_id:
|
|
107
|
-
summary_txt_sample_1_handle.write('%s\t%s\t%s\t%s\t%s\t%s\n' % (ko_id, P_value_adjusted, sample_1_mean, sample_2_mean, mean_diff, ko_desc_dict
|
|
107
|
+
summary_txt_sample_1_handle.write('%s\t%s\t%s\t%s\t%s\t%s\n' % (ko_id, P_value_adjusted, sample_1_mean, sample_2_mean, mean_diff, ko_desc_dict.get(ko_id, 'na')))
|
|
108
108
|
if enriched_in == sample_2_id:
|
|
109
|
-
summary_txt_sample_2_handle.write('%s\t%s\t%s\t%s\t%s\t%s\n' % (ko_id, P_value_adjusted, sample_1_mean, sample_2_mean, mean_diff, ko_desc_dict
|
|
110
|
-
|
|
109
|
+
summary_txt_sample_2_handle.write('%s\t%s\t%s\t%s\t%s\t%s\n' % (ko_id, P_value_adjusted, sample_1_mean, sample_2_mean, mean_diff, ko_desc_dict.get(ko_id, 'na')))
|
|
111
110
|
line_num_index += 1
|
|
112
|
-
|
|
113
111
|
summary_txt_sample_1_handle.close()
|
|
114
112
|
summary_txt_sample_2_handle.close()
|
|
115
113
|
|
|
@@ -216,7 +214,8 @@ def enrich(args):
|
|
|
216
214
|
identified_ko_set.add(each_line_split[0])
|
|
217
215
|
current_MAG_ko_stats_dict[each_line_split[0]] = int(each_line_split[1])
|
|
218
216
|
current_MAG_ko_total += int(each_line_split[1])
|
|
219
|
-
|
|
217
|
+
if len(each_line_split) >= 3:
|
|
218
|
+
ko_desc_dict[each_line_split[0]] = each_line_split[2]
|
|
220
219
|
line_num_index += 1
|
|
221
220
|
|
|
222
221
|
current_MAG_ko_stats_dict_norm = {}
|
|
@@ -300,7 +299,7 @@ def enrich(args):
|
|
|
300
299
|
group_2_mean = current_p_group_mean[1]
|
|
301
300
|
group_1_no_zero_pct = current_p_detected_pct[0]
|
|
302
301
|
group_2_no_zero_pct = current_p_detected_pct[1]
|
|
303
|
-
output_test_handle.write('%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % (ko_id_list[x], group_1_mean, group_1_no_zero_pct, group_2_mean, group_2_no_zero_pct, current_p, current_p_adjusted, ko_desc_dict
|
|
302
|
+
output_test_handle.write('%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' % (ko_id_list[x], group_1_mean, group_1_no_zero_pct, group_2_mean, group_2_no_zero_pct, current_p, current_p_adjusted, ko_desc_dict.get(ko_id_list[x], 'na')))
|
|
304
303
|
x += 1
|
|
305
304
|
output_test_handle.close()
|
|
306
305
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: BioSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.96.0
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/BioSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -20,4 +20,4 @@ Requires-Dist: beautifulsoup4
|
|
|
20
20
|
Requires-Dist: ete3
|
|
21
21
|
Requires-Dist: statsmodels
|
|
22
22
|
|
|
23
|
-
BioSAK v1.
|
|
23
|
+
BioSAK v1.96.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: BioSAK
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.96.0
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/BioSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -20,4 +20,4 @@ Requires-Dist: beautifulsoup4
|
|
|
20
20
|
Requires-Dist: ete3
|
|
21
21
|
Requires-Dist: statsmodels
|
|
22
22
|
|
|
23
|
-
BioSAK v1.
|
|
23
|
+
BioSAK v1.96.0
|
|
@@ -66,6 +66,7 @@ def print_main_help():
|
|
|
66
66
|
COG2020 -> COG annotation (v2020, by blastp/diamond)
|
|
67
67
|
arCOG -> COG annotation for archaea (version ar18)
|
|
68
68
|
dbCAN -> CAZy annotation with dbCAN
|
|
69
|
+
Combine_KEGG_arCOG -> Combine KEGG and arCOG annotation results
|
|
69
70
|
enrich -> Functional enrichment analysis
|
|
70
71
|
gapseq -> Data matrix GapSeq predicted pathways
|
|
71
72
|
stats_ko -> get stats for a list of provided KO
|
|
@@ -180,10 +181,8 @@ if __name__ == '__main__':
|
|
|
180
181
|
arCOG_parser.add_argument('-db_dir', required=True, help='DB folder')
|
|
181
182
|
arCOG_parser.add_argument('-diamond', required=False, action='store_true', help='run diamond (for big dataset), default is NCBI blastp')
|
|
182
183
|
arCOG_parser.add_argument('-t', required=False, default=1, type=int, help='number of threads')
|
|
183
|
-
arCOG_parser.add_argument('-evalue', required=False, default=0.0001, type=float, help='evalue cutoff, default: 0.0001')
|
|
184
184
|
arCOG_parser.add_argument('-evalue', required=False, default=0.0001, help='evalue cutoff, accepted format 0.001, 1e-10, 1e-30, default: 0.0001')
|
|
185
185
|
arCOG_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
186
|
-
|
|
187
186
|
args = vars(parser.parse_args())
|
|
188
187
|
arCOG.arCOG(args)
|
|
189
188
|
|
|
@@ -1031,6 +1030,16 @@ if __name__ == '__main__':
|
|
|
1031
1030
|
args = vars(parser.parse_args())
|
|
1032
1031
|
prefix_seq_by_file_name.prefix_seq_by_file_name(args)
|
|
1033
1032
|
|
|
1033
|
+
elif sys.argv[1] == 'Combine_KEGG_arCOG':
|
|
1034
|
+
from BioSAK import Combine_KEGG_arCOG
|
|
1035
|
+
Combine_KEGG_arCOG_parser = subparsers.add_parser('Combine_KEGG_arCOG', usage=Combine_KEGG_arCOG.Combine_KEGG_arCOG_usage)
|
|
1036
|
+
Combine_KEGG_arCOG_parser.add_argument('-o', required=True, help='output directory')
|
|
1037
|
+
Combine_KEGG_arCOG_parser.add_argument('-kegg', required=True, help='annotation results from KEGG module')
|
|
1038
|
+
Combine_KEGG_arCOG_parser.add_argument('-arcog', required=True, help='annotation results from arCOG module')
|
|
1039
|
+
Combine_KEGG_arCOG_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
1040
|
+
args = vars(parser.parse_args())
|
|
1041
|
+
Combine_KEGG_arCOG.Combine_KEGG_arCOG(args)
|
|
1042
|
+
|
|
1034
1043
|
else:
|
|
1035
1044
|
print('Unrecognized module: %s, program exited' % sys.argv[1])
|
|
1036
1045
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|