BioSAK 1.78.2__tar.gz → 1.78.4__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.2 → BioSAK-1.78.4}/BioSAK/COG2020.py +13 -51
  2. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/KEGG.py +4 -4
  3. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/VERSION +1 -1
  4. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/arCOG.py +18 -46
  5. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/dbCAN.py +65 -58
  6. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK.egg-info/PKG-INFO +2 -2
  7. {BioSAK-1.78.2 → BioSAK-1.78.4}/PKG-INFO +2 -2
  8. {BioSAK-1.78.2 → BioSAK-1.78.4}/bin/BioSAK +4 -4
  9. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/BLCA_op_parser.py +0 -0
  10. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/BioSAK_config.py +0 -0
  11. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/COG_boxplot_last1row.R +0 -0
  12. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/COG_boxplot_last2row.R +0 -0
  13. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/CheckM.py +0 -0
  14. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/ConvertMSA.py +0 -0
  15. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/DnaFeaturesViewer.py +0 -0
  16. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/FastaSplitler_by_num.py +0 -0
  17. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/FastaSplitler_by_size.py +0 -0
  18. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/GTDB_for_BLCA.py +0 -0
  19. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/Gene2Ctg.py +0 -0
  20. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/KEGG_boxplot_last1row.R +0 -0
  21. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/KEGG_get_eukaryotic_kos.py +0 -0
  22. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/KeepRemovingTmp.py +0 -0
  23. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/MeanMappingDepth.py +0 -0
  24. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/MetaBiosample.py +0 -0
  25. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/MetaCHIP_phylo.hmm +0 -0
  26. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/MetaCyc_reactions_with_ec.txt +0 -0
  27. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/NetEnzymes.py +0 -0
  28. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/Newick_tree_plotter.py +0 -0
  29. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/OneLineAln.py +0 -0
  30. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/Prodigal.py +0 -0
  31. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/Reads_simulator.py +0 -0
  32. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/RunGraphMB.py +0 -0
  33. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/SILVA_for_BLCA.py +0 -0
  34. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/SankeyTaxon.py +0 -0
  35. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/SliceMSA.py +0 -0
  36. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/SubsampleLongReads.py +0 -0
  37. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/Tax4Fun2IndOTU.py +0 -0
  38. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/VisBlastOp.py +0 -0
  39. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/VisGeneFlk.py +0 -0
  40. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/__init__.py +0 -0
  41. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/bam2reads.py +0 -0
  42. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/boxplot_last1row.R +0 -0
  43. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/boxplot_matrix_COG.py +0 -0
  44. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/boxplot_matrix_COG_backup.py +0 -0
  45. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/boxplot_matrix_KEGG.py +0 -0
  46. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/boxplot_matrix_dbCAN.py +0 -0
  47. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/cat_fa.py +0 -0
  48. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/cdd2cog.pl +0 -0
  49. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/checkm_marker.py +0 -0
  50. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/compare_trees.R +0 -0
  51. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/compare_trees.py +0 -0
  52. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/cross_link_seqs.py +0 -0
  53. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/download_GenBank_genome_subset_prokaryotes_csv.py +0 -0
  54. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/dwnld_sra_reads.py +0 -0
  55. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/enrich.py +0 -0
  56. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/exe_cmds.py +0 -0
  57. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/ezaai2mat.py +0 -0
  58. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/fa2id.py +0 -0
  59. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/fa2phy.py +0 -0
  60. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/fa2tree.py +0 -0
  61. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/format_converter.py +0 -0
  62. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/format_leaf_name.py +0 -0
  63. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/fq2fa.py +0 -0
  64. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/gbk2faa.py +0 -0
  65. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/gbk2ffn.py +0 -0
  66. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/gbk2fna.py +0 -0
  67. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/gbk_to_ffn_faa.py +0 -0
  68. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_EC_from_ko_stats_D.py +0 -0
  69. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_GTDB_taxon_gnm.py +0 -0
  70. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_MAG_reads_long.py +0 -0
  71. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_Pfam_hmms.py +0 -0
  72. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_SCG_tree.py +0 -0
  73. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_TopHits_taxonomy.py +0 -0
  74. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_aa_composition.py +0 -0
  75. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_bin_abundance copy.py +0 -0
  76. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_data_matrix.py +0 -0
  77. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_gc.py +0 -0
  78. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_gene_depth.py +0 -0
  79. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_genome_GTDB.py +0 -0
  80. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_genome_NCBI.py +0 -0
  81. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_genome_NCBI_v1.py +0 -0
  82. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_genome_NCBI_v2.py +0 -0
  83. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_gnm_size.py +0 -0
  84. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_ko_gene_seqs.py +0 -0
  85. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_krona_plot.py +0 -0
  86. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_reads_from_sam.py +0 -0
  87. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_reads_id_in_sam.py +0 -0
  88. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_sankey_plot.R +0 -0
  89. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_top_hit.py +0 -0
  90. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/get_total_length.py +0 -0
  91. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/global_functions.py +0 -0
  92. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/hpc3.py +0 -0
  93. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/iTOL.py +0 -0
  94. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/js_cmds.py +0 -0
  95. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/js_hpc3.py +0 -0
  96. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/keep_best_hit.py +0 -0
  97. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/ko00001.keg +0 -0
  98. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/koala.py +0 -0
  99. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/label_tree.R +0 -0
  100. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/label_tree.py +0 -0
  101. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/link_16S_MAG.py +0 -0
  102. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/magabund.py +0 -0
  103. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/magabund2.py +0 -0
  104. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/manipulator_fasta.py +0 -0
  105. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/manipulator_msa.py +0 -0
  106. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/manipulator_newick.py +0 -0
  107. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/manipulator_sam.py +0 -0
  108. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/mean_MAG_cov.py +0 -0
  109. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/merge_seq.py +0 -0
  110. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/metaAssembly.py +0 -0
  111. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/metabat2concoct.py +0 -0
  112. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/metabat2maxbin.py +0 -0
  113. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/msa_to_distance_matrix.py +0 -0
  114. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/ncbi_dataset.py +0 -0
  115. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/odp.py +0 -0
  116. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/parse_MetaCyc_RxnDB.py +0 -0
  117. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/parse_mmseqs_tsv.py +0 -0
  118. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/plot_mag.py +0 -0
  119. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/plot_sam_depth.py +0 -0
  120. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/plot_tree.R +0 -0
  121. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/prefix_file.py +0 -0
  122. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/prokka.py +0 -0
  123. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/reads2bam.py +0 -0
  124. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/rename_leaves.py +0 -0
  125. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/rename_reads_for_Reago.py +0 -0
  126. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/rename_seq.py +0 -0
  127. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/rename_seqs.py +0 -0
  128. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/ribbon.py +0 -0
  129. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/sam2bam.py +0 -0
  130. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/sampling_GTDB_gnms.py +0 -0
  131. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/select_seq.py +0 -0
  132. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/sep_reads_by_barcode.py +0 -0
  133. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/slice_seq.py +0 -0
  134. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/split_fasta.py +0 -0
  135. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/split_folder.py +0 -0
  136. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/split_sam.py +0 -0
  137. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/submitHPC.py +0 -0
  138. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/subset_GTDB_meta.py +0 -0
  139. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/subset_tree.py +0 -0
  140. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/top_16S_hits.py +0 -0
  141. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/top_hits_in_a_group.py +0 -0
  142. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK/usearch_uc.py +0 -0
  143. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK.egg-info/SOURCES.txt +0 -0
  144. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK.egg-info/dependency_links.txt +0 -0
  145. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK.egg-info/requires.txt +0 -0
  146. {BioSAK-1.78.2 → BioSAK-1.78.4}/BioSAK.egg-info/top_level.txt +0 -0
  147. {BioSAK-1.78.2 → BioSAK-1.78.4}/LICENSE +0 -0
  148. {BioSAK-1.78.2 → BioSAK-1.78.4}/MANIFEST.in +0 -0
  149. {BioSAK-1.78.2 → BioSAK-1.78.4}/README.md +0 -0
  150. {BioSAK-1.78.2 → BioSAK-1.78.4}/setup.cfg +0 -0
  151. {BioSAK-1.78.2 → BioSAK-1.78.4}/setup.py +0 -0
