miga-base 1.2.17.0 → 1.2.17.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. checksums.yaml +4 -4
  2. data/lib/miga/version.rb +2 -2
  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 +3659 -0
  7. data/utils/FastAAI/FastAAI-legacy/FastAAI +1336 -0
  8. data/utils/FastAAI/FastAAI-legacy/kAAI_v1.0_virus.py +1296 -0
  9. data/utils/FastAAI/README.md +84 -0
  10. data/utils/enveomics/Docs/recplot2.md +244 -0
  11. data/utils/enveomics/Examples/aai-matrix.bash +66 -0
  12. data/utils/enveomics/Examples/ani-matrix.bash +66 -0
  13. data/utils/enveomics/Examples/essential-phylogeny.bash +105 -0
  14. data/utils/enveomics/Examples/unus-genome-phylogeny.bash +100 -0
  15. data/utils/enveomics/LICENSE.txt +73 -0
  16. data/utils/enveomics/Makefile +52 -0
  17. data/utils/enveomics/Manifest/Tasks/aasubs.json +103 -0
  18. data/utils/enveomics/Manifest/Tasks/blasttab.json +790 -0
  19. data/utils/enveomics/Manifest/Tasks/distances.json +161 -0
  20. data/utils/enveomics/Manifest/Tasks/fasta.json +802 -0
  21. data/utils/enveomics/Manifest/Tasks/fastq.json +291 -0
  22. data/utils/enveomics/Manifest/Tasks/graphics.json +126 -0
  23. data/utils/enveomics/Manifest/Tasks/mapping.json +165 -0
  24. data/utils/enveomics/Manifest/Tasks/ogs.json +382 -0
  25. data/utils/enveomics/Manifest/Tasks/other.json +906 -0
  26. data/utils/enveomics/Manifest/Tasks/remote.json +356 -0
  27. data/utils/enveomics/Manifest/Tasks/sequence-identity.json +650 -0
  28. data/utils/enveomics/Manifest/Tasks/tables.json +308 -0
  29. data/utils/enveomics/Manifest/Tasks/trees.json +68 -0
  30. data/utils/enveomics/Manifest/Tasks/variants.json +111 -0
  31. data/utils/enveomics/Manifest/categories.json +165 -0
  32. data/utils/enveomics/Manifest/examples.json +162 -0
  33. data/utils/enveomics/Manifest/tasks.json +4 -0
  34. data/utils/enveomics/README.md +42 -0
  35. data/utils/enveomics/Scripts/AAsubs.log2ratio.rb +171 -0
  36. data/utils/enveomics/Scripts/Aln.cat.rb +221 -0
  37. data/utils/enveomics/Scripts/Aln.convert.pl +35 -0
  38. data/utils/enveomics/Scripts/AlphaDiversity.pl +152 -0
  39. data/utils/enveomics/Scripts/BedGraph.tad.rb +138 -0
  40. data/utils/enveomics/Scripts/BedGraph.window.rb +71 -0
  41. data/utils/enveomics/Scripts/BlastPairwise.AAsubs.pl +102 -0
  42. data/utils/enveomics/Scripts/BlastTab.addlen.rb +63 -0
  43. data/utils/enveomics/Scripts/BlastTab.advance.bash +48 -0
  44. data/utils/enveomics/Scripts/BlastTab.best_hit_sorted.pl +55 -0
  45. data/utils/enveomics/Scripts/BlastTab.catsbj.pl +104 -0
  46. data/utils/enveomics/Scripts/BlastTab.cogCat.rb +76 -0
  47. data/utils/enveomics/Scripts/BlastTab.filter.pl +47 -0
  48. data/utils/enveomics/Scripts/BlastTab.kegg_pep2path_rest.pl +194 -0
  49. data/utils/enveomics/Scripts/BlastTab.metaxaPrep.pl +104 -0
  50. data/utils/enveomics/Scripts/BlastTab.pairedHits.rb +157 -0
  51. data/utils/enveomics/Scripts/BlastTab.recplot2.R +48 -0
  52. data/utils/enveomics/Scripts/BlastTab.seqdepth.pl +86 -0
  53. data/utils/enveomics/Scripts/BlastTab.seqdepth_ZIP.pl +119 -0
  54. data/utils/enveomics/Scripts/BlastTab.seqdepth_nomedian.pl +86 -0
  55. data/utils/enveomics/Scripts/BlastTab.subsample.pl +47 -0
  56. data/utils/enveomics/Scripts/BlastTab.sumPerHit.pl +114 -0
  57. data/utils/enveomics/Scripts/BlastTab.taxid2taxrank.pl +90 -0
  58. data/utils/enveomics/Scripts/BlastTab.topHits_sorted.rb +123 -0
  59. data/utils/enveomics/Scripts/Chao1.pl +97 -0
  60. data/utils/enveomics/Scripts/CharTable.classify.rb +234 -0
  61. data/utils/enveomics/Scripts/EBIseq2tax.rb +83 -0
  62. data/utils/enveomics/Scripts/FastA.N50.pl +60 -0
  63. data/utils/enveomics/Scripts/FastA.extract.rb +152 -0
  64. data/utils/enveomics/Scripts/FastA.filter.pl +52 -0
  65. data/utils/enveomics/Scripts/FastA.filterLen.pl +28 -0
  66. data/utils/enveomics/Scripts/FastA.filterN.pl +60 -0
  67. data/utils/enveomics/Scripts/FastA.fragment.rb +100 -0
  68. data/utils/enveomics/Scripts/FastA.gc.pl +42 -0
  69. data/utils/enveomics/Scripts/FastA.interpose.pl +93 -0
  70. data/utils/enveomics/Scripts/FastA.length.pl +38 -0
  71. data/utils/enveomics/Scripts/FastA.mask.rb +89 -0
  72. data/utils/enveomics/Scripts/FastA.per_file.pl +36 -0
  73. data/utils/enveomics/Scripts/FastA.qlen.pl +57 -0
  74. data/utils/enveomics/Scripts/FastA.rename.pl +65 -0
  75. data/utils/enveomics/Scripts/FastA.revcom.pl +23 -0
  76. data/utils/enveomics/Scripts/FastA.sample.rb +98 -0
  77. data/utils/enveomics/Scripts/FastA.slider.pl +85 -0
  78. data/utils/enveomics/Scripts/FastA.split.pl +55 -0
  79. data/utils/enveomics/Scripts/FastA.split.rb +79 -0
  80. data/utils/enveomics/Scripts/FastA.subsample.pl +131 -0
  81. data/utils/enveomics/Scripts/FastA.tag.rb +65 -0
  82. data/utils/enveomics/Scripts/FastA.toFastQ.rb +69 -0
  83. data/utils/enveomics/Scripts/FastA.wrap.rb +48 -0
  84. data/utils/enveomics/Scripts/FastQ.filter.pl +54 -0
  85. data/utils/enveomics/Scripts/FastQ.interpose.pl +90 -0
  86. data/utils/enveomics/Scripts/FastQ.maskQual.rb +89 -0
  87. data/utils/enveomics/Scripts/FastQ.offset.pl +90 -0
  88. data/utils/enveomics/Scripts/FastQ.split.pl +53 -0
  89. data/utils/enveomics/Scripts/FastQ.tag.rb +70 -0
  90. data/utils/enveomics/Scripts/FastQ.test-error.rb +81 -0
  91. data/utils/enveomics/Scripts/FastQ.toFastA.awk +24 -0
  92. data/utils/enveomics/Scripts/GFF.catsbj.pl +127 -0
  93. data/utils/enveomics/Scripts/GenBank.add_fields.rb +84 -0
  94. data/utils/enveomics/Scripts/HMM.essential.rb +351 -0
  95. data/utils/enveomics/Scripts/HMM.haai.rb +168 -0
  96. data/utils/enveomics/Scripts/HMMsearch.extractIds.rb +83 -0
  97. data/utils/enveomics/Scripts/JPlace.distances.rb +88 -0
  98. data/utils/enveomics/Scripts/JPlace.to_iToL.rb +320 -0
  99. data/utils/enveomics/Scripts/M5nr.getSequences.rb +81 -0
  100. data/utils/enveomics/Scripts/MeTaxa.distribution.pl +198 -0
  101. data/utils/enveomics/Scripts/MyTaxa.fragsByTax.pl +35 -0
  102. data/utils/enveomics/Scripts/MyTaxa.seq-taxrank.rb +49 -0
  103. data/utils/enveomics/Scripts/NCBIacc2tax.rb +92 -0
  104. data/utils/enveomics/Scripts/Newick.autoprune.R +27 -0
  105. data/utils/enveomics/Scripts/RAxML-EPA.to_iToL.pl +228 -0
  106. data/utils/enveomics/Scripts/RecPlot2.compareIdentities.R +32 -0
  107. data/utils/enveomics/Scripts/RefSeq.download.bash +48 -0
  108. data/utils/enveomics/Scripts/SRA.download.bash +67 -0
  109. data/utils/enveomics/Scripts/TRIBS.plot-test.R +36 -0
  110. data/utils/enveomics/Scripts/TRIBS.test.R +39 -0
  111. data/utils/enveomics/Scripts/Table.barplot.R +31 -0
  112. data/utils/enveomics/Scripts/Table.df2dist.R +30 -0
  113. data/utils/enveomics/Scripts/Table.filter.pl +61 -0
  114. data/utils/enveomics/Scripts/Table.merge.pl +77 -0
  115. data/utils/enveomics/Scripts/Table.prefScore.R +60 -0
  116. data/utils/enveomics/Scripts/Table.replace.rb +69 -0
  117. data/utils/enveomics/Scripts/Table.round.rb +63 -0
  118. data/utils/enveomics/Scripts/Table.split.pl +57 -0
  119. data/utils/enveomics/Scripts/Taxonomy.silva2ncbi.rb +227 -0
  120. data/utils/enveomics/Scripts/VCF.KaKs.rb +147 -0
  121. data/utils/enveomics/Scripts/VCF.SNPs.rb +88 -0
  122. data/utils/enveomics/Scripts/aai.rb +421 -0
  123. data/utils/enveomics/Scripts/ani.rb +362 -0
  124. data/utils/enveomics/Scripts/anir.rb +137 -0
  125. data/utils/enveomics/Scripts/clust.rand.rb +102 -0
  126. data/utils/enveomics/Scripts/gi2tax.rb +103 -0
  127. data/utils/enveomics/Scripts/in_silico_GA_GI.pl +96 -0
  128. data/utils/enveomics/Scripts/lib/data/dupont_2012_essential.hmm.gz +0 -0
  129. data/utils/enveomics/Scripts/lib/data/lee_2019_essential.hmm.gz +0 -0
  130. data/utils/enveomics/Scripts/lib/enveomics.R +1 -0
  131. data/utils/enveomics/Scripts/lib/enveomics_rb/anir.rb +293 -0
  132. data/utils/enveomics/Scripts/lib/enveomics_rb/bm_set.rb +175 -0
  133. data/utils/enveomics/Scripts/lib/enveomics_rb/enveomics.rb +24 -0
  134. data/utils/enveomics/Scripts/lib/enveomics_rb/errors.rb +17 -0
  135. data/utils/enveomics/Scripts/lib/enveomics_rb/gmm_em.rb +30 -0
  136. data/utils/enveomics/Scripts/lib/enveomics_rb/jplace.rb +253 -0
  137. data/utils/enveomics/Scripts/lib/enveomics_rb/match.rb +88 -0
  138. data/utils/enveomics/Scripts/lib/enveomics_rb/og.rb +182 -0
  139. data/utils/enveomics/Scripts/lib/enveomics_rb/rbm.rb +49 -0
  140. data/utils/enveomics/Scripts/lib/enveomics_rb/remote_data.rb +74 -0
  141. data/utils/enveomics/Scripts/lib/enveomics_rb/seq_range.rb +237 -0
  142. data/utils/enveomics/Scripts/lib/enveomics_rb/stats/rand.rb +31 -0
  143. data/utils/enveomics/Scripts/lib/enveomics_rb/stats/sample.rb +152 -0
  144. data/utils/enveomics/Scripts/lib/enveomics_rb/stats.rb +3 -0
  145. data/utils/enveomics/Scripts/lib/enveomics_rb/utils.rb +74 -0
  146. data/utils/enveomics/Scripts/lib/enveomics_rb/vcf.rb +135 -0
  147. data/utils/enveomics/Scripts/ogs.annotate.rb +88 -0
  148. data/utils/enveomics/Scripts/ogs.core-pan.rb +160 -0
  149. data/utils/enveomics/Scripts/ogs.extract.rb +125 -0
  150. data/utils/enveomics/Scripts/ogs.mcl.rb +186 -0
  151. data/utils/enveomics/Scripts/ogs.rb +104 -0
  152. data/utils/enveomics/Scripts/ogs.stats.rb +131 -0
  153. data/utils/enveomics/Scripts/rbm-legacy.rb +172 -0
  154. data/utils/enveomics/Scripts/rbm.rb +108 -0
  155. data/utils/enveomics/Scripts/sam.filter.rb +148 -0
  156. data/utils/enveomics/Tests/Makefile +10 -0
  157. data/utils/enveomics/Tests/Mgen_M2288.faa +3189 -0
  158. data/utils/enveomics/Tests/Mgen_M2288.fna +8282 -0
  159. data/utils/enveomics/Tests/Mgen_M2321.fna +8288 -0
  160. data/utils/enveomics/Tests/Nequ_Kin4M.faa +2970 -0
  161. data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.tribs.Rdata +0 -0
  162. data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.txt +7 -0
  163. data/utils/enveomics/Tests/Xanthomonas_oryzae.aai-mat.tsv +17 -0
  164. data/utils/enveomics/Tests/Xanthomonas_oryzae.aai.tsv +137 -0
  165. data/utils/enveomics/Tests/a_mg.cds-go.blast.tsv +123 -0
  166. data/utils/enveomics/Tests/a_mg.reads-cds.blast.tsv +200 -0
  167. data/utils/enveomics/Tests/a_mg.reads-cds.counts.tsv +55 -0
  168. data/utils/enveomics/Tests/alkB.nwk +1 -0
  169. data/utils/enveomics/Tests/anthrax-cansnp-data.tsv +13 -0
  170. data/utils/enveomics/Tests/anthrax-cansnp-key.tsv +17 -0
  171. data/utils/enveomics/Tests/hiv1.faa +59 -0
  172. data/utils/enveomics/Tests/hiv1.fna +134 -0
  173. data/utils/enveomics/Tests/hiv2.faa +70 -0
  174. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv +233 -0
  175. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.lim +1 -0
  176. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.rec +233 -0
  177. data/utils/enveomics/Tests/low-cov.bg.gz +0 -0
  178. data/utils/enveomics/Tests/phyla_counts.tsv +10 -0
  179. data/utils/enveomics/Tests/primate_lentivirus.ogs +11 -0
  180. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv1.rbm +9 -0
  181. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv2.rbm +8 -0
  182. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-siv.rbm +6 -0
  183. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-hiv2.rbm +9 -0
  184. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-siv.rbm +6 -0
  185. data/utils/enveomics/Tests/primate_lentivirus.rbm/siv-siv.rbm +6 -0
  186. data/utils/enveomics/build_enveomics_r.bash +45 -0
  187. data/utils/enveomics/enveomics.R/DESCRIPTION +31 -0
  188. data/utils/enveomics/enveomics.R/NAMESPACE +39 -0
  189. data/utils/enveomics/enveomics.R/R/autoprune.R +167 -0
  190. data/utils/enveomics/enveomics.R/R/barplot.R +203 -0
  191. data/utils/enveomics/enveomics.R/R/cliopts.R +141 -0
  192. data/utils/enveomics/enveomics.R/R/df2dist.R +192 -0
  193. data/utils/enveomics/enveomics.R/R/growthcurve.R +349 -0
  194. data/utils/enveomics/enveomics.R/R/prefscore.R +79 -0
  195. data/utils/enveomics/enveomics.R/R/recplot.R +419 -0
  196. data/utils/enveomics/enveomics.R/R/recplot2.R +1698 -0
  197. data/utils/enveomics/enveomics.R/R/tribs.R +638 -0
  198. data/utils/enveomics/enveomics.R/R/utils.R +90 -0
  199. data/utils/enveomics/enveomics.R/README.md +81 -0
  200. data/utils/enveomics/enveomics.R/data/growth.curves.rda +0 -0
  201. data/utils/enveomics/enveomics.R/data/phyla.counts.rda +0 -0
  202. data/utils/enveomics/enveomics.R/man/cash-enve.GrowthCurve-method.Rd +16 -0
  203. data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2-method.Rd +16 -0
  204. data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2.Peak-method.Rd +16 -0
  205. data/utils/enveomics/enveomics.R/man/enve.GrowthCurve-class.Rd +25 -0
  206. data/utils/enveomics/enveomics.R/man/enve.TRIBS-class.Rd +47 -0
  207. data/utils/enveomics/enveomics.R/man/enve.TRIBS.merge.Rd +23 -0
  208. data/utils/enveomics/enveomics.R/man/enve.TRIBStest-class.Rd +47 -0
  209. data/utils/enveomics/enveomics.R/man/enve.__prune.iter.Rd +26 -0
  210. data/utils/enveomics/enveomics.R/man/enve.__prune.reduce.Rd +26 -0
  211. data/utils/enveomics/enveomics.R/man/enve.__tribs.Rd +44 -0
  212. data/utils/enveomics/enveomics.R/man/enve.barplot.Rd +111 -0
  213. data/utils/enveomics/enveomics.R/man/enve.cliopts.Rd +67 -0
  214. data/utils/enveomics/enveomics.R/man/enve.col.alpha.Rd +34 -0
  215. data/utils/enveomics/enveomics.R/man/enve.col2alpha.Rd +25 -0
  216. data/utils/enveomics/enveomics.R/man/enve.df2dist.Rd +59 -0
  217. data/utils/enveomics/enveomics.R/man/enve.df2dist.group.Rd +63 -0
  218. data/utils/enveomics/enveomics.R/man/enve.df2dist.list.Rd +46 -0
  219. data/utils/enveomics/enveomics.R/man/enve.growthcurve.Rd +78 -0
  220. data/utils/enveomics/enveomics.R/man/enve.prefscore.Rd +50 -0
  221. data/utils/enveomics/enveomics.R/man/enve.prune.dist.Rd +44 -0
  222. data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +147 -0
  223. data/utils/enveomics/enveomics.R/man/enve.recplot2-class.Rd +45 -0
  224. data/utils/enveomics/enveomics.R/man/enve.recplot2.ANIr.Rd +27 -0
  225. data/utils/enveomics/enveomics.R/man/enve.recplot2.Rd +77 -0
  226. data/utils/enveomics/enveomics.R/man/enve.recplot2.__counts.Rd +28 -0
  227. data/utils/enveomics/enveomics.R/man/enve.recplot2.__peakHist.Rd +24 -0
  228. data/utils/enveomics/enveomics.R/man/enve.recplot2.__whichClosestPeak.Rd +22 -0
  229. data/utils/enveomics/enveomics.R/man/enve.recplot2.changeCutoff.Rd +22 -0
  230. data/utils/enveomics/enveomics.R/man/enve.recplot2.compareIdentities.Rd +52 -0
  231. data/utils/enveomics/enveomics.R/man/enve.recplot2.coordinates.Rd +29 -0
  232. data/utils/enveomics/enveomics.R/man/enve.recplot2.corePeak.Rd +21 -0
  233. data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +45 -0
  234. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.Rd +34 -0
  235. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_e.Rd +23 -0
  236. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_m.Rd +24 -0
  237. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__emauto_one.Rd +31 -0
  238. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mow_one.Rd +56 -0
  239. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mower.Rd +20 -0
  240. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.em.Rd +51 -0
  241. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.emauto.Rd +43 -0
  242. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.mower.Rd +82 -0
  243. data/utils/enveomics/enveomics.R/man/enve.recplot2.peak-class.Rd +59 -0
  244. data/utils/enveomics/enveomics.R/man/enve.recplot2.seqdepth.Rd +27 -0
  245. data/utils/enveomics/enveomics.R/man/enve.recplot2.windowDepthThreshold.Rd +36 -0
  246. data/utils/enveomics/enveomics.R/man/enve.selvector.Rd +23 -0
  247. data/utils/enveomics/enveomics.R/man/enve.tribs.Rd +68 -0
  248. data/utils/enveomics/enveomics.R/man/enve.tribs.test.Rd +28 -0
  249. data/utils/enveomics/enveomics.R/man/enve.truncate.Rd +27 -0
  250. data/utils/enveomics/enveomics.R/man/growth.curves.Rd +14 -0
  251. data/utils/enveomics/enveomics.R/man/phyla.counts.Rd +13 -0
  252. data/utils/enveomics/enveomics.R/man/plot.enve.GrowthCurve.Rd +81 -0
  253. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBS.Rd +49 -0
  254. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBStest.Rd +48 -0
  255. data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +125 -0
  256. data/utils/enveomics/enveomics.R/man/summary.enve.GrowthCurve.Rd +22 -0
  257. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBS.Rd +22 -0
  258. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBStest.Rd +22 -0
  259. data/utils/enveomics/globals.mk +8 -0
  260. data/utils/enveomics/manifest.json +9 -0
  261. data/utils/multitrim/Multitrim How-To.pdf +0 -0
  262. data/utils/multitrim/README.md +67 -0
  263. data/utils/multitrim/multitrim.py +1555 -0
  264. data/utils/multitrim/multitrim.yml +13 -0
  265. metadata +268 -6
