BioSAK 1.78.0__tar.gz → 1.78.3__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.
Files changed (151) hide show
  1. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/VERSION +3 -3
  2. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/dbCAN.py +63 -56
  3. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/enrich.py +82 -41
  4. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK.egg-info/PKG-INFO +2 -2
  5. {BioSAK-1.78.0 → BioSAK-1.78.3}/PKG-INFO +2 -2
  6. {BioSAK-1.78.0 → BioSAK-1.78.3}/bin/BioSAK +6 -5
  7. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/BLCA_op_parser.py +0 -0
  8. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/BioSAK_config.py +0 -0
  9. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/COG2020.py +0 -0
  10. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/COG_boxplot_last1row.R +0 -0
  11. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/COG_boxplot_last2row.R +0 -0
  12. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/CheckM.py +0 -0
  13. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/ConvertMSA.py +0 -0
  14. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/DnaFeaturesViewer.py +0 -0
  15. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/FastaSplitler_by_num.py +0 -0
  16. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/FastaSplitler_by_size.py +0 -0
  17. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/GTDB_for_BLCA.py +0 -0
  18. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/Gene2Ctg.py +0 -0
  19. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/KEGG.py +0 -0
  20. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/KEGG_boxplot_last1row.R +0 -0
  21. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/KEGG_get_eukaryotic_kos.py +0 -0
  22. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/KeepRemovingTmp.py +0 -0
  23. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/MeanMappingDepth.py +0 -0
  24. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/MetaBiosample.py +0 -0
  25. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/MetaCHIP_phylo.hmm +0 -0
  26. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/MetaCyc_reactions_with_ec.txt +0 -0
  27. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/NetEnzymes.py +0 -0
  28. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/Newick_tree_plotter.py +0 -0
  29. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/OneLineAln.py +0 -0
  30. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/Prodigal.py +0 -0
  31. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/Reads_simulator.py +0 -0
  32. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/RunGraphMB.py +0 -0
  33. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/SILVA_for_BLCA.py +0 -0
  34. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/SankeyTaxon.py +0 -0
  35. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/SliceMSA.py +0 -0
  36. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/SubsampleLongReads.py +0 -0
  37. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/Tax4Fun2IndOTU.py +0 -0
  38. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/VisBlastOp.py +0 -0
  39. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/VisGeneFlk.py +0 -0
  40. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/__init__.py +0 -0
  41. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/arCOG.py +0 -0
  42. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/bam2reads.py +0 -0
  43. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/boxplot_last1row.R +0 -0
  44. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/boxplot_matrix_COG.py +0 -0
  45. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/boxplot_matrix_COG_backup.py +0 -0
  46. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/boxplot_matrix_KEGG.py +0 -0
  47. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/boxplot_matrix_dbCAN.py +0 -0
  48. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/cat_fa.py +0 -0
  49. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/cdd2cog.pl +0 -0
  50. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/checkm_marker.py +0 -0
  51. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/compare_trees.R +0 -0
  52. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/compare_trees.py +0 -0
  53. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/cross_link_seqs.py +0 -0
  54. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/download_GenBank_genome_subset_prokaryotes_csv.py +0 -0
  55. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/dwnld_sra_reads.py +0 -0
  56. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/exe_cmds.py +0 -0
  57. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/ezaai2mat.py +0 -0
  58. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/fa2id.py +0 -0
  59. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/fa2phy.py +0 -0
  60. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/fa2tree.py +0 -0
  61. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/format_converter.py +0 -0
  62. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/format_leaf_name.py +0 -0
  63. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/fq2fa.py +0 -0
  64. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/gbk2faa.py +0 -0
  65. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/gbk2ffn.py +0 -0
  66. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/gbk2fna.py +0 -0
  67. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/gbk_to_ffn_faa.py +0 -0
  68. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_EC_from_ko_stats_D.py +0 -0
  69. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_GTDB_taxon_gnm.py +0 -0
  70. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_MAG_reads_long.py +0 -0
  71. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_Pfam_hmms.py +0 -0
  72. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_SCG_tree.py +0 -0
  73. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_TopHits_taxonomy.py +0 -0
  74. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_aa_composition.py +0 -0
  75. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_bin_abundance copy.py +0 -0
  76. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_data_matrix.py +0 -0
  77. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_gc.py +0 -0
  78. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_gene_depth.py +0 -0
  79. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_genome_GTDB.py +0 -0
  80. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_genome_NCBI.py +0 -0
  81. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_genome_NCBI_v1.py +0 -0
  82. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_genome_NCBI_v2.py +0 -0
  83. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_gnm_size.py +0 -0
  84. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_ko_gene_seqs.py +0 -0
  85. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_krona_plot.py +0 -0
  86. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_reads_from_sam.py +0 -0
  87. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_reads_id_in_sam.py +0 -0
  88. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_sankey_plot.R +0 -0
  89. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_top_hit.py +0 -0
  90. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/get_total_length.py +0 -0
  91. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/global_functions.py +0 -0
  92. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/hpc3.py +0 -0
  93. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/iTOL.py +0 -0
  94. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/js_cmds.py +0 -0
  95. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/js_hpc3.py +0 -0
  96. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/keep_best_hit.py +0 -0
  97. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/ko00001.keg +0 -0
  98. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/koala.py +0 -0
  99. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/label_tree.R +0 -0
  100. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/label_tree.py +0 -0
  101. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/link_16S_MAG.py +0 -0
  102. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/magabund.py +0 -0
  103. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/magabund2.py +0 -0
  104. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/manipulator_fasta.py +0 -0
  105. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/manipulator_msa.py +0 -0
  106. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/manipulator_newick.py +0 -0
  107. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/manipulator_sam.py +0 -0
  108. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/mean_MAG_cov.py +0 -0
  109. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/merge_seq.py +0 -0
  110. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/metaAssembly.py +0 -0
  111. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/metabat2concoct.py +0 -0
  112. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/metabat2maxbin.py +0 -0
  113. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/msa_to_distance_matrix.py +0 -0
  114. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/ncbi_dataset.py +0 -0
  115. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/odp.py +0 -0
  116. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/parse_MetaCyc_RxnDB.py +0 -0
  117. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/parse_mmseqs_tsv.py +0 -0
  118. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/plot_mag.py +0 -0
  119. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/plot_sam_depth.py +0 -0
  120. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/plot_tree.R +0 -0
  121. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/prefix_file.py +0 -0
  122. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/prokka.py +0 -0
  123. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/reads2bam.py +0 -0
  124. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/rename_leaves.py +0 -0
  125. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/rename_reads_for_Reago.py +0 -0
  126. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/rename_seq.py +0 -0
  127. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/rename_seqs.py +0 -0
  128. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/ribbon.py +0 -0
  129. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/sam2bam.py +0 -0
  130. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/sampling_GTDB_gnms.py +0 -0
  131. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/select_seq.py +0 -0
  132. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/sep_reads_by_barcode.py +0 -0
  133. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/slice_seq.py +0 -0
  134. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/split_fasta.py +0 -0
  135. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/split_folder.py +0 -0
  136. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/split_sam.py +0 -0
  137. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/submitHPC.py +0 -0
  138. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/subset_GTDB_meta.py +0 -0
  139. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/subset_tree.py +0 -0
  140. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/top_16S_hits.py +0 -0
  141. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/top_hits_in_a_group.py +0 -0
  142. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK/usearch_uc.py +0 -0
  143. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK.egg-info/SOURCES.txt +0 -0
  144. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK.egg-info/dependency_links.txt +0 -0
  145. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK.egg-info/requires.txt +0 -0
  146. {BioSAK-1.78.0 → BioSAK-1.78.3}/BioSAK.egg-info/top_level.txt +0 -0
  147. {BioSAK-1.78.0 → BioSAK-1.78.3}/LICENSE +0 -0
  148. {BioSAK-1.78.0 → BioSAK-1.78.3}/MANIFEST.in +0 -0
  149. {BioSAK-1.78.0 → BioSAK-1.78.3}/README.md +0 -0
  150. {BioSAK-1.78.0 → BioSAK-1.78.3}/setup.cfg +0 -0
  151. {BioSAK-1.78.0 → BioSAK-1.78.3}/setup.py +0 -0