@@ -22,10 +22,10 @@ module load diamond
22
22
 
23
23
  # annotate protein sequences
24
24
  BioSAK COG2020 -m P -t 6 -db_dir path/to/your/COG_db_dir -i genes.faa
25
- BioSAK COG2020 -m P -t 6 -db_dir path/to/your/COG_db_dir -i faa_files -x faa -depth depth_files
25
+ BioSAK COG2020 -m P -t 6 -db_dir path/to/your/COG_db_dir -i faa_files -x faa -d depth_files
26
26
 
27
27
  # annotate DNA sequences (ORFs)
28
- BioSAK COG2020 -m N -t 6 -db_dir path/to/your/COG_db_dir -i genes.ffn -depth gene.depth
28
+ BioSAK COG2020 -m N -t 6 -db_dir path/to/your/COG_db_dir -i genes.ffn -d gene.depth
29
29
  BioSAK COG2020 -m N -t 6 -db_dir path/to/your/COG_db_dir -i ffn_files -x ffn
30
30
 
31
31
  # Prepare DB files (version 2020):
@@ -434,7 +434,7 @@ def COG2020(args):
434
434
  file_in = args['i']
435
435
  file_extension = args['x']
436
436
  sequence_type = args['m']
437
- depth_file = args['depth']
437
+ depth_file = args['d']
438
438
  pct_by_all = args['pct_by_all']