@@ -0,0 +1,162 @@
1
+ {
2
+ "_": "Input files and directories are included in the 'Tests' folder.",
3
+ "examples": [
4
+ {
5
+ "_": "== Examples of genome comparisons ==",
6
+ "task": "ogs.stats.rb",
7
+ "description": ["Statistics on the groups of orthology in the Primate",
8
+ "Lentivirus Group, including HIV-1, HIV-2, and SIV."],
9
+ "values": ["primate_lentivirus.ogs",null,null,null,null,null]
10
+ },
11
+ {
12
+ "task": "ani.rb",
13
+ "description": ["Average Nucleotide Identity (ANI) between two strains",
14
+ "of Mycoplasma genitalium (M2288 and M2321)."],
15
+ "values": ["Mgen_M2288.fna","Mgen_M2321.fna",null,null,null,null,null,
16
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
17
+ null,null,null]
18
+ },
19
+ {
20
+ "task": "aai.rb",
21
+ "description": ["Average Amino acid Identity (AAI) between Mycoplasma",
22
+ "genitalium (Bacteria) and Nanoarchaeum equitans (Archaea)."],
23
+ "values": ["Mgen_M2288.faa","Nequ_Kin4M.faa",null,null,null,null,null,
24
+ null,null,null,null,null,null,null,null,null,null,null,null,null,null,
25
+ null,null,null]
26
+ },
27
+ {
28
+ "task": "rbm.rb",
29
+ "description": [
30
+ "Reciprocal Best Matches between the proteomes of the",
31
+ "two major HIV types (HIV-1 and HIV-2)."
32
+ ],
33
+ "values": [
34
+ "hiv1.faa", "hiv2.faa", "hiv1-hiv2.rbm", null, null, null, null, null,
35
+ null, null,null, null
36
+ ]
37
+ },
38
+ {
39
+ "task": "ogs.mcl.rb",
40
+ "description": ["Groups of orthology in the Primate Letivirus Group,",
41
+ "including HIV-1, HIV-2, and SIV."],
42
+ "values": ["primate_lentivirus.ogs","primate_lentivirus.rbm",null,null,
43
+ null,null,null,null,null,null,null,null]
44
+ },
45
+ {
46
+ "task": "Table.df2dist.R",
47
+ "description": ["Transforms a list of AAI values between Xanthomonas",
48
+ "oryzae genomes into a distance matrix."],
49
+ "values": ["Xanthomonas_oryzae.aai.tsv",null,null,null,null,100.0,
50
+ "Xanthomonas_oryzae.aai-mat.tsv"]
51
+ },
52
+ {
53
+ "_": "== Recruitment plots",
54
+ "task": "BlastTab.catsbj.pl",
55
+ "description": ["Prepares recruitment plot files for a comparison",
56
+ "between a virome containing HIV and the HIV-1 genome."],
57
+ "values": [null,null,null,null,"hiv1.fna","hiv_mix-hiv1.blast.tsv"]
58
+ },
59
+ {
60
+ "task": "BlastTab.recplot2.R",
61
+ "description": ["Generates recruitment plots for a comparison",
62
+ "between a virome containing HIV and the HIV-1 genome."],
63
+ "values": ["hiv_mix-hiv1.blast.tsv",50,100,null,null,null,null,null,null,
64
+ null,null,null,"hiv_mix-hiv1.Rdata","hiv_mix-hiv1.pdf",null,null]
65
+ },
66
+ {
67
+ "_": "== Examples of functional annotations ==",
68
+ "task": "HMM.essential.rb",
69
+ "description": ["Typical single-copy bacterial genes present in",
70
+ "Mycoplasma genitalium."],
71
+ "values": ["Mgen_M2288.faa",null,null,null,null,null,null,true,null,null,
72
+ null,null,null,null,null,null,null,null,null]
73
+ },
74
+ {
75
+ "task": "HMM.essential.rb",
76
+ "description": ["Typical single-copy archaeal genes present in",
77
+ "Nanoarchaeum equitans."],
78
+ "values": ["Mgen_M2288.faa",null,null,null,null,null,null,null,true,null,
79
+ null,null,null,null,null,null,null,null,null]
80
+ },
81
+ {
82
+ "task": "Newick.autoprune.R",
83
+ "description": ["Prune an AlkB tree with 110 tips to get only distant",
84
+ "representatives (41)."],
85
+ "values": ["alkB.nwk",0.9,null,null,null,null,null,"alkB-pruned.nwk"]
86
+ },
87
+ {
88
+ "_": "== Examples of BLAST statistics and manipulation",
89
+ "task": "BlastTab.topHits_sorted.rb",
90
+ "description": [
91
+ "Extract the best match of metagenome-derived proteins",
92
+ "(from the 'A metagenome') against a Gene Ontology collection."
93
+ ],
94
+ "values": [
95
+ "sort","a_mg.cds-go.blast.tsv", null, null, null, null,
96
+ "a_mg.cds-go.blast-bm.tsv", 1, null, null
97
+ ]
98
+ },
99
+ {
100
+ "task": "BlastTab.sumPerHit.pl",
101
+ "description": ["Count the number of reads per gene in a mapping of a",
102
+ "metagenome to a metagenome-derived genes (from the 'A metagenome')."],
103
+ "values": [null,null,null,null,null,null,null,"a_mg.reads-cds.blast.tsv",
104
+ null,"a_mg.reads-cds.counts.tsv"]
105
+ },
106
+ {
107
+ "task": "BlastTab.sumPerHit.pl",
108
+ "description": ["Estimate the total abundance of Gene Ontology",
109
+ "annotations in the A metagenome, using metagenome-derived proteins,",
110
+ "and normalizing by the read counts of each protein."],
111
+ "values": ["a_mg.reads-cds.counts.tsv",null,null,null,null,true,null,
112
+ "a_mg.cds-go.blast.tsv",null,"a_mg.go.read-counts.tsv"]
113
+ },
114
+ {
115
+ "_": "== Examples of diversity ==",
116
+ "task": "Table.barplot.R",
117
+ "description": ["Barplot with the distribution of bacterial phyla in",
118
+ "four different sites, with taxa sorted by variance."],
119
+ "values": ["phyla_counts.tsv","250,100,75,200",null,null,null,null,null,
120
+ null,true,"var",2,null,null,"phyla_counts.pdf",10,null]
121
+ },
122
+ {
123
+ "task": "Chao1.pl",
124
+ "description": ["Phylum-richness estimated by the Chao1 index with 95%",
125
+ "confidence, using the distributions of bacterial phyla in four",
126
+ "different sites."],
127
+ "values": ["phyla_counts.tsv",null,1,null,null,true,null,
128
+ "phyla_chao1.tsv"]
129
+ },
130
+ {
131
+ "task": "AlphaDiversity.pl",
132
+ "description": ["Phylum-diversity estimated by the indices of Shannon",
133
+ "(H'), Inverse Simpson (1/Lambda), and true diversity of order 1 (1D),",
134
+ "using the distributions of bacterial phyla in four different sites."],
135
+ "values": ["phyla_counts.tsv",null,1,null,null,true,null,true,1,null,
136
+ "phyla_diversity.tsv"]
137
+ },
138
+ {
139
+ "_": "== Other miscelaneous examples ==",
140
+ "task": "CharTable.classify.rb",
141
+ "description": ["Classification of anthrax genomes based on can-SNPs, as",
142
+ "described in Van Ert 2007 (PLoS ONE 2(5):e461)."],
143
+ "values": ["anthrax-cansnp-data.tsv","anthrax-cansnp-key.tsv",
144
+ "anthrax-cansnp-classif.tsv","anthrax-cansnp-classif.nwk",null]
145
+ },
146
+ {
147
+ "task": "TRIBS.test.R",
148
+ "description": ["Test overclustering of Xanthomonas oryzae genomes",
149
+ "encoding for PilA using Transformed-space Resampling In Biased Sets",
150
+ "(TRIBS)."],
151
+ "values": ["Xanthomonas_oryzae.aai-mat.tsv","Xanthomonas_oryzae-PilA.txt",
152
+ 5000,null,null,null,null,0,"Xanthomonas_oryzae-PilA.tribs.Rdata",100]
153
+ },
154
+ {
155
+ "task": "TRIBS.plot-test.R",
156
+ "description": ["Show the TRIBS-normalized distances between Xanthomonas",
157
+ "oryzae genomes (grey) and X. oryzae encoding for PilA (red)."],
158
+ "values": ["Xanthomonas_oryzae-PilA.tribs.Rdata",null,null,null,null,null,
159
+ null,null,"Xanthomonas_oryzae-PilA.tribs.pdf",null,null]
160
+ }
161
+ ]
162
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_": "This file loads all the .json files inside 'Manifest/Tasks'.",
3
+ "_include": "Tasks/*.json"
4
+ }
@@ -0,0 +1,42 @@
1
+ # Enveomics Collection
2
+
3
+ Scripts and reference libraries at [Kostas lab](http://enve-omics.gatech.edu).
4
+
5
+ ## Prerequisites
6
+
7
+ The enveomics collection as a whole has very modest requirements, essentially a
8
+ *nix system with `bash`, `perl`, `ruby`, and `R`. Some scripts may require
9
+ additional libraries, or even external Software, but you'll be forewarned about
10
+ these requirements in the documentation accompanying each script. If you prefer,
11
+ you can also use the Graphical User Interface (GUI), that comes with additional
12
+ tests to let you know if your system is ready to use any given script.
13
+
14
+ ## Graphical User Interface (GUI)
15
+
16
+ The enveomics collection now has a graphical user interface! To learn more,
17
+ please visit [enveomics-gui](https://github.com/lmrodriguezr/enveomics-gui).
18
+
19
+ ## License
20
+
21
+ The files in this repository are licensed under the terms of the
22
+ Artistic License 2.0, except when otherwise noted.
23
+
24
+ You can find a copy of the license in [LICENSE.txt](LICENSE.txt) or at
25
+ http://www.perlfoundation.org/artistic_license_2_0.
26
+
27
+ ## Documentation
28
+
29
+ Most scripts in this repository are self-documented. However,
30
+ more extensive documentation (and some discussion) can be found at the
31
+ [documentation website](http://enve-omics.ce.gatech.edu/enveomics/docs).
32
+ Additional documentation for recruitment plots can be found
33
+ [here](Docs/recplot2.md).
34
+
35
+ ## Citation
36
+
37
+ If you use any of the utilitites in the Enveomics Collection in your research
38
+ please cite:
39
+
40
+ > Rodriguez-R LM & Konstantinidis KT (2016). The enveomics collection: a toolbox
41
+ > for specialized analyses of microbial genomes and metagenomes.
42
+ > [PeerJ Preprints 4:e1900v1](https://peerj.com/preprints/1900/).
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # @author Luis M. Rodriguez-R
4
+ # @update Dec-21-2015
5
+ # @license artistic license 2.0
6
+ #
7
+
8
+ $:.push File.expand_path(File.dirname(__FILE__) + "/lib")
9
+ require "enveomics_rb/enveomics"
10
+
11
+ o = {permutations: 1000, bootstraps: 1000, overwrite: false}
12
+ OptionParser.new do |opt|
13
+ opt.banner = "
14
+ Estimates the log2-ratio of different amino acids in homologous sites using
15
+ an AAsubs file (see BlastPairwise.AAsubs.pl). It provides the point
16
+ estimation (.obs file), the bootstrap of the estimation (.boot file) and the
17
+ null model based on label-permutation (.null file).
18
+
19
+ Usage: #{$0} [options]".gsub(/^ +/,"")
20
+ opt.separator ""
21
+ opt.separator "Mandatory"
22
+ opt.on("-i", "--input FILE",
23
+ "Input file in AAsubs format (see BlastPairwise.AAsubs.pl)."
24
+ ){ |v| o[:file] = v}
25
+ opt.separator ""
26
+ opt.separator "Output files"
27
+ opt.on("-O", "--obs-file FILE",
28
+ "Output file with the log2-ratios per amino acid.",
29
+ "By default, '--input value'.obs."
30
+ ){ |v| o[:obs] = v }
31
+ opt.on("-B", "--bootstrap-file FILE",
32
+ "Output file with the bootstrap results of log2-ratios per amino acid.",
33
+ "By default, '--input value'.boot."
34
+ ){ |v| o[:boot] = v }
35
+ opt.on("-N", "--null-file FILE",
36
+ "Output file with the permutation results of log2-ratios per amino acid.",
37
+ "By default, '--input value'.null."
38
+ ){ |v| o[:null] = v }
39
+ opt.on("--overwrite",
40
+ "Overwrite existing files. By default, skip steps if the files already" +
41
+ " exist."){ |v| o[:overwrite] = v }
42
+ opt.separator ""
43
+ opt.separator "Parameters"
44
+ opt.on("-b", "--bootstraps INT",
45
+ "Number of bootstraps to run. By default: #{o[:bootstraps]}."
46
+ ){ |v| o[:bootstraps] = v.to_i }
47
+ opt.on("-p", "--permutations INT",
48
+ "Number of permutations to run. By default: #{o[:permutations]}."
49
+ ){ |v| o[:permutations] = v.to_i }
50
+ opt.on("-q", "--quiet", "Run quietly (no STDERR output)."){ o[:q] = TRUE }
51
+ opt.on("-h", "--help", "Display this screen.") do
52
+ puts opt
53
+ exit
54
+ end
55
+ opt.separator ""
56
+ end.parse!
57
+
58
+ # Initialize
59
+ abort "--input is mandatory" if o[:file].nil?
60
+ ALPHABET = %w(A C D E F G H I K L M N P Q R S T V W Y X)
61
+ o[:obs] ||= "#{o[:file]}.obs"
62
+ o[:boot] ||= "#{o[:file]}.boot"
63
+ o[:null] ||= "#{o[:file]}.null"
64
+
65
+ # Functions
66
+ def dist_summary(a,b)
67
+ ALPHABET.map do |i|
68
+ Math.log(a[i].reduce(0,:+).to_f/b[i].reduce(0,:+), 10)
69
+ end
70
+ end
71
+ def empty_sample
72
+ Hash[ALPHABET.map{|k| [k, []]}]
73
+ end
74
+
75
+ # Initialize
76
+ $stderr.puts "Initializing." unless o[:q]
77
+ sample_A = empty_sample
78
+ sample_B = empty_sample
79
+ last_label = nil
80
+ prot_index = -1
81
+
82
+ # Read file
83
+ $stderr.puts "Reading input file." unless o[:q]
84
+ ifh = File.open(o[:file], "r")
85
+ ifh.each do |l|
86
+ r = l.chomp.split /\t/
87
+ if r.first != last_label
88
+ prot_index +=1
89
+ last_label = r.first
90
+ ALPHABET.each do |a|
91
+ sample_A[a][prot_index] = 0
92
+ sample_B[a][prot_index] = 0
93
+ end
94
+ end
95
+ [1,2].each do |ds|
96
+ unless %w(- *).include? r[ds]
97
+ abort "Unknown amino acid in line #{$.}: '#{r[ds]}'." unless
98
+ ALPHABET.include? r[ds]
99
+ sample_A[ r[ds] ][ prot_index ] += 1 if ds==1
100
+ sample_B[ r[ds] ][ prot_index ] += 1 if ds==2
101
+ end
102
+ end
103
+ end
104
+ ifh.close
105
+ $stderr.puts " > Found #{prot_index+1} proteins." unless o[:q]
106
+ $stderr.puts " > Saving #{o[:obs]}" unless o[:q]
107
+ sum = dist_summary(sample_A, sample_B)
108
+ File.open(o[:obs], "w") do |fh|
109
+ fh.puts ["AA", "log10_AB"].join("\t")
110
+ ALPHABET.each do |i|
111
+ fh.puts [i, sum.shift].join("\t")
112
+ end
113
+ end
114
+
115
+ # Permutations
116
+ if File.size? o[:null] and not o[:overwrite]
117
+ $stderr.puts "Skipping permutations." unless o[:q]
118
+ else
119
+ $stderr.puts "Permutating." unless o[:q]
120
+ permut_sum = []
121
+ o[:permutations].times do |i|
122
+ permut_A = empty_sample
123
+ permut_B = empty_sample
124
+ (0 .. prot_index).each do |j|
125
+ # Copy counts of the protein
126
+ ALPHABET.each do |k|
127
+ permut_A[k][j] = sample_A[k][j]
128
+ permut_B[k][j] = sample_B[k][j]
129
+ end
130
+ # Swap labels at random
131
+ permut_A,permut_B = permut_B,permut_A if rand(2)==1
132
+ end
133
+ permut_sum << dist_summary(permut_A, permut_B)
134
+ end
135
+ $stderr.puts " > Performed #{o[:permutations]} permutations." unless o[:q]
136
+ $stderr.puts " > Saving #{o[:null]}" unless o[:q]
137
+ File.open(o[:null], "w") do |fh|
138
+ fh.puts ALPHABET.join("\t")
139
+ permut_sum.each{ |s| fh.puts s.join("\t") }
140
+ end
141
+ end
142
+
143
+ # Bootstraps
144
+ if File.size? o[:boot] and not o[:overwrite]
145
+ $stderr.puts "Skipping bootstraps." unless o[:q]
146
+ else
147
+ $stderr.puts "Bootstrapping." unless o[:q]
148
+ boot_sum = []
149
+ o[:bootstraps].times do |i|
150
+ boot_A = empty_sample
151
+ boot_B = empty_sample
152
+ (0 .. prot_index).each do |j|
153
+ # Sample randomly with replacement
154
+ jr = rand(prot_index+1)
155
+ # Copy counts of the protein
156
+ ALPHABET.each do |k|
157
+ boot_A[k][j] = sample_A[k][jr]
158
+ boot_B[k][j] = sample_B[k][jr]
159
+ end
160
+ end
161
+ boot_sum << dist_summary(boot_A, boot_B)
162
+ end
163
+ $stderr.puts " > Performed #{o[:bootstraps]} bootstraps." unless o[:q]
164
+ $stderr.puts " > Saving #{o[:boot]}" unless o[:q]
165
+ File.open(o[:boot], "w") do |fh|
166
+ fh.puts ALPHABET.join("\t")
167
+ boot_sum.each{ |s| fh.puts s.join("\t") }
168
+ end
169
+ end
170
+
171
+ $stderr.puts "Done. Yayyy!" unless o[:q]
@@ -0,0 +1,221 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # @author Luis M. Rodriguez-R
4
+ # @license artistic license 2.0
5
+
6
+ $VERSION = 1.0
7
+ $:.push File.expand_path('../lib', __FILE__)
8
+ require 'enveomics_rb/enveomics'
9
+
10
+ o = {
11
+ q: false, missing: '-', model: 'AUTO', removeinvar: false, undefined: '-.Xx?'
12
+ }
13
+
14
+ OptionParser.new do |opt|
15
+ cmd = File.basename($0)
16
+ opt.banner = <<~BANNER
17
+
18
+ [Enveomics Collection: #{cmd} v#{$VERSION}]
19
+
20
+ Concatenates several multiple alignments in FastA format into a single
21
+ multiple alignment. The IDs of the sequences (or the ID prefixes, if using
22
+ --ignore-after) must coincide across files.
23
+
24
+ Usage: #{cmd} [options] aln1.fa aln2.fa ... > aln.fa
25
+
26
+ BANNER
27
+ opt.on(
28
+ '-c', '--coords FILE',
29
+ 'Output file of coordinates in RAxML-compliant format'
30
+ ) { |v| o[:coords] = v }
31
+ opt.on(
32
+ '-i', '--ignore-after STRING',
33
+ 'Remove everything in the IDs after the specified string'
34
+ ) { |v| o[:ignoreafter] = v }
35
+ opt.on(
36
+ '-I', '--remove-invariable', 'Remove invariable sites',
37
+ 'Note: Invariable sites are defined as columns with only one state and',
38
+ 'undefined characters. Additional ambiguous characters may exist and',
39
+ 'should be declared using --undefined'
40
+ ) { |v| o[:removeinvar] = v }
41
+ opt.on(
42
+ '-u', '--missing-char CHAR',
43
+ "Character denoting missing data. By default: '#{o[:missing]}'"
44
+ ) do |v|
45
+ if v.length != 1
46
+ abort "-missing-char can only be denoted by single characters: #{v}"
47
+ end
48
+ o[:missing] = v
49
+ end
50
+ opt.on(
51
+ '-m', '--model STRING',
52
+ 'Name of the model to use if --coords is used. See RAxML docs;',
53
+ 'supported values in v8+ include:',
54
+ '~ For DNA alignments:',
55
+ ' "DNA[F|X]", or "DNA[F|X]/3" (to estimate rates per codon position,',
56
+ ' particular notation for this script)',
57
+ '~ General protein alignments:',
58
+ ' "AUTO" (default in this script), "DAYHOFF" (1978), "DCMUT" (MBE 2005;',
59
+ ' 22(2):193-199), "JTT" (Nat 1992;358:86-89), "VT" (JCompBiol 2000;',
60
+ ' 7(6):761-776), "BLOSUM62" (PNAS 1992;89:10915), and "LG" (MBE 2008;',
61
+ ' 25(7):1307-1320)',
62
+ '~ Specialized protein alignments:',
63
+ ' "MTREV" (mitochondrial, JME 1996;42(4):459-468), "WAG" (globular, MBE',
64
+ ' 2001;18(5):691-699), "RTREV" (retrovirus, JME 2002;55(1):65-73),',
65
+ ' "CPREV" (chloroplast, JME 2000;50(4):348-358), and "MTMAM" (nuclear',
66
+ ' mammal proteins, JME 1998;46(4):409-418)'
67
+ ) { |v| o[:model] = v }
68
+ opt.on(
69
+ '--undefined STRING',
70
+ 'All characters to be regarded as "undefined". It should include all',
71
+ 'ambiguous and missing data chars. Ignored unless --remove-invariable',
72
+ "By default: '#{o[:undefined]}'"
73
+ ) { |v| o[:undefined] = v }
74
+ opt.on('-q', '--quiet', 'Run quietly (no STDERR output)') { o[:q] = true }
75
+ opt.on('-V', '--version', 'Returns version') { puts $VERSION ; exit }
76
+ opt.on('-h', '--help', 'Display this screen') { puts opt ; exit }
77
+ opt.separator ''
78
+ end.parse!
79
+ files = ARGV
80
+ abort 'Alignment files are mandatory' if files.nil? || files.empty?
81
+ $QUIET = o[:q]
82
+
83
+ # Read individual gene alignments and return them as a single hash with genome
84
+ # IDs as keys and arrays of single-line strings as values
85
+ #
86
+ # IDs are trimmed after the first occurrence of +ignoreafter+, if defined
87
+ def read_alignments(files, ignoreafter = nil)
88
+ aln = {}
89
+ files.each_with_index do |file, i|
90
+ key = nil
91
+ File.open(file, 'r').each do |ln|
92
+ ln.chomp!
93
+ if ln =~ /^>(\S+)/
94
+ key = $1
95
+ key.sub!(/#{ignoreafter}.*/, '') if ignoreafter
96
+ aln[key] ||= []
97
+ aln[key][i] = ''
98
+ else
99
+ if key.nil?
100
+ abort "Invalid FastA file: #{file}: Leading line not a def-line"
101
+ end
102
+ ln.gsub!(/\s/, '')
103
+ aln[key][i] += ln
104
+ end
105
+ end
106
+ abort "Empty alignment file: #{file}" if key.nil?
107
+ end
108
+ aln
109
+ end
110
+
111
+ # Remove invariable sites from the alignment hash +aln+, using +undefined+ as
112
+ # a string including all characters representing undefined positions (e.g., X)
113
+ #
114
+ # Returns number of columns removed
115
+ def remove_invariable(aln, undefined)
116
+ invs = 0
117
+ lengths = aln.values.first.map(&:length)
118
+ undef_chars = undefined.chars
119
+
120
+ lengths.each_with_index do |len, i|
121
+ (0 .. len - 1).each do |pos|
122
+ chr = nil
123
+ inv = true
124
+ aln.each_key do |key|
125
+ next if aln[key][i].nil?
126
+ chr = aln[key][i][pos] if chr.nil? || undefined.chars.include?(chr)
127
+ if chr != aln[key][i][pos] && !undef_chars.include?(aln[key][i][pos])
128
+ inv = false
129
+ break
130
+ end
131
+ end
132
+ if inv
133
+ aln.each_key { |key| aln[key][i][pos] = '!' unless aln[key][i].nil? }
134
+ lengths[i] -= 1
135
+ invs += 1
136
+ end
137
+ end
138
+ aln.each_key { |key| aln[key][i].gsub!('!', '') unless aln[key][i].nil? }
139
+ end
140
+ invs
141
+ end
142
+
143
+ # Concatenate the alignments hash +aln+ using the character +missing+ to
144
+ # indicate missing alignments, and send each entry in the concatenated alignment
145
+ # to +blk+ as two variables: key (name) and value (alignment string)
146
+ #
147
+ # Returns an array with the lengths of each individual alignment
148
+ def concatenate(aln, missing, &blk)
149
+ say 'Concatenating'
150
+ lengths = aln.values.first.map(&:length)
151
+ aln.each_key do |key|
152
+ # Pad missing entries
153
+ lengths.each_with_index { |len, i| aln[key][i] ||= missing * len }
154
+
155
+ # Check length
156
+ obs_len = aln[key].map(&:length)
157
+ unless lengths == obs_len
158
+ abort "Inconsistent lengths in '#{key}'\nexp: #{lengths}\nobs: #{obs_len}"
159
+ end
160
+
161
+ # Pass entry to the block and remove from alignment hash
162
+ blk[key, aln[key].join('')]
163
+ aln.delete(key)
164
+ end
165
+ lengths
166
+ end
167
+
168
+ # Save the coordinates in +file+ based on +files+ paths (for the names), and
169
+ # using +lengths+ individual alignment lengths
170
+ #
171
+ # The saved format is RAxML coords, including the +model+ for each alignment
172
+ def save_coords(file, names, lengths, model)
173
+ File.open(file, 'w') do |fh|
174
+ s = 0
175
+ names.each_with_index do |name, i|
176
+ l = lengths[i]
177
+ next unless l > 0
178
+ name += "_#{i}" while names.count(name) > 1
179
+ if model =~ /(DNA.?)\/3/
180
+ fh.puts "#{$1}, #{name}codon1 = #{s + 1}-#{s + l}\\3"
181
+ fh.puts "#{$1}, #{name}codon2 = #{s + 2}-#{s + l}\\3"
182
+ fh.puts "#{$1}, #{name}codon3 = #{s + 3}-#{s + l}\\3"
183
+ else
184
+ fh.puts "#{model}, #{name} = #{s + 1}-#{s + l}"
185
+ end
186
+ s += l
187
+ end
188
+ end
189
+ end
190
+
191
+ # ------ MAIN ------
192
+ begin
193
+ say 'Reading'
194
+ alignments = read_alignments(files, o[:ignoreafter])
195
+
196
+ if o[:removeinvar]
197
+ say 'Removing invariable sites'
198
+ inv = remove_invariable(alignments, o[:undefined])
199
+ say " Removed #{inv} sites"
200
+ end
201
+
202
+ lengths = concatenate(alignments, o[:missing]) do |name, seq|
203
+ puts ">#{name}", seq.gsub(/(.{1,60})/, "\\1\n")
204
+ end
205
+ say " #{lengths.inject(:+)} columns"
206
+
207
+ unless o[:coords].nil?
208
+ say 'Generating coordinates'
209
+ names = files.map do |i|
210
+ File.basename(i).gsub(/\..*/, '').gsub(/[^A-Za-z0-9_]/, '_')
211
+ end
212
+ save_coords(o[:coords], names, lengths, o[:model])
213
+ end
214
+
215
+ $stderr.puts 'Done' unless o[:q]
216
+ rescue => err
217
+ $stderr.puts "Exception: #{err}\n\n"
218
+ err.backtrace.each { |l| $stderr.puts l + "\n" }
219
+ err
220
+ end
221
+
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env perl
2
+
3
+ #
4
+ # @author: Luis M. Rodriguez-R
5
+ # @update: Mar-23-2015
6
+ # @license: artistic license 2.0
7
+ #
8
+
9
+ use Bio::AlignIO;
10
+
11
+ my($iformat,$oformat) = @ARGV;
12
+ ($iformat and $oformat) or die "
13
+ Usage:
14
+ $0 in-format out-format < in_file > output_file
15
+
16
+ in-format Input file's format.
17
+ out-format Output file's format.
18
+ in_file Input file.
19
+ out_file Output file.
20
+
21
+ Example:
22
+ # Re-format example.fa into Stockholm
23
+ $0 fasta stockholm < example.fa > example.stk
24
+
25
+ Supported formats are:
26
+ bl2seq, clustalw, emboss, fasta, maf, mase, mega,
27
+ meme, metafasta, msf, nexus, pfam, phylip, po,
28
+ prodom, psi, selex, stockholm, XMFA, arp
29
+
30
+ ";
31
+
32
+ $in = Bio::AlignIO->new(-fh => \*STDIN, -format => $iformat);
33
+ $out = Bio::AlignIO->new(-fh => \*STDOUT, -format => $oformat);
34
+ while ( my $aln = $in->next_aln ) { $out->write_aln($aln) }
35
+