@@ -1,9 +1,9 @@
1
+ 1.78.3
2
+ - fixed bugs
3
+
1
4
  1.78.0
2
5
  - new module added: koala
3
6
 
4
- 1.77.1
5
- - fixed bugs
6
-
7
7
  1.77.0
8
8
  - new module added: js_hpc3
9
9
 
@@ -1,41 +1,26 @@
1
- #!/usr/bin/env python3
2
-
3
1
  import os
4
2
  import glob
3
+ import shutil
5
4
  import argparse
6
5
  from Bio import SeqIO
7
6
  import multiprocessing as mp
8
7
  from datetime import datetime
9
8
  from Bio.SeqRecord import SeqRecord
10
- from BioSAK.global_functions import time_format
11
- from BioSAK.global_functions import force_create_folder
12
- from BioSAK.global_functions import sep_path_basename_ext
13
- from BioSAK.global_functions import AnnotateNorm
14
9
 
15
10
 
16
11
  dbCAN_parser_usage = '''
17
- ============================================== dbCAN example commands ==============================================
18
-
19
- # Dependencies
20
- module load hmmer
21
-
22
- # annotate protein sequences
23
- BioSAK dbCAN -m P -t 6 -db_dir path/to/your/dbCAN_db_dir -i recipient.faa
24
- BioSAK dbCAN -m P -t 6 -db_dir path/to/your/dbCAN_db_dir -i recipient.faa -depth recipient.depth
25
- BioSAK dbCAN -m P -t 6 -db_dir path/to/your/dbCAN_db_dir -i faa_files -x faa
26
- BioSAK dbCAN -m P -t 6 -db_dir path/to/your/dbCAN_db_dir -i faa_files -x faa -depth depth_files
27
-
28
- # annotate DNA sequences
29
- BioSAK dbCAN -m N -t 6 -db_dir /srv/scratch/z5039045/DB/dbCAN_V9 -i recipient.ffn
30
- BioSAK dbCAN -m N -t 6 -db_dir /srv/scratch/z5039045/DB/dbCAN_V9 -i ffn_files -x ffn
31
-
32
- # Prepare DB files (versions V9):
33
- cd path/to/your/dbCAN_db_dir
34
- wget http://bcb.unl.edu/dbCAN2/download/Databases/V9/hmmscan-parser.sh
35
- wget http://bcb.unl.edu/dbCAN2/download/Databases/V9/CAZyDB.07302020.fam-activities.txt
36
- wget http://bcb.unl.edu/dbCAN2/download/Databases/V9/dbCAN-HMMdb-V9.txt
37
- mv CAZyDB.07302020.fam-activities.txt CAZyDB.fam-activities.txt
38
- mv dbCAN-HMMdb-V9.txt dbCAN-fam-HMMs.txt
12
+ ================================================ dbCAN example commands ================================================
13
+
14
+ # Dependency: hmmer
15
+
16
+ BioSAK dbCAN -m P -t 6 -db_dir dbCAN3_db_v12 -i recipient.faa
17
+ BioSAK dbCAN -m P -t 6 -db_dir dbCAN3_db_v12 -i faa_files -x faa
18
+
19
+ # Prepare DB files (v12):
20
+ cd dbCAN3_db_v12
21
+ wget https://bcb.unl.edu/dbCAN2/download/Databases/V12/hmmscan-parser.sh
22
+ wget https://bcb.unl.edu/dbCAN2/download/Databases/V12/CAZyDB.08062022.fam-activities.txt -O CAZyDB.fam-activities.txt
23
+ wget https://bcb.unl.edu/dbCAN2/download/Databases/V12/dbCAN-HMMdb-V12.txt -O dbCAN-fam-HMMs.txt
39
24
  hmmpress dbCAN-fam-HMMs.txt
40
25
 
41
26
  # How it works:
@@ -53,9 +38,50 @@ Name of the depth file needs to be exactly the same as its corresponding sequenc
53
38
  gene_1 30
54
39
  gene_2 10.58
55
40
 
56
- ====================================================================================================================
41
+ ========================================================================================================================
57
42
  '''