439
439
  DB_dir = args['db_dir']
440
440
  num_threads = args['t']
@@ -447,7 +447,6 @@ def COG2020(args):
447
447
  pwd_cog_20_def_tab = '%s/cog-20.def.tab' % DB_dir
448
448
  pwd_fun_20_tab = '%s/fun-20.tab' % DB_dir
449
449
 
450
-
451
450
  ############################################ check whether db file exist ###########################################
452
451
 
453
452
  # check whether db file exist
@@ -466,7 +465,6 @@ def COG2020(args):
466
465
  print(datetime.now().strftime(time_format) + 'Program exited!')
467
466
  exit()
468
467
 
469
-
470
468
  ################################################# read db into dict ################################################
471
469
 
472
470
  # get protein_to_cog_dict (cog-20.cog.csv)
@@ -502,7 +500,6 @@ def COG2020(args):
502
500
  cog_category_list.append(cog_category_split[0])
503
501
  cog_category_to_description_dict[cog_category_split[0]] = cog_category_split[2]
504
502
 
505
-
506
503
  ################################################## if input is file ################################################
507
504
 
508
505
  # if input is file
@@ -518,32 +515,18 @@ def COG2020(args):
518
515
 
519
516
  file_in_path, file_in_basename, file_in_ext = sep_path_basename_ext(file_in)
520
517
 
521
- COG2020_worker([file_in,
522
- pwd_cog_20_fa,
523
- protein_to_cog_dict,
524
- cog_id_to_category_dict,
525
- cog_id_to_description_dict,
526
- cog_category_list,
527
- cog_category_to_description_dict,
528
- sequence_type,
529
- file_in_path,
530
- num_threads,
531
- run_diamond,
532
- evalue_cutoff,
533
- depth_file,
534
- pct_by_all])
535
-
518
+ COG2020_worker([file_in, pwd_cog_20_fa, protein_to_cog_dict, cog_id_to_category_dict, cog_id_to_description_dict,
519
+ cog_category_list, cog_category_to_description_dict, sequence_type, file_in_path, num_threads,
520
+ run_diamond, evalue_cutoff, depth_file, pct_by_all])
536
521
 
537
522
  ################################################ if input is folder ################################################
538
523
 
539
524
  # if input is folder
540
525
  else:
541
-
542
526
  # check whether input folder exist
543
527
  if os.path.isdir(file_in) is False:
544
528
  print(datetime.now().strftime(time_format) + 'input folder not found, program exited')
545
529
  exit()
546
-
547
530
  else:
548
531
  # check whether input genome exist
549
532
  input_file_re = '%s/*.%s' % (file_in, file_extension)
@@ -566,7 +549,6 @@ def COG2020(args):
566
549
  exit()
567
550
 
568
551
  if os.path.isdir(depth_file) is True:
569
-
570
552
  undetected_depth_file = []
571
553
  for input_seq_file in input_file_name_list:
572
554
  input_seq_file_basename = '.'.join(input_seq_file.split('.')[:-1])
@@ -579,7 +561,6 @@ def COG2020(args):
579
561
  print(','.join(undetected_depth_file))
580
562
  exit()
581
563
 
582
-
583
564
  ################################################### define file name ###################################################
584
565
 
585
566
  if '/' in file_in:
@@ -587,12 +568,10 @@ def COG2020(args):
587
568
  else:
588
569
  file_in_folder_name = file_in
589
570
 
590
- output_folder = '%s_COG2020_wd' % file_in_folder_name
571
+ output_folder = '%s_COG2020_wd' % file_in_folder_name
591
572
 
592
- # create output folder
593
573
  force_create_folder(output_folder)
594
574
 
595
-
596
575
  ######################################################### main #########################################################
597
576
 
598
577
  print(datetime.now().strftime(time_format) + 'Running COG annotation for %s files with %s cores' % (len(input_file_name_list), num_threads))
@@ -603,27 +582,17 @@ def COG2020(args):
603
582
  input_file_basename = '.'.join(input_file.split('.')[:-1])
604
583
  pwd_input_file = '%s/%s' % (file_in, input_file)
605
584
 
606
-
607
585
  # get path to current depth file
608
586
  if depth_file is None:
609
587
  input_file_depth = None
610
588
  else:
611
589
  input_file_depth = '%s/%s.depth' % (depth_file, input_file_basename)
612
590
 
