miga-base 0.7.26.0 → 0.7.26.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. data/lib/miga/version.rb +1 -1
  3. data/utils/FastAAI/00.Libraries/01.SCG_HMMs/Archaea_SCG.hmm +41964 -0
  4. data/utils/FastAAI/00.Libraries/01.SCG_HMMs/Bacteria_SCG.hmm +32439 -0
  5. data/utils/FastAAI/00.Libraries/01.SCG_HMMs/Complete_SCG_DB.hmm +62056 -0
  6. data/utils/FastAAI/FastAAI/FastAAI +1336 -0
  7. data/utils/FastAAI/README.md +84 -0
  8. data/utils/FastAAI/kAAI_v1.0_virus.py +1296 -0
  9. data/utils/enveomics/Docs/recplot2.md +244 -0
  10. data/utils/enveomics/Examples/aai-matrix.bash +66 -0
  11. data/utils/enveomics/Examples/ani-matrix.bash +66 -0
  12. data/utils/enveomics/Examples/essential-phylogeny.bash +105 -0
  13. data/utils/enveomics/Examples/unus-genome-phylogeny.bash +100 -0
  14. data/utils/enveomics/LICENSE.txt +73 -0
  15. data/utils/enveomics/Makefile +52 -0
  16. data/utils/enveomics/Manifest/Tasks/aasubs.json +103 -0
  17. data/utils/enveomics/Manifest/Tasks/blasttab.json +786 -0
  18. data/utils/enveomics/Manifest/Tasks/distances.json +161 -0
  19. data/utils/enveomics/Manifest/Tasks/fasta.json +766 -0
  20. data/utils/enveomics/Manifest/Tasks/fastq.json +243 -0
  21. data/utils/enveomics/Manifest/Tasks/graphics.json +126 -0
  22. data/utils/enveomics/Manifest/Tasks/mapping.json +67 -0
  23. data/utils/enveomics/Manifest/Tasks/ogs.json +382 -0
  24. data/utils/enveomics/Manifest/Tasks/other.json +829 -0
  25. data/utils/enveomics/Manifest/Tasks/remote.json +355 -0
  26. data/utils/enveomics/Manifest/Tasks/sequence-identity.json +501 -0
  27. data/utils/enveomics/Manifest/Tasks/tables.json +308 -0
  28. data/utils/enveomics/Manifest/Tasks/trees.json +68 -0
  29. data/utils/enveomics/Manifest/Tasks/variants.json +111 -0
  30. data/utils/enveomics/Manifest/categories.json +156 -0
  31. data/utils/enveomics/Manifest/examples.json +154 -0
  32. data/utils/enveomics/Manifest/tasks.json +4 -0
  33. data/utils/enveomics/Pipelines/assembly.pbs/CONFIG.mock.bash +69 -0
  34. data/utils/enveomics/Pipelines/assembly.pbs/FastA.N50.pl +1 -0
  35. data/utils/enveomics/Pipelines/assembly.pbs/FastA.filterN.pl +1 -0
  36. data/utils/enveomics/Pipelines/assembly.pbs/FastA.length.pl +1 -0
  37. data/utils/enveomics/Pipelines/assembly.pbs/README.md +189 -0
  38. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-2.bash +112 -0
  39. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-3.bash +23 -0
  40. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-4.bash +44 -0
  41. data/utils/enveomics/Pipelines/assembly.pbs/RUNME.bash +50 -0
  42. data/utils/enveomics/Pipelines/assembly.pbs/kSelector.R +37 -0
  43. data/utils/enveomics/Pipelines/assembly.pbs/newbler.pbs +68 -0
  44. data/utils/enveomics/Pipelines/assembly.pbs/newbler_preparator.pl +49 -0
  45. data/utils/enveomics/Pipelines/assembly.pbs/soap.pbs +80 -0
  46. data/utils/enveomics/Pipelines/assembly.pbs/stats.pbs +57 -0
  47. data/utils/enveomics/Pipelines/assembly.pbs/velvet.pbs +63 -0
  48. data/utils/enveomics/Pipelines/blast.pbs/01.pbs.bash +38 -0
  49. data/utils/enveomics/Pipelines/blast.pbs/02.pbs.bash +73 -0
  50. data/utils/enveomics/Pipelines/blast.pbs/03.pbs.bash +21 -0
  51. data/utils/enveomics/Pipelines/blast.pbs/BlastTab.recover_job.pl +72 -0
  52. data/utils/enveomics/Pipelines/blast.pbs/CONFIG.mock.bash +98 -0
  53. data/utils/enveomics/Pipelines/blast.pbs/FastA.split.pl +1 -0
  54. data/utils/enveomics/Pipelines/blast.pbs/README.md +127 -0
  55. data/utils/enveomics/Pipelines/blast.pbs/RUNME.bash +109 -0
  56. data/utils/enveomics/Pipelines/blast.pbs/TASK.check.bash +128 -0
  57. data/utils/enveomics/Pipelines/blast.pbs/TASK.dry.bash +16 -0
  58. data/utils/enveomics/Pipelines/blast.pbs/TASK.eo.bash +22 -0
  59. data/utils/enveomics/Pipelines/blast.pbs/TASK.pause.bash +26 -0
  60. data/utils/enveomics/Pipelines/blast.pbs/TASK.run.bash +89 -0
  61. data/utils/enveomics/Pipelines/blast.pbs/sentinel.pbs.bash +29 -0
  62. data/utils/enveomics/Pipelines/idba.pbs/README.md +49 -0
  63. data/utils/enveomics/Pipelines/idba.pbs/RUNME.bash +95 -0
  64. data/utils/enveomics/Pipelines/idba.pbs/run.pbs +56 -0
  65. data/utils/enveomics/Pipelines/trim.pbs/README.md +54 -0
  66. data/utils/enveomics/Pipelines/trim.pbs/RUNME.bash +70 -0
  67. data/utils/enveomics/Pipelines/trim.pbs/run.pbs +130 -0
  68. data/utils/enveomics/README.md +42 -0
  69. data/utils/enveomics/Scripts/AAsubs.log2ratio.rb +171 -0
  70. data/utils/enveomics/Scripts/Aln.cat.rb +163 -0
  71. data/utils/enveomics/Scripts/Aln.convert.pl +35 -0
  72. data/utils/enveomics/Scripts/AlphaDiversity.pl +152 -0
  73. data/utils/enveomics/Scripts/BedGraph.tad.rb +93 -0
  74. data/utils/enveomics/Scripts/BedGraph.window.rb +71 -0
  75. data/utils/enveomics/Scripts/BlastPairwise.AAsubs.pl +102 -0
  76. data/utils/enveomics/Scripts/BlastTab.addlen.rb +63 -0
  77. data/utils/enveomics/Scripts/BlastTab.advance.bash +48 -0
  78. data/utils/enveomics/Scripts/BlastTab.best_hit_sorted.pl +55 -0
  79. data/utils/enveomics/Scripts/BlastTab.catsbj.pl +104 -0
  80. data/utils/enveomics/Scripts/BlastTab.cogCat.rb +76 -0
  81. data/utils/enveomics/Scripts/BlastTab.filter.pl +47 -0
  82. data/utils/enveomics/Scripts/BlastTab.kegg_pep2path_rest.pl +194 -0
  83. data/utils/enveomics/Scripts/BlastTab.metaxaPrep.pl +104 -0
  84. data/utils/enveomics/Scripts/BlastTab.pairedHits.rb +157 -0
  85. data/utils/enveomics/Scripts/BlastTab.recplot2.R +48 -0
  86. data/utils/enveomics/Scripts/BlastTab.seqdepth.pl +86 -0
  87. data/utils/enveomics/Scripts/BlastTab.seqdepth_ZIP.pl +119 -0
  88. data/utils/enveomics/Scripts/BlastTab.seqdepth_nomedian.pl +86 -0
  89. data/utils/enveomics/Scripts/BlastTab.subsample.pl +47 -0
  90. data/utils/enveomics/Scripts/BlastTab.sumPerHit.pl +114 -0
  91. data/utils/enveomics/Scripts/BlastTab.taxid2taxrank.pl +90 -0
  92. data/utils/enveomics/Scripts/BlastTab.topHits_sorted.rb +101 -0
  93. data/utils/enveomics/Scripts/Chao1.pl +97 -0
  94. data/utils/enveomics/Scripts/CharTable.classify.rb +234 -0
  95. data/utils/enveomics/Scripts/EBIseq2tax.rb +83 -0
  96. data/utils/enveomics/Scripts/FastA.N50.pl +56 -0
  97. data/utils/enveomics/Scripts/FastA.extract.rb +152 -0
  98. data/utils/enveomics/Scripts/FastA.filter.pl +52 -0
  99. data/utils/enveomics/Scripts/FastA.filterLen.pl +28 -0
  100. data/utils/enveomics/Scripts/FastA.filterN.pl +60 -0
  101. data/utils/enveomics/Scripts/FastA.fragment.rb +92 -0
  102. data/utils/enveomics/Scripts/FastA.gc.pl +42 -0
  103. data/utils/enveomics/Scripts/FastA.interpose.pl +93 -0
  104. data/utils/enveomics/Scripts/FastA.length.pl +38 -0
  105. data/utils/enveomics/Scripts/FastA.mask.rb +89 -0
  106. data/utils/enveomics/Scripts/FastA.per_file.pl +36 -0
  107. data/utils/enveomics/Scripts/FastA.qlen.pl +57 -0
  108. data/utils/enveomics/Scripts/FastA.rename.pl +65 -0
  109. data/utils/enveomics/Scripts/FastA.revcom.pl +23 -0
  110. data/utils/enveomics/Scripts/FastA.sample.rb +83 -0
  111. data/utils/enveomics/Scripts/FastA.slider.pl +85 -0
  112. data/utils/enveomics/Scripts/FastA.split.pl +55 -0
  113. data/utils/enveomics/Scripts/FastA.split.rb +79 -0
  114. data/utils/enveomics/Scripts/FastA.subsample.pl +131 -0
  115. data/utils/enveomics/Scripts/FastA.tag.rb +65 -0
  116. data/utils/enveomics/Scripts/FastA.wrap.rb +48 -0
  117. data/utils/enveomics/Scripts/FastQ.filter.pl +54 -0
  118. data/utils/enveomics/Scripts/FastQ.interpose.pl +90 -0
  119. data/utils/enveomics/Scripts/FastQ.offset.pl +90 -0
  120. data/utils/enveomics/Scripts/FastQ.split.pl +53 -0
  121. data/utils/enveomics/Scripts/FastQ.tag.rb +63 -0
  122. data/utils/enveomics/Scripts/FastQ.test-error.rb +81 -0
  123. data/utils/enveomics/Scripts/FastQ.toFastA.awk +24 -0
  124. data/utils/enveomics/Scripts/GFF.catsbj.pl +127 -0
  125. data/utils/enveomics/Scripts/GenBank.add_fields.rb +84 -0
  126. data/utils/enveomics/Scripts/HMM.essential.rb +351 -0
  127. data/utils/enveomics/Scripts/HMM.haai.rb +168 -0
  128. data/utils/enveomics/Scripts/HMMsearch.extractIds.rb +83 -0
  129. data/utils/enveomics/Scripts/JPlace.distances.rb +88 -0
  130. data/utils/enveomics/Scripts/JPlace.to_iToL.rb +320 -0
  131. data/utils/enveomics/Scripts/M5nr.getSequences.rb +81 -0
  132. data/utils/enveomics/Scripts/MeTaxa.distribution.pl +198 -0
  133. data/utils/enveomics/Scripts/MyTaxa.fragsByTax.pl +35 -0
  134. data/utils/enveomics/Scripts/MyTaxa.seq-taxrank.rb +49 -0
  135. data/utils/enveomics/Scripts/NCBIacc2tax.rb +92 -0
  136. data/utils/enveomics/Scripts/Newick.autoprune.R +27 -0
  137. data/utils/enveomics/Scripts/RAxML-EPA.to_iToL.pl +228 -0
  138. data/utils/enveomics/Scripts/RecPlot2.compareIdentities.R +32 -0
  139. data/utils/enveomics/Scripts/RefSeq.download.bash +48 -0
  140. data/utils/enveomics/Scripts/SRA.download.bash +57 -0
  141. data/utils/enveomics/Scripts/TRIBS.plot-test.R +36 -0
  142. data/utils/enveomics/Scripts/TRIBS.test.R +39 -0
  143. data/utils/enveomics/Scripts/Table.barplot.R +31 -0
  144. data/utils/enveomics/Scripts/Table.df2dist.R +30 -0
  145. data/utils/enveomics/Scripts/Table.filter.pl +61 -0
  146. data/utils/enveomics/Scripts/Table.merge.pl +77 -0
  147. data/utils/enveomics/Scripts/Table.replace.rb +69 -0
  148. data/utils/enveomics/Scripts/Table.round.rb +63 -0
  149. data/utils/enveomics/Scripts/Table.split.pl +57 -0
  150. data/utils/enveomics/Scripts/Taxonomy.silva2ncbi.rb +227 -0
  151. data/utils/enveomics/Scripts/VCF.KaKs.rb +147 -0
  152. data/utils/enveomics/Scripts/VCF.SNPs.rb +88 -0
  153. data/utils/enveomics/Scripts/aai.rb +418 -0
  154. data/utils/enveomics/Scripts/ani.rb +362 -0
  155. data/utils/enveomics/Scripts/clust.rand.rb +102 -0
  156. data/utils/enveomics/Scripts/gi2tax.rb +103 -0
  157. data/utils/enveomics/Scripts/in_silico_GA_GI.pl +96 -0
  158. data/utils/enveomics/Scripts/lib/data/dupont_2012_essential.hmm.gz +0 -0
  159. data/utils/enveomics/Scripts/lib/data/lee_2019_essential.hmm.gz +0 -0
  160. data/utils/enveomics/Scripts/lib/enveomics.R +1 -0
  161. data/utils/enveomics/Scripts/lib/enveomics_rb/enveomics.rb +24 -0
  162. data/utils/enveomics/Scripts/lib/enveomics_rb/jplace.rb +253 -0
  163. data/utils/enveomics/Scripts/lib/enveomics_rb/og.rb +182 -0
  164. data/utils/enveomics/Scripts/lib/enveomics_rb/remote_data.rb +74 -0
  165. data/utils/enveomics/Scripts/lib/enveomics_rb/seq_range.rb +237 -0
  166. data/utils/enveomics/Scripts/lib/enveomics_rb/stat.rb +30 -0
  167. data/utils/enveomics/Scripts/lib/enveomics_rb/vcf.rb +135 -0
  168. data/utils/enveomics/Scripts/ogs.annotate.rb +88 -0
  169. data/utils/enveomics/Scripts/ogs.core-pan.rb +160 -0
  170. data/utils/enveomics/Scripts/ogs.extract.rb +125 -0
  171. data/utils/enveomics/Scripts/ogs.mcl.rb +186 -0
  172. data/utils/enveomics/Scripts/ogs.rb +104 -0
  173. data/utils/enveomics/Scripts/ogs.stats.rb +131 -0
  174. data/utils/enveomics/Scripts/rbm.rb +146 -0
  175. data/utils/enveomics/Tests/Makefile +10 -0
  176. data/utils/enveomics/Tests/Mgen_M2288.faa +3189 -0
  177. data/utils/enveomics/Tests/Mgen_M2288.fna +8282 -0
  178. data/utils/enveomics/Tests/Mgen_M2321.fna +8288 -0
  179. data/utils/enveomics/Tests/Nequ_Kin4M.faa +2970 -0
  180. data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.tribs.Rdata +0 -0
  181. data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.txt +7 -0
  182. data/utils/enveomics/Tests/Xanthomonas_oryzae.aai-mat.tsv +17 -0
  183. data/utils/enveomics/Tests/Xanthomonas_oryzae.aai.tsv +137 -0
  184. data/utils/enveomics/Tests/a_mg.cds-go.blast.tsv +123 -0
  185. data/utils/enveomics/Tests/a_mg.reads-cds.blast.tsv +200 -0
  186. data/utils/enveomics/Tests/a_mg.reads-cds.counts.tsv +55 -0
  187. data/utils/enveomics/Tests/alkB.nwk +1 -0
  188. data/utils/enveomics/Tests/anthrax-cansnp-data.tsv +13 -0
  189. data/utils/enveomics/Tests/anthrax-cansnp-key.tsv +17 -0
  190. data/utils/enveomics/Tests/hiv1.faa +59 -0
  191. data/utils/enveomics/Tests/hiv1.fna +134 -0
  192. data/utils/enveomics/Tests/hiv2.faa +70 -0
  193. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv +233 -0
  194. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.lim +1 -0
  195. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.rec +233 -0
  196. data/utils/enveomics/Tests/phyla_counts.tsv +10 -0
  197. data/utils/enveomics/Tests/primate_lentivirus.ogs +11 -0
  198. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv1.rbm +9 -0
  199. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv2.rbm +8 -0
  200. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-siv.rbm +6 -0
  201. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-hiv2.rbm +9 -0
  202. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-siv.rbm +6 -0
  203. data/utils/enveomics/Tests/primate_lentivirus.rbm/siv-siv.rbm +6 -0
  204. data/utils/enveomics/build_enveomics_r.bash +45 -0
  205. data/utils/enveomics/enveomics.R/DESCRIPTION +31 -0
  206. data/utils/enveomics/enveomics.R/NAMESPACE +39 -0
  207. data/utils/enveomics/enveomics.R/R/autoprune.R +155 -0
  208. data/utils/enveomics/enveomics.R/R/barplot.R +184 -0
  209. data/utils/enveomics/enveomics.R/R/cliopts.R +135 -0
  210. data/utils/enveomics/enveomics.R/R/df2dist.R +154 -0
  211. data/utils/enveomics/enveomics.R/R/growthcurve.R +331 -0
  212. data/utils/enveomics/enveomics.R/R/recplot.R +354 -0
  213. data/utils/enveomics/enveomics.R/R/recplot2.R +1631 -0
  214. data/utils/enveomics/enveomics.R/R/tribs.R +583 -0
  215. data/utils/enveomics/enveomics.R/R/utils.R +50 -0
  216. data/utils/enveomics/enveomics.R/README.md +80 -0
  217. data/utils/enveomics/enveomics.R/data/growth.curves.rda +0 -0
  218. data/utils/enveomics/enveomics.R/data/phyla.counts.rda +0 -0
  219. data/utils/enveomics/enveomics.R/man/cash-enve.GrowthCurve-method.Rd +17 -0
  220. data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2-method.Rd +17 -0
  221. data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2.Peak-method.Rd +17 -0
  222. data/utils/enveomics/enveomics.R/man/enve.GrowthCurve-class.Rd +25 -0
  223. data/utils/enveomics/enveomics.R/man/enve.TRIBS-class.Rd +46 -0
  224. data/utils/enveomics/enveomics.R/man/enve.TRIBS.merge.Rd +23 -0
  225. data/utils/enveomics/enveomics.R/man/enve.TRIBStest-class.Rd +47 -0
  226. data/utils/enveomics/enveomics.R/man/enve.__prune.iter.Rd +23 -0
  227. data/utils/enveomics/enveomics.R/man/enve.__prune.reduce.Rd +23 -0
  228. data/utils/enveomics/enveomics.R/man/enve.__tribs.Rd +32 -0
  229. data/utils/enveomics/enveomics.R/man/enve.barplot.Rd +91 -0
  230. data/utils/enveomics/enveomics.R/man/enve.cliopts.Rd +57 -0
  231. data/utils/enveomics/enveomics.R/man/enve.col.alpha.Rd +24 -0
  232. data/utils/enveomics/enveomics.R/man/enve.col2alpha.Rd +19 -0
  233. data/utils/enveomics/enveomics.R/man/enve.df2dist.Rd +39 -0
  234. data/utils/enveomics/enveomics.R/man/enve.df2dist.group.Rd +38 -0
  235. data/utils/enveomics/enveomics.R/man/enve.df2dist.list.Rd +40 -0
  236. data/utils/enveomics/enveomics.R/man/enve.growthcurve.Rd +67 -0
  237. data/utils/enveomics/enveomics.R/man/enve.prune.dist.Rd +37 -0
  238. data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +122 -0
  239. data/utils/enveomics/enveomics.R/man/enve.recplot2-class.Rd +45 -0
  240. data/utils/enveomics/enveomics.R/man/enve.recplot2.ANIr.Rd +24 -0
  241. data/utils/enveomics/enveomics.R/man/enve.recplot2.Rd +68 -0
  242. data/utils/enveomics/enveomics.R/man/enve.recplot2.__counts.Rd +25 -0
  243. data/utils/enveomics/enveomics.R/man/enve.recplot2.__peakHist.Rd +21 -0
  244. data/utils/enveomics/enveomics.R/man/enve.recplot2.__whichClosestPeak.Rd +19 -0
  245. data/utils/enveomics/enveomics.R/man/enve.recplot2.changeCutoff.Rd +19 -0
  246. data/utils/enveomics/enveomics.R/man/enve.recplot2.compareIdentities.Rd +41 -0
  247. data/utils/enveomics/enveomics.R/man/enve.recplot2.coordinates.Rd +29 -0
  248. data/utils/enveomics/enveomics.R/man/enve.recplot2.corePeak.Rd +18 -0
  249. data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +40 -0
  250. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.Rd +36 -0
  251. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_e.Rd +19 -0
  252. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_m.Rd +19 -0
  253. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__emauto_one.Rd +27 -0
  254. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mow_one.Rd +41 -0
  255. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mower.Rd +17 -0
  256. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.em.Rd +43 -0
  257. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.emauto.Rd +37 -0
  258. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.mower.Rd +74 -0
  259. data/utils/enveomics/enveomics.R/man/enve.recplot2.peak-class.Rd +59 -0
  260. data/utils/enveomics/enveomics.R/man/enve.recplot2.seqdepth.Rd +27 -0
  261. data/utils/enveomics/enveomics.R/man/enve.recplot2.windowDepthThreshold.Rd +32 -0
  262. data/utils/enveomics/enveomics.R/man/enve.tribs.Rd +59 -0
  263. data/utils/enveomics/enveomics.R/man/enve.tribs.test.Rd +28 -0
  264. data/utils/enveomics/enveomics.R/man/enve.truncate.Rd +27 -0
  265. data/utils/enveomics/enveomics.R/man/growth.curves.Rd +14 -0
  266. data/utils/enveomics/enveomics.R/man/phyla.counts.Rd +13 -0
  267. data/utils/enveomics/enveomics.R/man/plot.enve.GrowthCurve.Rd +63 -0
  268. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBS.Rd +38 -0
  269. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBStest.Rd +38 -0
  270. data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +111 -0
  271. data/utils/enveomics/enveomics.R/man/summary.enve.GrowthCurve.Rd +19 -0
  272. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBS.Rd +19 -0
  273. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBStest.Rd +19 -0
  274. data/utils/enveomics/globals.mk +8 -0
  275. data/utils/enveomics/manifest.json +9 -0
  276. metadata +277 -4
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # @author: Luis M. Rodriguez-R
5
+ # @update: Feb-06-2015
6
+ # @license: artistic license 2.0
7
+ #
8
+
9
+ require 'optparse'
10
+ require 'rubygems'
11
+ require 'restclient'
12
+ require 'open-uri'
13
+ require 'JSON'
14
+
15
+ o = {:q=>FALSE, :url=>'http://api.metagenomics.anl.gov/m5nr', :max=>0, :recover=>FALSE}
16
+ ARGV << '-h' if ARGV.size==0
17
+ OptionParser.new do |opts|
18
+ opts.banner = "
19
+ Downloads a set of sequences from M5nr with a given functional annotation.
20
+
21
+ Usage: #{$0} [options]"
22
+ opts.separator ""
23
+ opts.separator "Mandatory"
24
+ opts.on("-f", "--function STR", "Functional annotation."){ |v| o[:function] = v }
25
+ opts.separator ""
26
+ opts.separator "Options"
27
+ opts.on("-m", "--max INT", "Maximum number of sequences to download. By default: all (0)."){ |v| o[:max] = v.to_i }
28
+ opts.on("-r", "--recover", "If set, tries to recover a previous FastA."){ o[:recover]=TRUE }
29
+ opts.on("-n", "--url STR", "URL for M5nr API. By default: #{o[:url]}."){ |v| o[:url] = v }
30
+ opts.on("-o", "--out FILE", "File containing the sequences. By default: value of -f appended with .fa."){ |v| o[:out] = v }
31
+ opts.on("-q", "--quiet", "Run quietly (no STDERR output)"){ o[:q] = TRUE }
32
+ opts.on("-h", "--help", "Display this screen") do
33
+ puts opts
34
+ exit
35
+ end
36
+ opts.separator ""
37
+ end.parse!
38
+ abort "-f is mandatory" if o[:function].nil?
39
+ o[:out] = "#{o[:function].gsub(/ /,'_')}.fa" if o[:out].nil?
40
+ uri_fun = URI::encode(o[:function])
41
+
42
+ ignore = {}
43
+ if o[:recover] and File.exists? o[:out]
44
+ ih = File.open(o[:out], "r")
45
+ ih.each_line do |ln|
46
+ id = /^>(\S+)\s/.match(ln)
47
+ unless id.nil?
48
+ ignore[id[1]] = 1
49
+ end
50
+ end
51
+ ih.close
52
+ of = File.open(o[:out], "a+")
53
+ else
54
+ of = File.open(o[:out], "w")
55
+ end
56
+
57
+ next_url = "#{o[:url]}/function/#{uri_fun}"
58
+ i = 0
59
+ loop do
60
+ $stderr.print "Downloading sequence #{i+1}. \r" unless o[:q]
61
+ res_fun = RestClient.get next_url
62
+ abort "Unable to reach MG-RAST M5nr API, error code #{res_fun.code}." unless res_fun.code == 200
63
+ fun = JSON.parse(res_fun.to_str)
64
+ fun["data"].each do |datum|
65
+ if ignore["#{datum["source"]}:#{datum["accession"]}"].nil?
66
+ res_seq = RestClient.get "#{o[:url]}/md5/#{datum["md5"]}", {:params=>{:sequence=>1}}
67
+ abort "Unable to reach MG-RAST M5nr API, error code #{res_seq.code}." unless res_seq.code == 200
68
+ seq = JSON.parse(res_seq.to_str)
69
+ of.puts ">#{datum["source"]}:#{datum["accession"]} #{datum["function"]} [#{datum["organism"]} taxid:#{datum["ncbi_tax_id"]}]"
70
+ of.puts seq["data"]["sequence"].scan(/.{80}|.+/).map{ |x| x.strip }.join($/)
71
+ end
72
+ i += 1
73
+ break if o[:max]>0 and i >= o[:max]
74
+ end # |datum|
75
+ next_url = fun["next"]
76
+ break if next_url.nil? or (o[:max] > 0 and i >= o[:max])
77
+ end
78
+ of.close
79
+
80
+ $stderr.puts "Downloaded #{i} sequences." unless o[:q]
81
+
@@ -0,0 +1,198 @@
1
+ #!/usr/bin/env perl
2
+ #
3
+ # @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
4
+ # @license artistic license 2.0
5
+ # @update Mar-23-2015
6
+ #
7
+ use warnings;
8
+ use strict;
9
+ use Symbol;
10
+ use Getopt::Std;
11
+ use List::Util qw/max/;
12
+
13
+ sub HELP_MESSAGE { die "
14
+ Usage:
15
+ $0 [args]
16
+
17
+ Mandatory:
18
+ -m <str> MyTaxa output.
19
+
20
+ Optional:
21
+ -g <str> Genes predicted in the format defined by -f. If not passed, abundance is assumed to be based
22
+ on contigs.
23
+ -f <str> Format of the predicted genes. One of:
24
+ o gff2: GFF v2 as produced by MetaGeneMark.hmm (default).
25
+ o gff3: GFF v3, including the field id in the last column (with the Gene ID).
26
+ o tab: A tab-delimited file with the gene ID (col #1), the length of the gene in bp (col #2),
27
+ and the ID of the corresponding contig (col #3). The length of the gene (col #2) isn't used
28
+ (and it can be empty), but the column must exist (i.e., 2 tabs per line) for compatibility
29
+ with BlastTab.metaxaPrep.pl
30
+ -c <str> Counts file: Sequence IDs (genes if -g is provided, contigs otherwise) and reads per sequence
31
+ in a tab-delimited file. If not provided, each sequence counts as 1.
32
+ -O <str> Prefix of the output files to be generated. By default, the value of -m.
33
+ -I <str> File containing the complete classification of all the contigs identified as Innominate taxa.
34
+ By default, this file is not created.
35
+ -G <str> File containing the classification of each gene. By default, this file is not created. This
36
+ requires -g to be set. Note: This option requires extra RAM.
37
+ -K <str> File containing a krona input file. By default, this file is not created.
38
+ -k <str> List of ranks to include in the Krona file, delimited by comma. It MUST be decreasing rank.
39
+ By default: 'superkingdom,phylum,class,family,genus,species'. This is ignored unless -K also
40
+ is passed.
41
+ -R <str> List of taxonomic ranks for which individual reports should be generated, delimited by comma.
42
+ It MUST be decreasing rank. By default: 'phylum,genus,species'.
43
+ -r If set, reports raw counts. Otherwise, reports permil of the rank.
44
+ -u Report Unknown taxa.
45
+ -q Run quietly.
46
+ -h Display this help message and exits.
47
+
48
+ " }
49
+
50
+ my %o;
51
+ getopts('g:f:c:m:O:I:G:K:k:R:ruqh', \%o);
52
+ $o{h} and &HELP_MESSAGE;
53
+ $o{m} or &HELP_MESSAGE;
54
+ $o{O} ||= $o{m};
55
+ $o{f} ||= "gff2";
56
+ $o{k} ||= "superkingdom,phylum,class,family,genus,species";
57
+ my @K = split /,/, lc $o{k};
58
+ $o{R} ||= "phylum,genus,species";
59
+ my @R = split /,/, lc $o{R};
60
+ ($o{G} and not $o{g}) and die "-G requires -g to be set.\n";
61
+
62
+
63
+ my %gene;
64
+ my %count;
65
+ my %ctg=();
66
+ if($o{g}){
67
+ print STDERR "Reading genes collection.\n" unless $o{q};
68
+ open GFF, "<", $o{g} or die "Cannot read file: $o{g}: $!\n";
69
+ while(<GFF>){
70
+ next if /^#/;
71
+ next if /^\s*$/;
72
+ chomp;
73
+ my($id,$ctg);
74
+ my @ln = split /\t/;
75
+ if($o{f} eq 'gff2'){
76
+ exists $ln[8] or die "Cannot parse line $., expecting 9 columns: $_\n";
77
+ $id = $ln[8];
78
+ $id =~ s/gene_id /gene_id_/;
79
+ $ctg=$ln[0];
80
+ }elsif($o{f} eq 'gff3'){
81
+ exists $ln[8] or die "Cannot parse line $., expecting 9 columns: $_\n";
82
+ $ln[8] =~ /id=([^;]+)/ or die "Cannot parse line $.: $_\n";
83
+ $id = $1;
84
+ $ctg = $ln[0];
85
+ }elsif($o{f} eq 'tab'){
86
+ exists $ln[2] or die "Cannot parse line $., expecting 3 columns: $_\n";
87
+ $id = $ln[0];
88
+ $ctg = $ln[2];
89
+ }else{
90
+ die "Unsupported format: ".$o{f}.".\n";
91
+ }
92
+ $ctg =~ s/ .*//;
93
+ if($o{c}){
94
+ $gene{$id} = $ctg;
95
+ }else{
96
+ $count{$ctg}++;
97
+ }
98
+ push( @{$ctg{$ctg}||=[]}, $id ) if $o{G};
99
+ }
100
+ close GFF;
101
+ print STDERR " Found ".(scalar(keys %gene))." genes.\n" unless $o{q};
102
+ }
103
+
104
+ my $Nreads = 0;
105
+ if($o{c}){
106
+ print STDERR "Reading read-counts.\n" unless $o{q};
107
+ open COUNT, "<", $o{c} or die "Cannot read file: $o{c}: $!\n";
108
+ while(<COUNT>){
109
+ chomp;
110
+ my @l = split /\t/;
111
+ if($o{g}){
112
+ exists $gene{$l[0]} or die "Cannot find gene's contig: $l[0].\n";
113
+ $count{ $gene{$l[0]} } += $l[1];
114
+ delete $gene{$l[0]};
115
+ }else{
116
+ $count{ $l[0] } += $l[1];
117
+ }
118
+ $Nreads += $l[1];
119
+ }
120
+ close COUNT;
121
+ print STDERR " Found ".scalar(keys %gene)." genes without reads.\n" if scalar(keys %gene) and not $o{q};
122
+ $count{$_}+=0 for values %gene;
123
+ print STDERR " Found ".scalar(keys %count)." sequences and $Nreads reads.\n" unless $o{q};
124
+ }
125
+
126
+ print STDERR "Reading Metaxa results.\n";
127
+ open METAXA, "<", $o{m} or die "Cannot read file: $o{m}: $!\n";
128
+ my $ctg;
129
+ my $rank;
130
+ my @ofh = ();
131
+ my @n = (0,0,0);
132
+ my @out = ({},{},{});
133
+ my @rank_name = map { ucfirst } ('unknown', @R);
134
+ my %rank = map { ($rank_name[$_]=>$_) } 0 .. $#rank_name;
135
+ my @rank_tag = ("NA", map { "<$_>" } @R);
136
+ $o{I} and (open OUT_I, ">", $o{I} or die "Cannot create file: $o{I}: $!\n");
137
+ $o{K} and (open OUT_K, ">", $o{K} or die "Cannot create file: $o{K}: $!\n");
138
+ $o{G} and (open OUT_G, ">", $o{G} or die "Cannot create file: $o{G}: $!\n");
139
+
140
+ my $Nreads_class = 0;
141
+ my $Nno_read_ctg = 0;
142
+ while(not eof(METAXA)){
143
+ my @h=split /\t/, <METAXA>;
144
+ my $t=<METAXA>; chomp $t;
145
+ exists $h[3] or die "Cannot parse MyTaxa file, line $.: $_\n";
146
+ my $count_h;
147
+ if($o{c} or $o{g}){
148
+ unless(exists $count{$h[0]}){
149
+ $Nno_read_ctg++;
150
+ next;
151
+ }
152
+ $count_h = $count{$h[0]};
153
+ }else{
154
+ $count_h = 1;
155
+ }
156
+ if($o{G}){ print OUT_G "$_\t$t\n" for @{$ctg{$h[0]}} }
157
+ next unless $count_h;
158
+ my $last = 'organism';
159
+ $n[0] += $count_h;
160
+ for my $r (1 .. max(values %rank)){
161
+ if($rank{$h[1]} >= $r){
162
+ if($t =~ m/$rank_tag[$r]([^;]*)/){
163
+ $last = $1 if $1;
164
+ }else{
165
+ $last = $last=~/^Innominate / ? $last : "Innominate $last";
166
+ $o{I} and print OUT_I "$h[0]\t$rank_name[$r]\t$last\t$t\n";
167
+ }
168
+ $out[$r]->{$last} += $count_h;
169
+ $n[$r] += $count_h;
170
+ }else{
171
+ $out[$r]->{"Unknown $last"} += $count_h if $o{u};
172
+ }
173
+ }
174
+ if($o{K}){
175
+ my $ln = $count_h;
176
+ for my $r (@K){ $ln.= "\t".($t=~m/<$r>([^;]+)/?$1:'') }
177
+ print OUT_K "$ln\n";
178
+ }
179
+ $Nreads_class+= $count_h;
180
+ }
181
+ print OUT_K "".($Nreads-$Nreads_class)."\n" if $o{K} and $Nreads>$Nreads_class;
182
+ close METAXA;
183
+ $o{I} and close OUT_I;
184
+ $o{K} and close OUT_K;
185
+ $o{G} and close OUT_G;
186
+ print " Found $n[0] reads.\n" unless $o{q};
187
+ print " Couldn't find counts for $Nno_read_ctg contigs.\n" if $Nno_read_ctg;
188
+ unless($o{q}){ print " Found $n[$_] classified reads at ".$rank_name[$_]." level.\n" for (1 .. max(values %rank)) }
189
+
190
+ print STDERR "Generating output.\n" unless $o{q};
191
+ for my $rank (1 .. max(values %rank)){
192
+ open OUT, ">", "$o{O}.".$rank_name[$rank].".txt" or die "Cannot create file: $o{O}.".$rank_name[$rank].".txt: $!\n";
193
+ for my $class (keys %{$out[$rank]}){
194
+ printf OUT "%s\t%.20f\n", $class, ($out[$rank]->{$class}*($o{r}?1:1000/$n[$rank]));
195
+ }
196
+ close OUT;
197
+ }
198
+
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env perl
2
+ #
3
+ # @author: Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
4
+ # @update: Mar-23-2015
5
+ # @license: artistic license 2.0
6
+ #
7
+
8
+ use warnings;
9
+ use strict;
10
+
11
+ my($file,$tax,$rank) = @ARGV;
12
+ ($file and $tax) or die "
13
+ .Usage:
14
+ $0 file.txt taxon[ rank]
15
+
16
+ file.txt MyTaxa output.
17
+ taxon Taxon to look for.
18
+ rank Rank of taxon (optional). By default: any rank.
19
+
20
+ ";
21
+ $rank ||= ".*";
22
+ $rank = lc $rank;
23
+
24
+ open MT, "<", $file or die "Cannot read file: $file: $!\n";
25
+ my $last = '';
26
+ while(my $ln=<MT>){
27
+ chomp $ln;
28
+ if($ln =~ /<$rank>$tax(;|$)/){
29
+ $last =~ s/\t.*//;
30
+ print $last, "\n";
31
+ }
32
+ $last = $ln;
33
+ }
34
+ close MT;
35
+
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
5
+ # @update: Feb-06-2015
6
+ # @license artistic license 2.0
7
+ #
8
+
9
+ require 'optparse'
10
+
11
+ opts = {:rank=>'genus', :quiet=>FALSE}
12
+ ARGV << '-h' if ARGV.size==0
13
+ OptionParser.new do |opt|
14
+ opt.separator "Generates a simple tabular file with the classification of each sequence at a given taxonomic rank from a MyTaxa output."
15
+ opt.separator ""
16
+ opt.on("-i", "--mytaxa FILE", "Input MyTaxa file."){ |v| opts[:mytaxa]=v }
17
+ opt.on("-r", "--rank STR", "Taxonomic rank. By default: #{opts[:rank]}."){ |v| opts[:rank] = v.downcase }
18
+ opt.on("-q","--quiet","Run quietly.") { opts[:quiet]=TRUE }
19
+ opt.on("-h","--help","Display this screen.") do
20
+ puts opt
21
+ exit
22
+ end
23
+ opt.separator ""
24
+ end.parse!
25
+ abort "-i/--mytaxa is mandatory." if opts[:mytaxa].nil?
26
+ abort "-i/--mytaxa must exist." unless File.exists? opts[:mytaxa]
27
+
28
+ begin
29
+ f = File.open(opts[:mytaxa], "r")
30
+ ctg = nil;
31
+ while(ln = f.gets)
32
+ m = /^(.+)(\t.+){3}/.match(ln)
33
+ if m
34
+ raise "Couldn't find classification for contig #{ctg}" unless ctg.nil?
35
+ ctg = m[1]
36
+ else
37
+ raise "Couldn't find the contig name at line #{$.}" if ctg.nil?
38
+ m = /<#{opts[:rank]}>([^;]+)/.match(ln)
39
+ puts "#{ctg}\t#{m ? m[1] : "Unclassified"}"
40
+ ctg = nil
41
+ end
42
+ end
43
+ f.close
44
+ rescue => err
45
+ $stderr.puts "Exception: #{err}\n\n"
46
+ err.backtrace.each { |l| $stderr.puts l + "\n" }
47
+ err
48
+ end
49
+
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
5
+ # @license artistic license 2.0
6
+ #
7
+
8
+ $:.push File.expand_path(File.dirname(__FILE__) + "/lib")
9
+ require "enveomics_rb/remote_data"
10
+ use "nokogiri"
11
+
12
+ #================================[ Options parsing ]
13
+ o = {
14
+ :q=>false, :accs=>[], :dbfrom=>"nuccore", :header=>true,
15
+ :no_nil=>false, :ret=>"ScientificName",
16
+ :ranks=>%w(superkingdom phylum class order family genus species)}
17
+ OptionParser.new do |opt|
18
+ opt.banner = "
19
+ Maps a list of NCBI accessions to their corresponding taxonomy using the NCBI
20
+ EUtilities. Avoid using this script on millions of entries at a time, since
21
+ each entry elicits two requests to NCBI's servers.
22
+
23
+ Usage: #{$0} [options]".gsub(/^ +/,"")
24
+ opt.separator ""
25
+ opt.on("-a", "--acc acc1,acc2.ver,...", Array,
26
+ "Comma-separated list of accessions. Required unless -i is passed."
27
+ ){ |v| o[:accs]=v }
28
+ opt.on("-i", "--infile FILE",
29
+ "Raw text file containing the list of accessions, one per line.",
30
+ "Required unless -g is passed."){ |v| o[:infile]=v }
31
+ opt.on("-p", "--protein",
32
+ "Use if the accessions are proteins. Otherwise, accessions are assumed " +
33
+ "to be from the Nuccore Database."){ o[:dbfrom]="protein" }
34
+ opt.on("-r", "--ranks RANK1,RANK2,...", Array,
35
+ "Taxonomic ranks to report. By default: #{o[:ranks].join(",")}."
36
+ ){ |v| o[:ranks]=v }
37
+ opt.on("-n", "--noheader",
38
+ "Do not include a header in the output."){ o[:header]=false }
39
+ opt.on("-t", "--taxids",
40
+ "Return Taxonomy IDs instead of scientific names."){ o[:ret]="TaxId" }
41
+ opt.on("--ignore-missing",
42
+ "Does not report missing accessions in the output file.",
43
+ "By default, it reports accessions and empty values for all other columns."
44
+ ){ |v| o[:no_nil]=v }
45
+ opt.on("-q", "--quiet", "Run quietly."){ |v| o[:q]=true }
46
+ opt.on("-h", "--help","Display this screen") do
47
+ puts opt
48
+ exit
49
+ end
50
+ opt.separator ""
51
+ end.parse!
52
+
53
+ #================================[ Functions ]
54
+ def acc2taxid(db, acc)
55
+ doc = Nokogiri::XML( RemoteData.elink({:dbfrom=>db,
56
+ :db=>"taxonomy", :id=>acc, :idtype=>"acc"}) )
57
+ doc.at_xpath("/eLinkResult/LinkSet/LinkSetDb/Link/Id")
58
+ end
59
+ #================================[ Main ]
60
+ begin
61
+ o[:accs] += File.readlines(o[:infile]).map{ |l| l.chomp } unless
62
+ o[:infile].nil?
63
+ o[:ranks].map!{ |r| r.downcase }
64
+ puts (["Acc", "TaxId"] + o[:ranks].map{ |r| r.capitalize }).join("\t") if
65
+ o[:header]
66
+ o[:accs].each do |acc|
67
+ taxid = acc2taxid(o[:dbfrom], acc)
68
+ status = ""
69
+ if taxid.nil?
70
+ warn "Cannot find link to taxonomy: #{acc} #{status}"
71
+ puts ([acc, ""] + o[:ranks].map{ |i| "" }).join("\t") unless o[:no_nil]
72
+ next
73
+ end
74
+ taxonomy = {}
75
+ unless taxid.nil?
76
+ doc = Nokogiri::XML( RemoteData.efetch({:db=>"taxonomy",
77
+ :id=>taxid.content}) )
78
+ taxonomy[ doc.at_xpath("/TaxaSet/Taxon/Rank").content ] =
79
+ doc.at_xpath("/TaxaSet/Taxon/#{o[:ret]}").content
80
+ doc.xpath("/TaxaSet/Taxon/LineageEx/Taxon").each do |taxon|
81
+ taxonomy[ taxon.at_xpath("./Rank").content ] =
82
+ taxon.at_xpath("./#{o[:ret]}").content
83
+ end
84
+ end
85
+ puts ([acc, taxid.content] +
86
+ o[:ranks].map{ |rank| taxonomy[ rank ] ||= "" }).join("\t")
87
+ end
88
+ rescue => err
89
+ $stderr.puts "Exception: #{err}\n\n"
90
+ err.backtrace.each { |l| $stderr.puts l + "\n" }
91
+ err
92
+ end