58
43
 
44
+ time_format = '[%Y-%m-%d %H:%M:%S] '
45
+
46
+
47
+ def force_create_folder(folder_to_create):
48
+ if os.path.isdir(folder_to_create):
49
+ shutil.rmtree(folder_to_create, ignore_errors=True)
50
+ os.mkdir(folder_to_create)
51
+
52
+
53
+ def sep_path_basename_ext(file_in):
54
+
55
+ f_path, file_name = os.path.split(file_in)
56
+ if f_path == '':
57
+ f_path = '.'
58
+ f_base, f_ext = os.path.splitext(file_name)
59
+
60
+ return f_path, f_base, f_ext
61
+
62
+
63
+ def AnnotateNorm(file_in, skip_header, value_column, Divisor_value, file_out, file_out_header):
64
+
65
+ file_out_handle = open(file_out, 'w')
66
+ file_out_handle.write(file_out_header)
67
+ line_num = 0
68
+ for each_line in open(file_in):
69
+
70
+ each_line_split = each_line.strip().split('\t')
71
+ value_str = each_line_split[value_column - 1]
72
+
73
+ if (skip_header is True and line_num > 0) or (skip_header is False):
74
+
75
+ value_pct = 0
76
+ if Divisor_value != 0:
77
+ value_pct = float(value_str) * 100 / Divisor_value
78
+ each_line_split[value_column - 1] = str(float("{0:.2f}".format(value_pct)))
79
+ file_out_handle.write('%s\n' % '\t'.join(each_line_split))
80
+
81
+ line_num += 1
82
+
83
+ file_out_handle.close()
84
+
59
85
 