613
- list_for_multiple_arguments_COG.append([pwd_input_file,
614
- pwd_cog_20_fa,
615
- protein_to_cog_dict,
616
- cog_id_to_category_dict,
617
- cog_id_to_description_dict,
618
- cog_category_list,
619
- cog_category_to_description_dict,
620
- sequence_type,
621
- output_folder,
622
- 1,
623
- run_diamond,
624
- evalue_cutoff,
625
- input_file_depth,
626
- pct_by_all])
591
+ list_for_multiple_arguments_COG.append([pwd_input_file, pwd_cog_20_fa, protein_to_cog_dict,
592
+ cog_id_to_category_dict, cog_id_to_description_dict,
593
+ cog_category_list, cog_category_to_description_dict,
594
+ sequence_type, output_folder, 1, run_diamond, evalue_cutoff,
595
+ input_file_depth, pct_by_all])
627
596
 
628
597
  # run COG annotaion files with multiprocessing
629
598
  pool = mp.Pool(processes=num_threads)
@@ -636,15 +605,12 @@ def COG2020(args):
636
605
  annotation_df_cog_cate_GeneNumber = '%s/%s_COG2020_cate_GeneNumber.txt' % (output_folder, file_in_folder_name)
637
606
  annotation_df_cog_cate_GeneNumber_pct = '%s/%s_COG2020_cate_GeneNumber_pct.txt' % (output_folder, file_in_folder_name)
638
607
  annotation_df_cog_cate_GeneNumber_pct_by_all = '%s/%s_COG2020_cate_GeneNumber_pct_by_all.txt' % (output_folder, file_in_folder_name)
639
-
640
608
  annotation_df_cog_cate_TotalDepth = '%s/%s_COG2020_cate_TotalDepth.txt' % (output_folder, file_in_folder_name)
641
609
  annotation_df_cog_cate_TotalDepth_pct = '%s/%s_COG2020_cate_TotalDepth_pct.txt' % (output_folder, file_in_folder_name)
642
610
  annotation_df_cog_cate_TotalDepth_pct_by_all = '%s/%s_COG2020_cate_TotalDepth_pct_by_all.txt' % (output_folder, file_in_folder_name)
643
-
644
611
  annotation_df_cog_id_GeneNumber = '%s/%s_COG2020_id_GeneNumber.txt' % (output_folder, file_in_folder_name)
645
612
  annotation_df_cog_id_GeneNumber_pct = '%s/%s_COG2020_id_GeneNumber_pct.txt' % (output_folder, file_in_folder_name)
646
613
  annotation_df_cog_id_GeneNumber_pct_by_all = '%s/%s_COG2020_id_GeneNumber_pct_by_all.txt' % (output_folder, file_in_folder_name)
647
-
648
614
  annotation_df_cog_id_TotalDepth = '%s/%s_COG2020_id_TotalDepth.txt' % (output_folder, file_in_folder_name)
649
615
  annotation_df_cog_id_TotalDepth_pct = '%s/%s_COG2020_id_TotalDepth_pct.txt' % (output_folder, file_in_folder_name)
650
616
  annotation_df_cog_id_TotalDepth_pct_by_all = '%s/%s_COG2020_id_TotalDepth_pct_by_all.txt' % (output_folder, file_in_folder_name)
@@ -689,18 +655,14 @@ def COG2020(args):
689
655
  if __name__ == '__main__':
690
656
 
691
657
  COG_parser = argparse.ArgumentParser(usage=COG2020_parser_usage)
692
-
693
- # arguments for COG_parser
694
658
  COG_parser.add_argument('-i', required=True, help='path to input sequences (in multi-fasta format)')
695
659
  COG_parser.add_argument('-x', required=False, help='file extension')
696
660
  COG_parser.add_argument('-m', required=True, help='sequence type, "N/n" for "nucleotide", "P/p" for "protein"')
697
- COG_parser.add_argument('-depth', required=False, default=None, help='gene depth file/folder')
661
+ COG_parser.add_argument('-d', required=False, default=None, help='gene depth file/folder')
698
662
  COG_parser.add_argument('-pct_by_all', required=False, action='store_true', help='normalize by all query genes, including those without COG assignment')
699
663
  COG_parser.add_argument('-db_dir', required=True, help='COG_db_dir')
700
664
  COG_parser.add_argument('-diamond', required=False, action='store_true', help='run diamond (for big dataset), default is NCBI blastp')
701
665
  COG_parser.add_argument('-t', required=False, type=int, default=1, help='number of threads')
702
666
  COG_parser.add_argument('-evalue', required=False, default=0.001, type=float, help='evalue cutoff, default: 0.001')
703
-
704
667
  args = vars(COG_parser.parse_args())
705
-
706
668
  COG2020(args)
@@ -18,10 +18,10 @@ KEGG_parser_usage = '''
18
18
  # Dependencies: blast+ or diamond
19
19
 
20
20
  # annotation with NCBI blastp (default, for small dataset)
21
- BioSAK KEGG -db_dir path/to/your/KEGG_db_dir -t 6 -seq_in input.faa -depth input.depth
21
+ BioSAK KEGG -db_dir path/to/your/KEGG_db_dir -t 6 -seq_in input.faa -d input.depth
22
22
 
23
23
  # annotation with Diamond blastp (for big dataset)
24
- BioSAK KEGG -db_dir path/to/your/KEGG_db_dir -t 12 -seq_in faa_folder -x faa -depth depth_files -diamond
24
+ BioSAK KEGG -db_dir path/to/your/KEGG_db_dir -t 12 -seq_in faa_folder -x faa -d depth_files -diamond
25
25
 
26
26
  # get summary for BlastKOALA/GhostKOALA produced results
27
27
  BioSAK KEGG -db_dir path/to/your/KEGG_db_dir -t 9 -ko_in user_ko.txt
@@ -508,7 +508,7 @@ def Annotation_KEGG(args):
508
508
  input_file_faa = args['seq_in']
509
509
  input_file_user_ko = args['ko_in']
510
510
  file_extension = args['x']
511
- depth_file = args['depth']
511
+ depth_file = args['d']
512
512
  pct_by_all = args['pct_by_all']
513
513
  KEGG_DB_folder = args['db_dir']
514
514
  run_diamond = args['diamond']
@@ -797,7 +797,7 @@ if __name__ == "__main__":
797
797
  parser.add_argument('-seq_in', required=False, help='faa file')
798
798
  parser.add_argument('-ko_in', required=False, help='annotation results from BlastKOALA/GhostKOALA, normally with name user_ko.txt')
799
799
  parser.add_argument('-x', required=False, help='file extension')
800
- parser.add_argument('-depth', required=False, default=None, help='gene depth file/folder')
800
+ parser.add_argument('-d', required=False, default=None, help='gene depth file/folder')
801
801
  parser.add_argument('-pct_by_all', required=False, action='store_true', help='normalize by all query genes, rather than those with ko assignment')
802
802
  parser.add_argument('-db_dir', required=True, help='folder holds sequence, seq2ko and ko00001.keg files')
803
803
  parser.add_argument('-diamond', required=False, action='store_true', help='run diamond (for big dataset), default is NCBI blastp')
@@ -1,4 +1,4 @@
1
- 1.78.2
1
+ 1.78.4
2
2
  - fixed bugs
3
3
 
4
4
  1.78.0
@@ -14,12 +14,12 @@ arCOG_parser_usage = '''
14
14
  # Dependencies: blast+, diamond
15
15
 
16
16
  # annotate protein sequences
17
- BioSAK arCOG -m P -t 6 -db_dir /Users/songweizhi/DB/arCOG18 -i genes.faa
18
- BioSAK arCOG -m P -t 6 -db_dir /Users/songweizhi/DB/arCOG18 -i faa_files -x faa -depth depth_files
17
+ BioSAK arCOG -m P -t 6 -db_dir arCOG18_db_dir -i genes.faa
18
+ BioSAK arCOG -m P -t 6 -db_dir arCOG18_db_dir -i faa_files -x faa -d depth_files
19
19
 
20
20
  # annotate DNA sequences (ORFs)
21
- BioSAK arCOG -m N -t 6 -db_dir /Users/songweizhi/DB/arCOG18 -i genes.ffn -depth gene.depth
22
- BioSAK arCOG -m N -t 6 -db_dir /Users/songweizhi/DB/arCOG18 -i ffn_files -x ffn
21
+ BioSAK arCOG -m N -t 6 -db_dir arCOG18_db_dir -i genes.ffn -d gene.depth
22
+ BioSAK arCOG -m N -t 6 -db_dir arCOG18_db_dir -i ffn_files -x ffn
23
23
 
24
24
  # Prepare DB files:
25
25
  cd path/to/your/arCOG_db_dir
@@ -54,12 +54,9 @@ def force_create_folder(folder_to_create):
54
54
 
55
55
  def sep_path_basename_ext(file_in):
56
56
 
57
- # separate path and file name
58
57
  file_path, file_name = os.path.split(file_in)
59
58
  if file_path == '':
60
59
  file_path = '.'
61
-
62
- # separate file basename and extension
63
60
  file_basename, file_ext = os.path.splitext(file_name)
64
61
 
65
62
  return file_path, file_basename, file_ext