60
86
  def dna2aa(dna_file, aa_file):
61
87
  query_aa_handle = open(aa_file, 'w')
@@ -93,17 +119,9 @@ def dbCAN_worker(argument_list):
93
119
  print('Specified input sequence type unrecognizable, program exited!')
94
120
  exit()
95
121
 
96
- hmmscan_cmd = "hmmscan --domtblout %s/%s.out.dm %s %s > %s/%s.out" % (current_output_folder, input_seq_no_ext,
97
- pwd_dbCAN_fam_HMMs, input_seq_aa,
98
- current_output_folder, input_seq_no_ext)
99
-
100
- hmmscan_parser_cmd = "sh %s %s/%s.out.dm > %s/%s.out.dm.ps" % (pwd_hmmscan_parser, current_output_folder,
101
- input_seq_no_ext, current_output_folder,
102
- input_seq_no_ext)
103
-
104
- final_cat_cmd = "cat %s/%s.out.dm.ps | awk '$5<1e-18&&$10>0.35' > %s/%s.out.dm.ps.stringent" % (current_output_folder, input_seq_no_ext,
105
- current_output_folder, input_seq_no_ext)
106
-
122
+ hmmscan_cmd = "hmmscan --domtblout %s/%s.out.dm %s %s > %s/%s.out" % (current_output_folder, input_seq_no_ext, pwd_dbCAN_fam_HMMs, input_seq_aa, current_output_folder, input_seq_no_ext)
123
+ hmmscan_parser_cmd = "sh %s %s/%s.out.dm > %s/%s.out.dm.ps" % (pwd_hmmscan_parser, current_output_folder, input_seq_no_ext, current_output_folder, input_seq_no_ext)
124
+ final_cat_cmd = "cat %s/%s.out.dm.ps | awk '$5<1e-18&&$10>0.35' > %s/%s.out.dm.ps.stringent" % (current_output_folder, input_seq_no_ext, current_output_folder, input_seq_no_ext)
107
125
  os.system(hmmscan_cmd)
108
126
  os.system(hmmscan_parser_cmd)
109
127
  os.system(final_cat_cmd)
@@ -161,7 +179,6 @@ def dbCAN_worker(argument_list):
161
179
 
162
180
  # write out
163
181
  pwd_annotation_results_handle.write('%s\t%s\t%s\n' % (query_id, matched_hmm, matched_hmm_activities))
164
-
165
182
  pwd_annotation_results_handle.close()
166
183
 
167
184
  #################### get summary of annotation results GeneNumber ####################
@@ -172,14 +189,12 @@ def dbCAN_worker(argument_list):
172
189
  for each_hmm in hmm_to_gene_member_dict:
173
190
  each_hmm_id = each_hmm.split('.hmm')[0]
174
191
  each_hmm_GeneNumber = len(hmm_to_gene_member_dict[each_hmm_id])
175
-
176
192
  each_hmm_activities = 'NA'
177
193
  matched_hmm_id_no_underscore = each_hmm_id
178
194
  if '_' in matched_hmm_id_no_underscore:
179
195
  matched_hmm_id_no_underscore = matched_hmm_id_no_underscore.split('_')[0]
180
196
  if matched_hmm_id_no_underscore in fam_to_activities_dict:
181
197
  each_hmm_activities = fam_to_activities_dict[matched_hmm_id_no_underscore]
182
-
183
198
  pwd_annotation_results_stats_GeneNumber_handle.write('%s\t%s\t%s\n' % (each_hmm_id, each_hmm_GeneNumber, each_hmm_activities))
184
199
  total_GeneNumber_identified += each_hmm_GeneNumber
185
200
  pwd_annotation_results_stats_GeneNumber_handle.close()
@@ -211,7 +226,6 @@ def dbCAN_worker(argument_list):
211
226
 