@@ -71,20 +68,15 @@ def AnnotateNorm(file_in, skip_header, value_column, Divisor_value, file_out, fi
71
68
  file_out_handle.write(file_out_header)
72
69
  line_num = 0
73
70
  for each_line in open(file_in):
74
-
75
71
  each_line_split = each_line.strip().split('\t')
76
72
  value_str = each_line_split[value_column - 1]
77
-
78
73
  if (skip_header is True and line_num > 0) or (skip_header is False):
79
-
80
74
  value_pct = 0
81
75
  if Divisor_value != 0:
82
76
  value_pct = float(value_str) * 100 / Divisor_value
83
77
  each_line_split[value_column - 1] = str(float("{0:.2f}".format(value_pct)))
84
78
  file_out_handle.write('%s\n' % '\t'.join(each_line_split))
85
-
86
79
  line_num += 1
87
-
88
80
  file_out_handle.close()
89
81
 
90
82
 
@@ -127,11 +119,9 @@ def best_hit(args):
127
119
  best_hit_query_id = query_id
128
120
  best_hit_line = blast_hit
129
121
  best_hit_score = bit_score
130
-
131
122
  elif (query_id == best_hit_query_id) and (bit_score > best_hit_score):
132
123
  best_hit_score = bit_score
133
124
  best_hit_line = blast_hit
134
-
135
125
  elif query_id != best_hit_query_id:
136
126
  file_out_handle.write(best_hit_line)
137
127
  best_hit_query_id = query_id
@@ -165,20 +155,17 @@ def arCOG_worker(argument_list):
165
155
  pwd_blastp_output = '%s/%s_blastp.tab' % (current_output_folder, input_seq_no_ext)
166
156
  pwd_blastp_output_besthits = '%s/%s_blastp_besthits.tab' % (current_output_folder, input_seq_no_ext)
167
157
  pwd_query_to_cog_txt = '%s/%s_query_to_cog.txt' % (current_output_folder, input_seq_no_ext)
168
-
169
- pwd_cog_stats_copy = '%s/%s_arcog_stats_copy.txt' % (current_output_folder, input_seq_no_ext)
158
+ pwd_cog_stats_copy = '%s/%s_arcog_stats.txt' % (current_output_folder, input_seq_no_ext)
170
159
  pwd_cog_stats_depth = '%s/%s_arcog_stats_depth.txt' % (current_output_folder, input_seq_no_ext)
171
- pwd_func_stats_copy = '%s/%s_func_stats_copy.txt' % (current_output_folder, input_seq_no_ext)
160
+ pwd_func_stats_copy = '%s/%s_func_stats.txt' % (current_output_folder, input_seq_no_ext)
172
161
  pwd_func_stats_depth = '%s/%s_func_stats_depth.txt' % (current_output_folder, input_seq_no_ext)
173
-
174
- pwd_cog_stats_copy_pct = '%s/%s_arcog_stats_copy_pct.txt' % (current_output_folder, input_seq_no_ext)
162
+ pwd_cog_stats_copy_pct = '%s/%s_arcog_stats_pct.txt' % (current_output_folder, input_seq_no_ext)
175
163
  pwd_cog_stats_depth_pct = '%s/%s_arcog_stats_depth_pct.txt' % (current_output_folder, input_seq_no_ext)
176
- pwd_func_stats_copy_pct = '%s/%s_func_stats_copy_pct.txt' % (current_output_folder, input_seq_no_ext)
164
+ pwd_func_stats_copy_pct = '%s/%s_func_stats_pct.txt' % (current_output_folder, input_seq_no_ext)
177
165
  pwd_func_stats_depth_pct = '%s/%s_func_stats_depth_pct.txt' % (current_output_folder, input_seq_no_ext)
178
-
179
- pwd_cog_stats_copy_pct_by_all = '%s/%s_arcog_stats_copy_pct_by_all.txt' % (current_output_folder, input_seq_no_ext)
166
+ pwd_cog_stats_copy_pct_by_all = '%s/%s_arcog_stats_pct_by_all.txt' % (current_output_folder, input_seq_no_ext)
180
167
  pwd_cog_stats_depth_pct_by_all = '%s/%s_arcog_stats_depth_pct_by_all.txt' % (current_output_folder, input_seq_no_ext)
181
- pwd_func_stats_copy_pct_by_all = '%s/%s_func_stats_copy_pct_by_all.txt' % (current_output_folder, input_seq_no_ext)
168
+ pwd_func_stats_copy_pct_by_all = '%s/%s_func_stats_pct_by_all.txt' % (current_output_folder, input_seq_no_ext)
182
169
  pwd_func_stats_depth_pct_by_all = '%s/%s_func_stats_depth_pct_by_all.txt' % (current_output_folder, input_seq_no_ext)
183
170
 
184
171
  force_create_folder(current_output_folder)
@@ -211,9 +198,6 @@ def arCOG_worker(argument_list):
211
198
  each_hit_subject_no_dot = '_'.join(each_hit_subject.split('.'))
212
199
  query_to_ref_protein_dict[each_hit_query] = each_hit_subject_no_dot
213
200
 
214
- # print('query_to_ref_protein_dict')
215
- # print(query_to_ref_protein_dict)
216
-
217
201
  # get query sequences list
218
202
  query_seq_list = []
219
203
  for query_seq in SeqIO.parse(pwd_input_file, 'fasta'):
@@ -221,8 +205,8 @@ def arCOG_worker(argument_list):
221
205
 
222
206
  # export annotation
223
207
  cog_id_num_dict = {}
224
- cog_id_to_gene_member_dict = {}
225
208
  cog_cate_num_dict = {}
209
+ cog_id_to_gene_member_dict = {}
226
210
  cog_cate_to_gene_member_dict = {}
227
211
  genes_with_cog = set()
228
212
  pwd_query_to_cog_txt_handle = open(pwd_query_to_cog_txt, 'w')
@@ -357,9 +341,9 @@ def get_COG_annot_df(annotation_dir, stats_level, annotation_df_absolute_num, an
357
341
  pwd_annotation_stats_file_pct = ''
358
342
  if stats_level == 'cog_id':
359
343
  if with_depth is False:
360
- pwd_annotation_stats_file = '%s/%s/%s_arcog_stats_copy.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
361
- pwd_annotation_stats_file_pct = '%s/%s/%s_arcog_stats_copy_pct.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
362
- pwd_annotation_stats_file_pct_by_all = '%s/%s/%s_arcog_stats_copy_pct_by_all.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
344
+ pwd_annotation_stats_file = '%s/%s/%s_arcog_stats.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
345
+ pwd_annotation_stats_file_pct = '%s/%s/%s_arcog_stats_pct.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
346
+ pwd_annotation_stats_file_pct_by_all = '%s/%s/%s_arcog_stats_pct_by_all.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
363
347
  else:
364
348
  pwd_annotation_stats_file = '%s/%s/%s_arcog_stats_depth.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
365
349
  pwd_annotation_stats_file_pct = '%s/%s/%s_arcog_stats_depth_pct.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
@@ -367,9 +351,9 @@ def get_COG_annot_df(annotation_dir, stats_level, annotation_df_absolute_num, an
367
351
 
368
352
  if stats_level == 'cog_cate':
369
353
  if with_depth is False:
370
- pwd_annotation_stats_file = '%s/%s/%s_func_stats_copy.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
371
- pwd_annotation_stats_file_pct = '%s/%s/%s_func_stats_copy_pct.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
372
- pwd_annotation_stats_file_pct_by_all = '%s/%s/%s_func_stats_copy_pct_by_all.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
354
+ pwd_annotation_stats_file = '%s/%s/%s_func_stats.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
355
+ pwd_annotation_stats_file_pct = '%s/%s/%s_func_stats_pct.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
356
+ pwd_annotation_stats_file_pct_by_all = '%s/%s/%s_func_stats_pct_by_all.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
373
357
  else:
374
358
  pwd_annotation_stats_file = '%s/%s/%s_func_stats_depth.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
375
359
  pwd_annotation_stats_file_pct = '%s/%s/%s_func_stats_depth_pct.txt' % (annotation_dir, annotation_folder, annotation_folder_basename)
@@ -410,7 +394,6 @@ def get_COG_annot_df(annotation_dir, stats_level, annotation_df_absolute_num, an
410
394
  annotation_df_absolute_num_handle.write('\t%s\n' % '\t'.join(all_identified_cog_list))
411
395
  annotation_df_percentage_handle.write('\t%s\n' % '\t'.join(all_identified_cog_list))
412
396
  for annotation_folder in sorted(annotation_folder_list):
413
-
414
397
  annotation_folder_basename = annotation_folder.split('_arCOG_wd')[0]
415
398
  current_cog_num_dict = cog_num_dict[annotation_folder_basename]
416
399
  current_cog_num_pct_dict = cog_num_pct_dict[annotation_folder_basename]
@@ -441,23 +424,18 @@ def get_COG_annot_df(annotation_dir, stats_level, annotation_df_absolute_num, an
441
424
  annotation_df_percentage_by_all_handle = open(annotation_df_percentage_by_all, 'w')
442
425
  annotation_df_percentage_by_all_handle.write('\t%s\n' % '\t'.join(all_identified_cog_list))
443
426
  for annotation_folder in sorted(annotation_folder_list):
444
-
445
427
  annotation_folder_basename = annotation_folder.split('_arCOG_wd')[0]
446
428
  current_cog_num_pct_by_all_dict = cog_num_pct_by_all_dict[annotation_folder_basename]
447
429
 
448
430
  current_cog_num_list_pct_by_all = []
449
431
  for identified_cog in all_identified_cog_list:
450
-
451
- # get num list
452
432
  identified_cog_num_pct_by_all = 0
453
433
  if identified_cog in current_cog_num_pct_by_all_dict:
454
434
  identified_cog_num_pct_by_all = current_cog_num_pct_by_all_dict[identified_cog]
455
-
456
435
  current_cog_num_list_pct_by_all.append(identified_cog_num_pct_by_all)
457
436
 
458
437
  # write out
459
438
  annotation_df_percentage_by_all_handle.write('%s\t%s\n' % (annotation_folder_basename, '\t'.join([str(i) for i in current_cog_num_list_pct_by_all])))
460
-
461
439
  annotation_df_percentage_by_all_handle.close()
462
440
 
463
441
 
@@ -555,12 +533,10 @@ def arCOG(args):
555
533
 
556
534
  # if input is folder
557
535
  else:
558
- # check whether input folder exist
559
536
  if os.path.isdir(file_in) is False:
560
537
  print(datetime.now().strftime(time_format) + 'input folder not found, program exited')
561
538
  exit()
562
539
  else:
563
- # check whether input genome exist
564
540
  input_file_re = '%s/*.%s' % (file_in, file_extension)
565
541
  input_file_name_list = [os.path.basename(file_name) for file_name in glob.glob(input_file_re)]
566
542
 
@@ -610,7 +586,6 @@ def arCOG(args):
610
586
 
611
587
  list_for_multiple_arguments_COG = []
612
588
  for input_file in input_file_name_list:
613
-
614
589
  input_file_basename = '.'.join(input_file.split('.')[:-1])
615
590
  pwd_input_file = '%s/%s' % (file_in, input_file)
616
591
 
@@ -637,15 +612,12 @@ def arCOG(args):
637
612
  annotation_df_cog_cate_copy = '%s/%s_arCOG_cate.txt' % (output_folder, file_in_folder_name)
638
613
  annotation_df_cog_cate_copy_pct = '%s/%s_arCOG_cate_pct.txt' % (output_folder, file_in_folder_name)
639
614
  annotation_df_cog_cate_copy_pct_by_all = '%s/%s_arCOG_cate_pct_by_all.txt' % (output_folder, file_in_folder_name)
640
-
641
615
  annotation_df_cog_cate_depth = '%s/%s_arCOG_cate_depth.txt' % (output_folder, file_in_folder_name)
642
616
  annotation_df_cog_cate_depth_pct = '%s/%s_arCOG_cate_depth_pct.txt' % (output_folder, file_in_folder_name)
643
617
  annotation_df_cog_cate_depth_pct_by_all = '%s/%s_arCOG_cate_depth_pct_by_all.txt' % (output_folder, file_in_folder_name)
644
-
645
618
  annotation_df_cog_id_copy = '%s/%s_arCOG_id.txt' % (output_folder, file_in_folder_name)
646
619
  annotation_df_cog_id_copy_pct = '%s/%s_arCOG_id_pct.txt' % (output_folder, file_in_folder_name)
647
620
  annotation_df_cog_id_copy_pct_by_all = '%s/%s_arCOG_id_pct_by_all.txt' % (output_folder, file_in_folder_name)
648
-
649
621
  annotation_df_cog_id_depth = '%s/%s_arCOG_id_depth.txt' % (output_folder, file_in_folder_name)
650
622
  annotation_df_cog_id_depth_pct = '%s/%s_arCOG_id_depth_pct.txt' % (output_folder, file_in_folder_name)
651
623
  annotation_df_cog_id_depth_pct_by_all = '%s/%s_arCOG_id_depth_pct_by_all.txt' % (output_folder, file_in_folder_name)
@@ -693,7 +665,7 @@ if __name__ == '__main__':
693
665
  COG_parser.add_argument('-i', required=True, help='path to input sequences (in multi-fasta format)')
694
666
  COG_parser.add_argument('-x', required=False, help='file extension')
695
667
  COG_parser.add_argument('-m', required=True, help='sequence type, "N/n" for "nucleotide", "P/p" for "protein"')
696
- COG_parser.add_argument('-depth', required=False, default=None, help='gene depth file/folder')
668
+ COG_parser.add_argument('-d', required=False, default=None, help='gene depth file/folder')
697
669
  COG_parser.add_argument('-pct_by_all', required=False, action='store_true', help='normalize by all query genes, including those without annotation')
698
670
  COG_parser.add_argument('-db_dir', required=True, help='COG_db_dir')
699
671
  COG_parser.add_argument('-diamond', required=False, action='store_true', help='run diamond (for big dataset), default: blastp from NCBI')
@@ -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 dbCAN_db_v12 -i recipient.faa
17
+ BioSAK dbCAN -m P -t 6 -db_dir dbCAN_db_v12 -i faa_files -x faa
18
+
19
+ # Prepare DB files (v12):
20
+ cd dbCAN_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]
@@ -293,7 +306,7 @@ def dbCAN(args):
293
306
  file_in = args['i']
294
307
  file_extension = args['x']
295
308
  sequence_type = args['m']
296
- depth_file = args['depth']
309
+ depth_file = args['d']
297
310
  DB_dir = args['db_dir']
298
311
  num_threads = args['t']
299
312
 
@@ -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
- dbCAN_parser.add_argument('-depth', required=False, default=None, help='gene depth file/folder')
464
+ dbCAN_parser.add_argument('-d', 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)