212
227
  pwd_annotation_results_stats_TotalDepth_handle.write('%s\t%s\t%s\n' % (each_hmm_id, each_hmm_TotalDepth, each_hmm_activities))
213
228
  total_depth_identified += each_hmm_TotalDepth
214
-
215
229
  pwd_annotation_results_stats_TotalDepth_handle.close()
216
230
 
217
231
  #################### get summary of annotation results TotalDepth pct ####################
@@ -265,7 +279,6 @@ def get_dbCAN_annot_df(annotation_dir, annotation_df_absolute_num, annotation_df
265
279
  annotation_df_absolute_num_handle.write('\t%s\n' % '\t'.join(all_identified_cazy_family_list))
266
280
  annotation_df_percentage_handle.write('\t%s\n' % '\t'.join(all_identified_cazy_family_list))
267
281
  for annotation_folder in sorted(annotation_folder_list):
268
-
269
282
  annotation_folder_basename = annotation_folder.split('_dbCAN_wd')[0]
270
283
  current_annotation_cazy_num_dict = cazy_family_to_num_dict[annotation_folder_basename]
271
284
  current_annotation_cazy_num_pct_dict = cazy_family_to_num_pct_dict[annotation_folder_basename]
@@ -346,12 +359,10 @@ def dbCAN(args):
346
359
 
347
360
  # if input is folder
348
361
  else:
349
-
350
362
  # check whether input folder exist
351
363
  if os.path.isdir(file_in) is False:
352
364
  print(datetime.now().strftime(time_format) + 'input folder not found, program exited!')
353
365
  exit()
354
-
355
366
  else:
356
367
  # check whether input genome exist
357
368
  input_file_re = '%s/*.%s' % (file_in, file_extension)
@@ -394,11 +405,11 @@ def dbCAN(args):
394
405
  else:
395
406
  file_in_folder_name = file_in
396
407
 
397
- output_folder = '%s_dbCAN_wd' % file_in_folder_name
398
- annotation_df_GeneNumber = '%s/%s_GeneNumber.txt' % (output_folder, file_in_folder_name)
399
- annotation_df_GeneNumber_pct = '%s/%s_GeneNumber_pct.txt' % (output_folder, file_in_folder_name)
400
- annotation_df_TotalDepth = '%s/%s_TotalDepth.txt' % (output_folder, file_in_folder_name)
401
- annotation_df_TotalDepth_pct = '%s/%s_TotalDepth_pct.txt' % (output_folder, file_in_folder_name)
408
+ output_folder = '%s_dbCAN_wd' % file_in_folder_name
409
+ annotation_df_GeneNumber = '%s/%s_GeneNumber.txt' % (output_folder, file_in_folder_name)
410
+ annotation_df_GeneNumber_pct = '%s/%s_GeneNumber_pct.txt' % (output_folder, file_in_folder_name)
411
+ annotation_df_TotalDepth = '%s/%s_TotalDepth.txt' % (output_folder, file_in_folder_name)
412
+ annotation_df_TotalDepth_pct = '%s/%s_TotalDepth_pct.txt' % (output_folder, file_in_folder_name)
402
413
 
403
414
  # create output folder
404
415
  force_create_folder(output_folder)
@@ -447,15 +458,11 @@ def dbCAN(args):
447
458
  if __name__ == '__main__':
448
459
 
449
460
  dbCAN_parser = argparse.ArgumentParser(usage=dbCAN_parser_usage)
450
-
451
- # arguments for COG_parser
452
461
  dbCAN_parser.add_argument('-i', required=True, help='path to input sequences (in multi-fasta format)')
453
462
  dbCAN_parser.add_argument('-x', required=False, help='file extension')
454
463
  dbCAN_parser.add_argument('-m', required=False, default='P', help='input sequence type, "N/n" for "nucleotide", "P/p" for "protein"')
455
464
  dbCAN_parser.add_argument('-depth', required=False, default=None, help='gene depth file/folder')
456
465
  dbCAN_parser.add_argument('-db_dir', required=True, help='db folder')
457
466
  dbCAN_parser.add_argument('-t', required=False, type=int, default=1, help='number of threads')
458
-
459
467
  args = vars(dbCAN_parser.parse_args())
460
-
461
468
  dbCAN(args)
@@ -9,14 +9,14 @@ from statsmodels.stats.multitest import multipletests
9
9
  enrich_usage = '''
10
10
  =================================== enrich example commands ===================================
11
11
 
12
- BioSAK enrich -i annotation_files -x txt -g grouping.txt -o output_dir -f
12
+ BioSAK enrich -i annotation_files -x txt -g grouping.txt -o output_dir -bc
13
13
 
14
- # The number of groups needs to be Two!!!
14
+ # The number of genome groups has to be TWO!!!
15
15
 
16
16
  # Example input files:
17
17
  https://github.com/songweizhi/BioSAK/tree/master/demo_data/enrich
18
18
 
19
- # How it works (https://doi.org/10.1038/s41396-020-00815-8):
19
+ # please refers to https://doi.org/10.1038/s41396-020-00815-8 for how it works:
20
20
  Functions that are enriched in the genomes in either group are identified using Mann–Whitney
21
21
  U tests followed by a Bonferroni correction with a p value cut-off of 0.05 being considered
22
22
  significant. Only significantly different functions with greater than 2-fold mean differences
@@ -46,7 +46,7 @@ def remove_0_from_Pandas_Series(Pandas_Series):
46
46
  return no_0_num_list
47
47
 
48
48
 
49
- def summarize_stats(output_test, summary_txt):
49
+ def summarize_stats(output_test, ko_desc_dict, summary_txt):
50
50
 
51
51
  sample_1_id = ''
52
52
  sample_2_id = ''
@@ -58,7 +58,7 @@ def summarize_stats(output_test, summary_txt):
58
58
  line_num_index += 1
59
59
 
60
60
  summary_txt_handle = open(summary_txt, 'w')
61
- summary_txt_handle.write('ID\tP_value\t%s\t%s\tMean_diff\tEnriched_in\n' % (sample_1_id, sample_2_id))
61
+ summary_txt_handle.write('ID\tP_value\t%s\t%s\tMean_diff\tEnriched_in\tDescription\n' % (sample_1_id, sample_2_id))
62
62
  line_num_index = 0
63
63
  for ko in open(output_test):
64
64
  if line_num_index > 0:
@@ -89,7 +89,7 @@ def summarize_stats(output_test, summary_txt):
89
89
  enriched_in = sample_2_id
90
90
 
91
91
  if (enriched_in == sample_1_id) or (enriched_in == sample_2_id):
92
- summary_txt_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, enriched_in))
92
+ summary_txt_handle.write('%s\t%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, enriched_in, ko_desc_dict[ko_id]))
93
93
  line_num_index += 1
94
94
  summary_txt_handle.close()
95
95
 
@@ -100,47 +100,88 @@ def enrich(args):
100
100
  file_ext = args['x']
101
101
  grouping_file = args['g']
102
102
  op_dir = args['o']
103
+ perform_bc = args['bc']
103
104
  force_create_op_dir = args['f']
104
105
 
105
- annotation_matrix_file = '%s/data_matrix.txt' % op_dir
106
- stats_op_txt = '%s/stats_result.txt' % op_dir
107
- summary_txt = '%s/summary.txt' % op_dir
108
-
109
- if os.path.isdir(op_dir) is True:
110
- if force_create_op_dir is True:
111
- os.system('rm -r %s' % op_dir)
112
- else:
113
- print('Output folder detected, program exited!')
114
- exit()
115
-
116
- os.system('mkdir %s' % op_dir)
106
+ ####################################################################################################################
117
107
 
118
108
  # read in grouping file
119
- grouping_dict = dict()
120
109
  group_id_set = set()
110
+ grouping_dict = dict()
111
+ gnm_with_grouping_set = set()
121
112
  for each_gnm in open(grouping_file):
122
113
  each_gnm_split = each_gnm.strip().split('\t')
123
114
  grouping_dict[each_gnm_split[0]] = each_gnm_split[1]
124
115
  group_id_set.add(each_gnm_split[1])
116
+ gnm_with_grouping_set.add(each_gnm_split[0])
125
117
 
126
- group_id_list = sorted([i for i in group_id_set])
127
-
128
- if len(group_id_list) != 2:
118
+ if len(group_id_set) != 2:
129
119
  print('The number of groups needs to be TWO, program exited!')
130
120
  exit()
131
121
 
132
- group_1_id = group_id_list[0]
133
- group_2_id = group_id_list[1]
134
-
122
+ # get annotation file list
135
123
  annotation_file_re = '%s/*.%s' % (annotation_file_dir, file_ext)
136
124
  annotation_file_list = glob.glob(annotation_file_re)
137
- if len(annotation_file_list) == 0:
125
+ annotation_file_list_id = [os.path.splitext(os.path.basename(i))[0] for i in annotation_file_list]
126
+ if len(annotation_file_list_id) == 0:
138
127
  print('Annotation file not found, program exited!')
139
128
  exit()
140
129
 
130
+ # get shared genomes
131
+ shared_gnm_set = set(gnm_with_grouping_set).intersection(annotation_file_list_id)
132
+ if len(shared_gnm_set) == 0:
133
+ print('No genome shared by %s and %s, program exited!' % (grouping_file, annotation_file_dir))
134
+ exit()
135
+
136
+ gnms_uniq_to_grouping_file = set()
137
+ for g1 in gnm_with_grouping_set:
138
+ if g1 not in shared_gnm_set:
139
+ gnms_uniq_to_grouping_file.add(g1)
140
+
141
+ gnms_uniq_to_annotation_dir = set()
142
+ for g2 in annotation_file_list_id:
143
+ if g2 not in shared_gnm_set:
144
+ gnms_uniq_to_annotation_dir.add(g2)
145
+
146
+ # report
147
+ if len(gnms_uniq_to_grouping_file) > 0:
148
+ print('Genomes uniq to %s (%s): %s' % (grouping_file, len(gnms_uniq_to_grouping_file), ','.join(sorted(list(gnms_uniq_to_grouping_file)))))
149
+ if len(gnms_uniq_to_annotation_dir) > 0:
150
+ print('Genomes uniq to %s (%s): %s' % (annotation_file_dir, len(gnms_uniq_to_annotation_dir), ','.join(sorted(list(gnms_uniq_to_annotation_dir)))))
151
+
152
+ print('%s genomes found in both %s and %s.' % (len(shared_gnm_set), grouping_file, annotation_file_dir))
153
+ print('Will perform enrichment analysis on the %s genomes.' % len(shared_gnm_set))
154
+
155
+ ####################################################################################################################
156
+
157
+ annotation_matrix_file = '%s/data_matrix.txt' % op_dir
158
+ stats_op_txt = '%s/stats_result.txt' % op_dir
159
+ summary_txt = '%s/summary.txt' % op_dir
160
+
161
+ if os.path.isdir(op_dir) is True:
162
+ if force_create_op_dir is True:
163
+ os.system('rm -r %s' % op_dir)
164
+ else:
165
+ print('Output directory detected, program exited!')
166
+ exit()
167
+ os.system('mkdir %s' % op_dir)
168
+
169
+ ####################################################################################################################
170
+
171
+ annotation_file_list_only_shared = set()
172
+ for each_file in annotation_file_list:
173
+ _, f_base, _ = sep_path_basename_ext(each_file)
174
+ if f_base in shared_gnm_set:
175
+ annotation_file_list_only_shared.add(each_file)
176
+
177
+ group_id_list = sorted([i for i in group_id_set])
178
+ group_1_id = group_id_list[0]
179
+ group_2_id = group_id_list[1]
180
+
141
181
  identified_ko_set = set()
142
182
  ko_dict_of_dict = {}
143
- for annotation_file in annotation_file_list:
183
+ ko_desc_dict = dict()
184
+ for annotation_file in annotation_file_list_only_shared:
144
185
  f_path, MAG_id, f_ext = sep_path_basename_ext(annotation_file)
145
186
  current_MAG_ko_stats_dict = {}
146
187
  current_MAG_ko_total = 0
@@ -151,6 +192,7 @@ def enrich(args):
151
192
  identified_ko_set.add(each_line_split[0])
152
193
  current_MAG_ko_stats_dict[each_line_split[0]] = int(each_line_split[1])
153
194
  current_MAG_ko_total += int(each_line_split[1])
195
+ ko_desc_dict[each_line_split[0]] = each_line_split[2]
154
196
  line_num_index += 1
155
197
 
156
198
  current_MAG_ko_stats_dict_norm = {}
@@ -173,11 +215,6 @@ def enrich(args):
173
215
 
174
216
  current_MAG_ko_stats_list_str = [str(i) for i in current_MAG_ko_stats_list]
175
217
 
176
- if MAG not in grouping_dict:
177
- print('ID %s not found in %s, program exited!' % (MAG, grouping_file))
178
- print('Program exited!')
179
- exit()
180
-
181
218
  mag_group = grouping_dict[MAG]
182
219
  file_out_handle.write('%s,%s,%s\n' % (mag_group, MAG, ','.join(current_MAG_ko_stats_list_str)))
183
220
  file_out_handle.close()
@@ -221,11 +258,14 @@ def enrich(args):
221
258
 
222
259
  col_index += 1
223
260
 
224
- p_value_list_adjusted = multipletests(p_value_list, alpha=0.1, method='bonferroni')[1]
261
+ if perform_bc is True:
262
+ p_value_list_adjusted = multipletests(p_value_list, alpha=0.1, method='bonferroni')[1]
263
+ else:
264
+ p_value_list_adjusted = p_value_list
225
265
 
226
266
  x = 0
227
267
  output_test_handle = open(stats_op_txt, 'w')
228
- output_test_handle.write('KO\t%s\tDectected_pct\t%s\tDectected_pct\tP_value\tP_value_adjusted\n' % (group_1_id, group_2_id))
268
+ output_test_handle.write('KO\t%s\tDectected_pct\t%s\tDectected_pct\tP_value\tP_value_adjusted\tDescription\n' % (group_1_id, group_2_id))
229
269
  while x < len(ko_id_list):
230
270
  current_p = float("{0:.3f}".format(p_value_list[x]))
231
271
  current_p_adjusted = float("{0:.3f}".format(p_value_list_adjusted[x]))
@@ -237,12 +277,12 @@ def enrich(args):
237
277
  group_1_no_zero_pct = current_p_detected_pct[0]
238
278
  group_2_no_zero_pct = current_p_detected_pct[1]
239
279
 
240
- output_test_handle.write('%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))
280
+ 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[ko_id_list[x]]))
241
281
  x += 1
242
282
  output_test_handle.close()
243
283
 
244
284
  # summarize stats
245
- summarize_stats(stats_op_txt, summary_txt)
285
+ summarize_stats(stats_op_txt, ko_desc_dict, summary_txt)
246
286
 
247
287
  # file report
248
288
  print('Results of enrichment analysis exported to: %s' % summary_txt)
@@ -252,10 +292,11 @@ def enrich(args):
252
292
  if __name__ == '__main__':
253
293
 
254
294
  enrich_parser = argparse.ArgumentParser(usage=enrich_usage)
255
- enrich_parser.add_argument('-i', required=True, help='annotation files')
256
- enrich_parser.add_argument('-x', required=True, help='file extension')
257
- enrich_parser.add_argument('-g', required=True, help='grouping file')
258
- enrich_parser.add_argument('-o', required=True, help='output directory')
259
- enrich_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
295
+ enrich_parser.add_argument('-i', required=True, help='annotation files')
296
+ enrich_parser.add_argument('-x', required=True, help='file extension')
297
+ enrich_parser.add_argument('-g', required=True, help='grouping file')
298
+ enrich_parser.add_argument('-o', required=True, help='output directory')
299
+ enrich_parser.add_argument('-bc', required=False, action="store_true", help='perform Bonferroni correction')
300
+ enrich_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
260
301
  args = vars(enrich_parser.parse_args())
261
302
  enrich(args)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: BioSAK
3
- Version: 1.78.0
3
+ Version: 1.78.3
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.78.0
23
+ BioSAK v1.78.3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: BioSAK
3
- Version: 1.78.0
3
+ Version: 1.78.3
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.78.0
23
+ BioSAK v1.78.3
@@ -875,11 +875,12 @@ if __name__ == '__main__':
875
875
  elif sys.argv[1] == 'enrich':
876
876
  from BioSAK import enrich
877
877
  enrich_parser = subparsers.add_parser('enrich', usage=enrich.enrich_usage)
878
- enrich_parser.add_argument('-i', required=True, help='annotation files')
879
- enrich_parser.add_argument('-x', required=True, help='file extension')
880
- enrich_parser.add_argument('-g', required=True, help='grouping file')
881
- enrich_parser.add_argument('-o', required=True, help='output directory')
882
- enrich_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
878
+ enrich_parser.add_argument('-i', required=True, help='annotation files')
879
+ enrich_parser.add_argument('-x', required=True, help='file extension')
880
+ enrich_parser.add_argument('-g', required=True, help='grouping file')
881
+ enrich_parser.add_argument('-o', required=True, help='output directory')
882
+ enrich_parser.add_argument('-bc', required=False, action="store_true", help='perform Bonferroni correction')
883
+ enrich_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
883
884
  args = vars(parser.parse_args())
884
885
  enrich.enrich(args)
885
886
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes