miga-base 0.7.26.0 → 1.0.0.1

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 (337) hide show
  1. checksums.yaml +4 -4
  2. data/lib/miga/_data/aai-intax.blast.tsv.gz +0 -0
  3. data/lib/miga/_data/aai-intax.diamond.tsv.gz +0 -0
  4. data/lib/miga/_data/aai-novel.blast.tsv.gz +0 -0
  5. data/lib/miga/_data/aai-novel.diamond.tsv.gz +0 -0
  6. data/lib/miga/cli/action/classify_wf.rb +2 -2
  7. data/lib/miga/cli/action/derep_wf.rb +1 -1
  8. data/lib/miga/cli/action/doctor.rb +57 -14
  9. data/lib/miga/cli/action/doctor/base.rb +47 -23
  10. data/lib/miga/cli/action/init.rb +11 -7
  11. data/lib/miga/cli/action/init/files_helper.rb +1 -0
  12. data/lib/miga/cli/action/ncbi_get.rb +3 -3
  13. data/lib/miga/cli/action/tax_dist.rb +2 -2
  14. data/lib/miga/cli/action/wf.rb +5 -4
  15. data/lib/miga/common.rb +1 -0
  16. data/lib/miga/daemon.rb +11 -4
  17. data/lib/miga/dataset/result.rb +10 -6
  18. data/lib/miga/json.rb +5 -4
  19. data/lib/miga/metadata.rb +5 -1
  20. data/lib/miga/parallel.rb +36 -0
  21. data/lib/miga/project.rb +8 -8
  22. data/lib/miga/project/base.rb +4 -4
  23. data/lib/miga/project/result.rb +2 -2
  24. data/lib/miga/sqlite.rb +10 -2
  25. data/lib/miga/version.rb +23 -9
  26. data/scripts/aai_distances.bash +16 -18
  27. data/scripts/ani_distances.bash +16 -17
  28. data/scripts/assembly.bash +31 -16
  29. data/scripts/haai_distances.bash +3 -27
  30. data/scripts/miga.bash +6 -4
  31. data/scripts/p.bash +1 -1
  32. data/scripts/read_quality.bash +9 -18
  33. data/scripts/trimmed_fasta.bash +14 -30
  34. data/scripts/trimmed_reads.bash +36 -36
  35. data/test/parallel_test.rb +31 -0
  36. data/test/project_test.rb +2 -1
  37. data/test/remote_dataset_test.rb +1 -1
  38. data/utils/FastAAI/00.Libraries/01.SCG_HMMs/Archaea_SCG.hmm +41964 -0
  39. data/utils/FastAAI/00.Libraries/01.SCG_HMMs/Bacteria_SCG.hmm +32439 -0
  40. data/utils/FastAAI/00.Libraries/01.SCG_HMMs/Complete_SCG_DB.hmm +62056 -0
  41. data/utils/FastAAI/FastAAI/FastAAI +1336 -0
  42. data/utils/FastAAI/README.md +84 -0
  43. data/utils/FastAAI/kAAI_v1.0_virus.py +1296 -0
  44. data/utils/distance/commands.rb +1 -0
  45. data/utils/distance/database.rb +0 -1
  46. data/utils/distance/runner.rb +2 -4
  47. data/utils/enveomics/Docs/recplot2.md +244 -0
  48. data/utils/enveomics/Examples/aai-matrix.bash +66 -0
  49. data/utils/enveomics/Examples/ani-matrix.bash +66 -0
  50. data/utils/enveomics/Examples/essential-phylogeny.bash +105 -0
  51. data/utils/enveomics/Examples/unus-genome-phylogeny.bash +100 -0
  52. data/utils/enveomics/LICENSE.txt +73 -0
  53. data/utils/enveomics/Makefile +52 -0
  54. data/utils/enveomics/Manifest/Tasks/aasubs.json +103 -0
  55. data/utils/enveomics/Manifest/Tasks/blasttab.json +786 -0
  56. data/utils/enveomics/Manifest/Tasks/distances.json +161 -0
  57. data/utils/enveomics/Manifest/Tasks/fasta.json +802 -0
  58. data/utils/enveomics/Manifest/Tasks/fastq.json +291 -0
  59. data/utils/enveomics/Manifest/Tasks/graphics.json +126 -0
  60. data/utils/enveomics/Manifest/Tasks/mapping.json +137 -0
  61. data/utils/enveomics/Manifest/Tasks/ogs.json +382 -0
  62. data/utils/enveomics/Manifest/Tasks/other.json +906 -0
  63. data/utils/enveomics/Manifest/Tasks/remote.json +355 -0
  64. data/utils/enveomics/Manifest/Tasks/sequence-identity.json +638 -0
  65. data/utils/enveomics/Manifest/Tasks/tables.json +308 -0
  66. data/utils/enveomics/Manifest/Tasks/trees.json +68 -0
  67. data/utils/enveomics/Manifest/Tasks/variants.json +111 -0
  68. data/utils/enveomics/Manifest/categories.json +165 -0
  69. data/utils/enveomics/Manifest/examples.json +154 -0
  70. data/utils/enveomics/Manifest/tasks.json +4 -0
  71. data/utils/enveomics/Pipelines/assembly.pbs/CONFIG.mock.bash +69 -0
  72. data/utils/enveomics/Pipelines/assembly.pbs/FastA.N50.pl +1 -0
  73. data/utils/enveomics/Pipelines/assembly.pbs/FastA.filterN.pl +1 -0
  74. data/utils/enveomics/Pipelines/assembly.pbs/FastA.length.pl +1 -0
  75. data/utils/enveomics/Pipelines/assembly.pbs/README.md +189 -0
  76. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-2.bash +112 -0
  77. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-3.bash +23 -0
  78. data/utils/enveomics/Pipelines/assembly.pbs/RUNME-4.bash +44 -0
  79. data/utils/enveomics/Pipelines/assembly.pbs/RUNME.bash +50 -0
  80. data/utils/enveomics/Pipelines/assembly.pbs/kSelector.R +37 -0
  81. data/utils/enveomics/Pipelines/assembly.pbs/newbler.pbs +68 -0
  82. data/utils/enveomics/Pipelines/assembly.pbs/newbler_preparator.pl +49 -0
  83. data/utils/enveomics/Pipelines/assembly.pbs/soap.pbs +80 -0
  84. data/utils/enveomics/Pipelines/assembly.pbs/stats.pbs +57 -0
  85. data/utils/enveomics/Pipelines/assembly.pbs/velvet.pbs +63 -0
  86. data/utils/enveomics/Pipelines/blast.pbs/01.pbs.bash +38 -0
  87. data/utils/enveomics/Pipelines/blast.pbs/02.pbs.bash +73 -0
  88. data/utils/enveomics/Pipelines/blast.pbs/03.pbs.bash +21 -0
  89. data/utils/enveomics/Pipelines/blast.pbs/BlastTab.recover_job.pl +72 -0
  90. data/utils/enveomics/Pipelines/blast.pbs/CONFIG.mock.bash +98 -0
  91. data/utils/enveomics/Pipelines/blast.pbs/FastA.split.pl +1 -0
  92. data/utils/enveomics/Pipelines/blast.pbs/README.md +127 -0
  93. data/utils/enveomics/Pipelines/blast.pbs/RUNME.bash +109 -0
  94. data/utils/enveomics/Pipelines/blast.pbs/TASK.check.bash +128 -0
  95. data/utils/enveomics/Pipelines/blast.pbs/TASK.dry.bash +16 -0
  96. data/utils/enveomics/Pipelines/blast.pbs/TASK.eo.bash +22 -0
  97. data/utils/enveomics/Pipelines/blast.pbs/TASK.pause.bash +26 -0
  98. data/utils/enveomics/Pipelines/blast.pbs/TASK.run.bash +89 -0
  99. data/utils/enveomics/Pipelines/blast.pbs/sentinel.pbs.bash +29 -0
  100. data/utils/enveomics/Pipelines/idba.pbs/README.md +49 -0
  101. data/utils/enveomics/Pipelines/idba.pbs/RUNME.bash +95 -0
  102. data/utils/enveomics/Pipelines/idba.pbs/run.pbs +56 -0
  103. data/utils/enveomics/Pipelines/trim.pbs/README.md +54 -0
  104. data/utils/enveomics/Pipelines/trim.pbs/RUNME.bash +70 -0
  105. data/utils/enveomics/Pipelines/trim.pbs/run.pbs +130 -0
  106. data/utils/enveomics/README.md +42 -0
  107. data/utils/enveomics/Scripts/AAsubs.log2ratio.rb +171 -0
  108. data/utils/enveomics/Scripts/Aln.cat.rb +221 -0
  109. data/utils/enveomics/Scripts/Aln.convert.pl +35 -0
  110. data/utils/enveomics/Scripts/AlphaDiversity.pl +152 -0
  111. data/utils/enveomics/Scripts/BedGraph.tad.rb +93 -0
  112. data/utils/enveomics/Scripts/BedGraph.window.rb +71 -0
  113. data/utils/enveomics/Scripts/BlastPairwise.AAsubs.pl +102 -0
  114. data/utils/enveomics/Scripts/BlastTab.addlen.rb +63 -0
  115. data/utils/enveomics/Scripts/BlastTab.advance.bash +48 -0
  116. data/utils/enveomics/Scripts/BlastTab.best_hit_sorted.pl +55 -0
  117. data/utils/enveomics/Scripts/BlastTab.catsbj.pl +104 -0
  118. data/utils/enveomics/Scripts/BlastTab.cogCat.rb +76 -0
  119. data/utils/enveomics/Scripts/BlastTab.filter.pl +47 -0
  120. data/utils/enveomics/Scripts/BlastTab.kegg_pep2path_rest.pl +194 -0
  121. data/utils/enveomics/Scripts/BlastTab.metaxaPrep.pl +104 -0
  122. data/utils/enveomics/Scripts/BlastTab.pairedHits.rb +157 -0
  123. data/utils/enveomics/Scripts/BlastTab.recplot2.R +48 -0
  124. data/utils/enveomics/Scripts/BlastTab.seqdepth.pl +86 -0
  125. data/utils/enveomics/Scripts/BlastTab.seqdepth_ZIP.pl +119 -0
  126. data/utils/enveomics/Scripts/BlastTab.seqdepth_nomedian.pl +86 -0
  127. data/utils/enveomics/Scripts/BlastTab.subsample.pl +47 -0
  128. data/utils/enveomics/Scripts/BlastTab.sumPerHit.pl +114 -0
  129. data/utils/enveomics/Scripts/BlastTab.taxid2taxrank.pl +90 -0
  130. data/utils/enveomics/Scripts/BlastTab.topHits_sorted.rb +101 -0
  131. data/utils/enveomics/Scripts/Chao1.pl +97 -0
  132. data/utils/enveomics/Scripts/CharTable.classify.rb +234 -0
  133. data/utils/enveomics/Scripts/EBIseq2tax.rb +83 -0
  134. data/utils/enveomics/Scripts/FastA.N50.pl +60 -0
  135. data/utils/enveomics/Scripts/FastA.extract.rb +152 -0
  136. data/utils/enveomics/Scripts/FastA.filter.pl +52 -0
  137. data/utils/enveomics/Scripts/FastA.filterLen.pl +28 -0
  138. data/utils/enveomics/Scripts/FastA.filterN.pl +60 -0
  139. data/utils/enveomics/Scripts/FastA.fragment.rb +100 -0
  140. data/utils/enveomics/Scripts/FastA.gc.pl +42 -0
  141. data/utils/enveomics/Scripts/FastA.interpose.pl +93 -0
  142. data/utils/enveomics/Scripts/FastA.length.pl +38 -0
  143. data/utils/enveomics/Scripts/FastA.mask.rb +89 -0
  144. data/utils/enveomics/Scripts/FastA.per_file.pl +36 -0
  145. data/utils/enveomics/Scripts/FastA.qlen.pl +57 -0
  146. data/utils/enveomics/Scripts/FastA.rename.pl +65 -0
  147. data/utils/enveomics/Scripts/FastA.revcom.pl +23 -0
  148. data/utils/enveomics/Scripts/FastA.sample.rb +98 -0
  149. data/utils/enveomics/Scripts/FastA.slider.pl +85 -0
  150. data/utils/enveomics/Scripts/FastA.split.pl +55 -0
  151. data/utils/enveomics/Scripts/FastA.split.rb +79 -0
  152. data/utils/enveomics/Scripts/FastA.subsample.pl +131 -0
  153. data/utils/enveomics/Scripts/FastA.tag.rb +65 -0
  154. data/utils/enveomics/Scripts/FastA.toFastQ.rb +69 -0
  155. data/utils/enveomics/Scripts/FastA.wrap.rb +48 -0
  156. data/utils/enveomics/Scripts/FastQ.filter.pl +54 -0
  157. data/utils/enveomics/Scripts/FastQ.interpose.pl +90 -0
  158. data/utils/enveomics/Scripts/FastQ.maskQual.rb +89 -0
  159. data/utils/enveomics/Scripts/FastQ.offset.pl +90 -0
  160. data/utils/enveomics/Scripts/FastQ.split.pl +53 -0
  161. data/utils/enveomics/Scripts/FastQ.tag.rb +70 -0
  162. data/utils/enveomics/Scripts/FastQ.test-error.rb +81 -0
  163. data/utils/enveomics/Scripts/FastQ.toFastA.awk +24 -0
  164. data/utils/enveomics/Scripts/GFF.catsbj.pl +127 -0
  165. data/utils/enveomics/Scripts/GenBank.add_fields.rb +84 -0
  166. data/utils/enveomics/Scripts/HMM.essential.rb +351 -0
  167. data/utils/enveomics/Scripts/HMM.haai.rb +168 -0
  168. data/utils/enveomics/Scripts/HMMsearch.extractIds.rb +83 -0
  169. data/utils/enveomics/Scripts/JPlace.distances.rb +88 -0
  170. data/utils/enveomics/Scripts/JPlace.to_iToL.rb +320 -0
  171. data/utils/enveomics/Scripts/M5nr.getSequences.rb +81 -0
  172. data/utils/enveomics/Scripts/MeTaxa.distribution.pl +198 -0
  173. data/utils/enveomics/Scripts/MyTaxa.fragsByTax.pl +35 -0
  174. data/utils/enveomics/Scripts/MyTaxa.seq-taxrank.rb +49 -0
  175. data/utils/enveomics/Scripts/NCBIacc2tax.rb +92 -0
  176. data/utils/enveomics/Scripts/Newick.autoprune.R +27 -0
  177. data/utils/enveomics/Scripts/RAxML-EPA.to_iToL.pl +228 -0
  178. data/utils/enveomics/Scripts/RecPlot2.compareIdentities.R +32 -0
  179. data/utils/enveomics/Scripts/RefSeq.download.bash +48 -0
  180. data/utils/enveomics/Scripts/SRA.download.bash +55 -0
  181. data/utils/enveomics/Scripts/TRIBS.plot-test.R +36 -0
  182. data/utils/enveomics/Scripts/TRIBS.test.R +39 -0
  183. data/utils/enveomics/Scripts/Table.barplot.R +31 -0
  184. data/utils/enveomics/Scripts/Table.df2dist.R +30 -0
  185. data/utils/enveomics/Scripts/Table.filter.pl +61 -0
  186. data/utils/enveomics/Scripts/Table.merge.pl +77 -0
  187. data/utils/enveomics/Scripts/Table.prefScore.R +60 -0
  188. data/utils/enveomics/Scripts/Table.replace.rb +69 -0
  189. data/utils/enveomics/Scripts/Table.round.rb +63 -0
  190. data/utils/enveomics/Scripts/Table.split.pl +57 -0
  191. data/utils/enveomics/Scripts/Taxonomy.silva2ncbi.rb +227 -0
  192. data/utils/enveomics/Scripts/VCF.KaKs.rb +147 -0
  193. data/utils/enveomics/Scripts/VCF.SNPs.rb +88 -0
  194. data/utils/enveomics/Scripts/aai.rb +419 -0
  195. data/utils/enveomics/Scripts/ani.rb +362 -0
  196. data/utils/enveomics/Scripts/anir.rb +137 -0
  197. data/utils/enveomics/Scripts/clust.rand.rb +102 -0
  198. data/utils/enveomics/Scripts/gi2tax.rb +103 -0
  199. data/utils/enveomics/Scripts/in_silico_GA_GI.pl +96 -0
  200. data/utils/enveomics/Scripts/lib/data/dupont_2012_essential.hmm.gz +0 -0
  201. data/utils/enveomics/Scripts/lib/data/lee_2019_essential.hmm.gz +0 -0
  202. data/utils/enveomics/Scripts/lib/enveomics.R +1 -0
  203. data/utils/enveomics/Scripts/lib/enveomics_rb/anir.rb +293 -0
  204. data/utils/enveomics/Scripts/lib/enveomics_rb/bm_set.rb +175 -0
  205. data/utils/enveomics/Scripts/lib/enveomics_rb/enveomics.rb +24 -0
  206. data/utils/enveomics/Scripts/lib/enveomics_rb/errors.rb +17 -0
  207. data/utils/enveomics/Scripts/lib/enveomics_rb/gmm_em.rb +30 -0
  208. data/utils/enveomics/Scripts/lib/enveomics_rb/jplace.rb +253 -0
  209. data/utils/enveomics/Scripts/lib/enveomics_rb/match.rb +63 -0
  210. data/utils/enveomics/Scripts/lib/enveomics_rb/og.rb +182 -0
  211. data/utils/enveomics/Scripts/lib/enveomics_rb/rbm.rb +49 -0
  212. data/utils/enveomics/Scripts/lib/enveomics_rb/remote_data.rb +74 -0
  213. data/utils/enveomics/Scripts/lib/enveomics_rb/seq_range.rb +237 -0
  214. data/utils/enveomics/Scripts/lib/enveomics_rb/stats.rb +3 -0
  215. data/utils/enveomics/Scripts/lib/enveomics_rb/stats/rand.rb +31 -0
  216. data/utils/enveomics/Scripts/lib/enveomics_rb/stats/sample.rb +152 -0
  217. data/utils/enveomics/Scripts/lib/enveomics_rb/utils.rb +73 -0
  218. data/utils/enveomics/Scripts/lib/enveomics_rb/vcf.rb +135 -0
  219. data/utils/enveomics/Scripts/ogs.annotate.rb +88 -0
  220. data/utils/enveomics/Scripts/ogs.core-pan.rb +160 -0
  221. data/utils/enveomics/Scripts/ogs.extract.rb +125 -0
  222. data/utils/enveomics/Scripts/ogs.mcl.rb +186 -0
  223. data/utils/enveomics/Scripts/ogs.rb +104 -0
  224. data/utils/enveomics/Scripts/ogs.stats.rb +131 -0
  225. data/utils/enveomics/Scripts/rbm-legacy.rb +172 -0
  226. data/utils/enveomics/Scripts/rbm.rb +100 -0
  227. data/utils/enveomics/Scripts/sam.filter.rb +148 -0
  228. data/utils/enveomics/Tests/Makefile +10 -0
  229. data/utils/enveomics/Tests/Mgen_M2288.faa +3189 -0
  230. data/utils/enveomics/Tests/Mgen_M2288.fna +8282 -0
  231. data/utils/enveomics/Tests/Mgen_M2321.fna +8288 -0
  232. data/utils/enveomics/Tests/Nequ_Kin4M.faa +2970 -0
  233. data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.tribs.Rdata +0 -0
  234. data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.txt +7 -0
  235. data/utils/enveomics/Tests/Xanthomonas_oryzae.aai-mat.tsv +17 -0
  236. data/utils/enveomics/Tests/Xanthomonas_oryzae.aai.tsv +137 -0
  237. data/utils/enveomics/Tests/a_mg.cds-go.blast.tsv +123 -0
  238. data/utils/enveomics/Tests/a_mg.reads-cds.blast.tsv +200 -0
  239. data/utils/enveomics/Tests/a_mg.reads-cds.counts.tsv +55 -0
  240. data/utils/enveomics/Tests/alkB.nwk +1 -0
  241. data/utils/enveomics/Tests/anthrax-cansnp-data.tsv +13 -0
  242. data/utils/enveomics/Tests/anthrax-cansnp-key.tsv +17 -0
  243. data/utils/enveomics/Tests/hiv1.faa +59 -0
  244. data/utils/enveomics/Tests/hiv1.fna +134 -0
  245. data/utils/enveomics/Tests/hiv2.faa +70 -0
  246. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv +233 -0
  247. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.lim +1 -0
  248. data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.rec +233 -0
  249. data/utils/enveomics/Tests/phyla_counts.tsv +10 -0
  250. data/utils/enveomics/Tests/primate_lentivirus.ogs +11 -0
  251. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv1.rbm +9 -0
  252. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv2.rbm +8 -0
  253. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-siv.rbm +6 -0
  254. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-hiv2.rbm +9 -0
  255. data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-siv.rbm +6 -0
  256. data/utils/enveomics/Tests/primate_lentivirus.rbm/siv-siv.rbm +6 -0
  257. data/utils/enveomics/build_enveomics_r.bash +45 -0
  258. data/utils/enveomics/enveomics.R/DESCRIPTION +31 -0
  259. data/utils/enveomics/enveomics.R/NAMESPACE +39 -0
  260. data/utils/enveomics/enveomics.R/R/autoprune.R +155 -0
  261. data/utils/enveomics/enveomics.R/R/barplot.R +184 -0
  262. data/utils/enveomics/enveomics.R/R/cliopts.R +135 -0
  263. data/utils/enveomics/enveomics.R/R/df2dist.R +154 -0
  264. data/utils/enveomics/enveomics.R/R/growthcurve.R +331 -0
  265. data/utils/enveomics/enveomics.R/R/prefscore.R +79 -0
  266. data/utils/enveomics/enveomics.R/R/recplot.R +354 -0
  267. data/utils/enveomics/enveomics.R/R/recplot2.R +1631 -0
  268. data/utils/enveomics/enveomics.R/R/tribs.R +583 -0
  269. data/utils/enveomics/enveomics.R/R/utils.R +80 -0
  270. data/utils/enveomics/enveomics.R/README.md +81 -0
  271. data/utils/enveomics/enveomics.R/data/growth.curves.rda +0 -0
  272. data/utils/enveomics/enveomics.R/data/phyla.counts.rda +0 -0
  273. data/utils/enveomics/enveomics.R/man/cash-enve.GrowthCurve-method.Rd +16 -0
  274. data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2-method.Rd +16 -0
  275. data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2.Peak-method.Rd +16 -0
  276. data/utils/enveomics/enveomics.R/man/enve.GrowthCurve-class.Rd +25 -0
  277. data/utils/enveomics/enveomics.R/man/enve.TRIBS-class.Rd +46 -0
  278. data/utils/enveomics/enveomics.R/man/enve.TRIBS.merge.Rd +23 -0
  279. data/utils/enveomics/enveomics.R/man/enve.TRIBStest-class.Rd +47 -0
  280. data/utils/enveomics/enveomics.R/man/enve.__prune.iter.Rd +23 -0
  281. data/utils/enveomics/enveomics.R/man/enve.__prune.reduce.Rd +23 -0
  282. data/utils/enveomics/enveomics.R/man/enve.__tribs.Rd +40 -0
  283. data/utils/enveomics/enveomics.R/man/enve.barplot.Rd +103 -0
  284. data/utils/enveomics/enveomics.R/man/enve.cliopts.Rd +67 -0
  285. data/utils/enveomics/enveomics.R/man/enve.col.alpha.Rd +24 -0
  286. data/utils/enveomics/enveomics.R/man/enve.col2alpha.Rd +19 -0
  287. data/utils/enveomics/enveomics.R/man/enve.df2dist.Rd +45 -0
  288. data/utils/enveomics/enveomics.R/man/enve.df2dist.group.Rd +44 -0
  289. data/utils/enveomics/enveomics.R/man/enve.df2dist.list.Rd +47 -0
  290. data/utils/enveomics/enveomics.R/man/enve.growthcurve.Rd +75 -0
  291. data/utils/enveomics/enveomics.R/man/enve.prefscore.Rd +50 -0
  292. data/utils/enveomics/enveomics.R/man/enve.prune.dist.Rd +44 -0
  293. data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +139 -0
  294. data/utils/enveomics/enveomics.R/man/enve.recplot2-class.Rd +45 -0
  295. data/utils/enveomics/enveomics.R/man/enve.recplot2.ANIr.Rd +24 -0
  296. data/utils/enveomics/enveomics.R/man/enve.recplot2.Rd +77 -0
  297. data/utils/enveomics/enveomics.R/man/enve.recplot2.__counts.Rd +25 -0
  298. data/utils/enveomics/enveomics.R/man/enve.recplot2.__peakHist.Rd +21 -0
  299. data/utils/enveomics/enveomics.R/man/enve.recplot2.__whichClosestPeak.Rd +19 -0
  300. data/utils/enveomics/enveomics.R/man/enve.recplot2.changeCutoff.Rd +19 -0
  301. data/utils/enveomics/enveomics.R/man/enve.recplot2.compareIdentities.Rd +47 -0
  302. data/utils/enveomics/enveomics.R/man/enve.recplot2.coordinates.Rd +29 -0
  303. data/utils/enveomics/enveomics.R/man/enve.recplot2.corePeak.Rd +18 -0
  304. data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +45 -0
  305. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.Rd +36 -0
  306. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_e.Rd +19 -0
  307. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_m.Rd +19 -0
  308. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__emauto_one.Rd +27 -0
  309. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mow_one.Rd +52 -0
  310. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mower.Rd +17 -0
  311. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.em.Rd +51 -0
  312. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.emauto.Rd +43 -0
  313. data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.mower.Rd +82 -0
  314. data/utils/enveomics/enveomics.R/man/enve.recplot2.peak-class.Rd +59 -0
  315. data/utils/enveomics/enveomics.R/man/enve.recplot2.seqdepth.Rd +27 -0
  316. data/utils/enveomics/enveomics.R/man/enve.recplot2.windowDepthThreshold.Rd +36 -0
  317. data/utils/enveomics/enveomics.R/man/enve.selvector.Rd +23 -0
  318. data/utils/enveomics/enveomics.R/man/enve.tribs.Rd +68 -0
  319. data/utils/enveomics/enveomics.R/man/enve.tribs.test.Rd +28 -0
  320. data/utils/enveomics/enveomics.R/man/enve.truncate.Rd +27 -0
  321. data/utils/enveomics/enveomics.R/man/growth.curves.Rd +14 -0
  322. data/utils/enveomics/enveomics.R/man/phyla.counts.Rd +13 -0
  323. data/utils/enveomics/enveomics.R/man/plot.enve.GrowthCurve.Rd +78 -0
  324. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBS.Rd +46 -0
  325. data/utils/enveomics/enveomics.R/man/plot.enve.TRIBStest.Rd +45 -0
  326. data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +125 -0
  327. data/utils/enveomics/enveomics.R/man/summary.enve.GrowthCurve.Rd +19 -0
  328. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBS.Rd +19 -0
  329. data/utils/enveomics/enveomics.R/man/summary.enve.TRIBStest.Rd +19 -0
  330. data/utils/enveomics/globals.mk +8 -0
  331. data/utils/enveomics/manifest.json +9 -0
  332. data/utils/multitrim/Multitrim How-To.pdf +0 -0
  333. data/utils/multitrim/README.md +67 -0
  334. data/utils/multitrim/multitrim.py +1555 -0
  335. data/utils/multitrim/multitrim.yml +13 -0
  336. data/utils/requirements.txt +4 -3
  337. metadata +304 -3
@@ -0,0 +1,184 @@
1
+ #' Enveomics: Barplot
2
+ #'
3
+ #' Creates nice barplots from tab-delimited tables.
4
+ #'
5
+ #' @param x Can be either the input data or the path to the file containing
6
+ #' the table.
7
+ #' \itemize{
8
+ #' \item{If it contains the data, it must be a data frame or an
9
+ #' object coercible to a data frame.}
10
+ #' \item{If it is a path, it must point to a
11
+ #' tab-delimited file containing a header (first row) and row names
12
+ #' (first column).}
13
+ #' }
14
+ #' @param sizes A numeric vector containing the real size of the samples
15
+ #' (columns) in the same order of the input table. If set, the values are
16
+ #' assumed to be 100\%. Otherwise, the sum of the columns is used.
17
+ #' @param top Maximum number of categories to display. Any additional
18
+ #' categories will be listed as "Others".
19
+ #' @param colors.per.group Number of categories in the first two saturation
20
+ #' groups of colors. The third group contains the remaining categories if
21
+ #' needed.
22
+ #' @param bars.width Width of the barplot with respect to the legend.
23
+ #' @param legend.ncol Number of columns in the legend.
24
+ #' @param other.col Color of the "Others" category.
25
+ #' @param add.trend Controls if semi-transparent areas are to be plotted
26
+ #' between the bars to connect the regions (trend regions).
27
+ #' @param organic.trend Controls if the trend regions are to be smoothed
28
+ #' (curves). By default, trend regions have straight edges. If \code{TRUE},
29
+ #' forces \code{add.trend=TRUE}.
30
+ #' @param sort.by Any function that takes a numeric vector and returns a
31
+ #' numeric scalar. This function is applied to each row, and the resulting
32
+ #' values are used to sort the rows (decreasingly). Good options include:
33
+ #' \code{sd, min, max, mean, median}.
34
+ #' @param min.report Minimum percentage to report the value in the plot.
35
+ #' Any value above 100 indicates that no values are to be reported.
36
+ #' @param order Controls how the rows should be ordered.
37
+ #' \itemize{
38
+ #' \item{If \code{NULL}
39
+ #' (default), \code{sort.by} is applied per row and the results are
40
+ #' sorted decreasingly.}
41
+ #' \item{If \code{NA}, no sorting is performed, i.e., the original
42
+ #' order is respected.}
43
+ #' \item{If a vector is provided, it is assumed to be the
44
+ #' custom order to be used (either by numeric index or by row names).}
45
+ #' }
46
+ #' @param col Colors to use. If provided, overrides the variables \code{top}
47
+ #' and \code{colors.per.group}, but \code{other.col} is still used if the
48
+ #' vector is insufficient for all the rows. An additional palette is available with
49
+ #' \code{col='coto'} (contributed by Luis (Coto) Orellana).
50
+ #' @param ... Any additional parameters to be passed to barplot.
51
+ #'
52
+ #' @author Luis M. Rodriguez-R [aut, cre]
53
+ #'
54
+ #' @examples
55
+ #' # Load data
56
+ #' data("phyla.counts", package="enveomics.R", envir=environment())
57
+ #' # Create a barplot sorted by variance with organic trends
58
+ #' enve.barplot(
59
+ #' phyla.counts, # Counts of phyla in four sites
60
+ #' sizes=c(250,100,75,200), # Total sizes of the datasets of each site
61
+ #' bars.width=2, # Decrease from default, so the names are fully displayed
62
+ #' organic.trend=TRUE, # Nice curvy background
63
+ #' sort.by=var # Sort by variance across sites
64
+ #' )
65
+ #'
66
+ #' @export
67
+
68
+ enve.barplot <- function(
69
+ x,
70
+ sizes,
71
+ top=25,
72
+ colors.per.group=9,
73
+ bars.width=4,
74
+ legend.ncol=1,
75
+ other.col='#000000',
76
+ add.trend=FALSE,
77
+ organic.trend=FALSE,
78
+ sort.by=median,
79
+ min.report=101,
80
+ order=NULL,
81
+ col,
82
+ ...
83
+ ){
84
+
85
+ # Read input
86
+ if(is.character(x)){
87
+ c <- read.table(x, sep='\t', header=TRUE, row.names=1, quote='',
88
+ comment.char='')
89
+ }else{
90
+ c <- as.data.frame(x)
91
+ }
92
+ if(missing(sizes)) sizes = colSums(c)
93
+ p <- c
94
+ for (i in 1:ncol(c)) p[, i] <- c[, i]*100/sizes[i]
95
+ if(top > nrow(p)) top = nrow(p)
96
+
97
+ # Sort
98
+ if(is.null(order[1])){
99
+ p <- p[order(apply(p, 1, sort.by)), ]
100
+ }else if(is.na(order[1])){
101
+
102
+ }else{
103
+ p <- p[order, ]
104
+ }
105
+ if(organic.trend) add.trend=TRUE
106
+
107
+ # Colors
108
+ if(is.null(top)) top <- nrow(p)
109
+ if(missing(col)){
110
+ color.col <- rainbow(min(colors.per.group, top), s=1, v=4/5)
111
+ if(top > colors.per.group) color.col <- c(color.col,
112
+ rainbow(min(colors.per.group*2, top)-colors.per.group, s=3/4, v=3/5))
113
+ if(top > colors.per.group*2) color.col <- c(color.col,
114
+ rainbow(top-colors.per.group*2, s=1, v=1.25/4))
115
+ }else if(length(col)==1 & col[1]=="coto"){
116
+ color.col <- c("#5BC0EB","#FDE74C","#9BC53D","#E55934","#FA7921","#EF476F",
117
+ "#FFD166","#06D6A0","#118AB2","#073B4C","#264653","#2A9D8F",
118
+ "#E9C46A","#F4A261","#E76F51")
119
+ color.col <- head(color.col, n=nrow(p))
120
+ top <- length(color.col)
121
+ }else{
122
+ color.col <- col
123
+ color.col <- tail(color.col, n=nrow(p))
124
+ top <- length(color.col)
125
+ }
126
+
127
+ # Plot
128
+ layout(matrix(1:2, nrow=1), widths=c(bars.width,1))
129
+ mar <- par('mar')
130
+ par(mar=c(5,4,4,0)+0.1)
131
+ mp <- barplot(as.matrix(p),
132
+ col=rev(c(color.col, rep(other.col, nrow(p)-length(color.col)))),
133
+ border=NA,space=ifelse(add.trend,ifelse(organic.trend,0.75,0.5),0.2), ...)
134
+ if(add.trend || min.report < max(p)){
135
+ color.alpha <- enve.col.alpha(c(color.col, other.col), 1/4)
136
+ if(top < nrow(p)){
137
+ cf <- colSums(p[1:(nrow(p)-top), ])
138
+ }else{
139
+ cf <- rep(0, ncol(p))
140
+ }
141
+ for(i in (nrow(p)-top+1):nrow(p)){
142
+ f <- as.numeric(p[i, ])
143
+ cf <- as.numeric(cf + f)
144
+ if(nrow(p)-i < top){
145
+ if(organic.trend){
146
+ spc <- 0.5
147
+ x <- c(mp[1]-spc)
148
+ y1 <- c(cf[1]-f[1])
149
+ y2 <- c(cf[1])
150
+ for(j in 2:ncol(p)){
151
+ x <- c(x, seq(mp[j-1]+spc, mp[j]-spc, length.out=22))
152
+ y1 <- c(y1, cf[j-1]-f[j-1],
153
+ (tanh(seq(-2.5,2.5,length.out=20))/2+.5)*
154
+ ((cf[j]-f[j])-(cf[j-1]-f[j-1]))+(cf[j-1]-f[j-1]), cf[j]-f[j])
155
+ y2 <- c(y2, cf[j-1],
156
+ (tanh(seq(-2.5,2.5,length.out=20))/2+.5)*
157
+ (cf[j]-cf[j-1])+(cf[j-1]), cf[j])
158
+ }
159
+ x <- c(x, mp[length(mp)]+spc)
160
+ y1 <- c(y1, cf[length(cf)]-f[length(f)])
161
+ y2 <- c(y2, cf[length(cf)])
162
+ polygon(c(x, rev(x)), c(y1, rev(y2)), col=color.alpha[nrow(p)-i+1],
163
+ border=NA)
164
+ }else if(add.trend){
165
+ x <- rep(mp, each=2)+c(-0.5,0.5)
166
+ if(add.trend) polygon(c(x, rev(x)),
167
+ c(rep(cf-f, each=2), rev(rep(cf, each=2))),
168
+ col=color.alpha[nrow(p)-i+1], border=NA)
169
+ }
170
+ text(mp, cf-f/2, ifelse(f>min.report, signif(f, 3), ''), col='white')
171
+ }
172
+ }
173
+ }
174
+
175
+ # Legend
176
+ par(mar=rep(0,4)+0.1)
177
+ plot(1, t='n', bty='n', xlab='', ylab='', xaxt='n', yaxt='n')
178
+ nam <- rownames(p[nrow(p):(nrow(p)-top+1), ])
179
+ if(top < nrow(p)) nam <- c(nam,
180
+ paste('Other (',nrow(p)-length(color.col),')', sep=''))
181
+ legend('center', col=c(color.col, other.col), legend=nam, pch=15, bty='n',
182
+ pt.cex=2, ncol=legend.ncol)
183
+ par(mar=mar)
184
+ }
@@ -0,0 +1,135 @@
1
+ #' Enveomics: Cliopts
2
+ #'
3
+ #' Generates nicely formatted command-line interfaces for functions
4
+ #' (\strong{closures} only).
5
+ #'
6
+ #' @param fx Function for which the interface should be generated.
7
+ #' @param rd_file (Optional) .Rd file with the standard documentation of
8
+ #' the function.
9
+ #' @param positional_arguments (Optional) Number of \strong{positional}
10
+ #' arguments passed to \code{\link[optparse]{parse_args}}
11
+ #' (package: \pkg{optparse}).
12
+ #' @param usage (Optional) Usage passed to \code{\link[optparse]{OptionParser}}
13
+ #' (package: \pkg{optparse}).
14
+ #' @param mandatory Mandatory arguments.
15
+ #' @param vectorize Arguments of the function to vectorize (comma-delimited).
16
+ #' If numeric, use also \code{number}.
17
+ #' @param ignore Arguments of the function to ignore.
18
+ #' @param number Force these arguments as numerics. Useful for numeric
19
+ #' vectors (see \code{vectorize}) or arguments with no defaults.
20
+ #' @param defaults Defaults to use instead of the ones provided by the
21
+ #' formals.
22
+ #' @param o_desc Descriptions of the options. Help from \code{rd} is ignored
23
+ #' for arguments present in this list.
24
+ #' @param p_desc Description Description of the function. Help from \code{rd}
25
+ #' is ignored for the function description unless this value is an empty string.
26
+ #'
27
+ #' @return Returns a list with keys:
28
+ #' \itemize{
29
+ #' \item{\code{options}, a named list with the values for the function's
30
+ #' arguments}
31
+ #' \item{\code{args}, a vector with zero or more strings containing the
32
+ #' positional arguments}}
33
+ #'
34
+ #' @author Luis M. Rodriguez-R [aut, cre]
35
+ #'
36
+ #' @export
37
+
38
+ enve.cliopts <- function(
39
+ fx,
40
+ rd_file,
41
+ positional_arguments,
42
+ usage,
43
+ mandatory=c(),
44
+ vectorize=c(),
45
+ ignore=c(),
46
+ number=c(),
47
+ defaults=list(),
48
+ o_desc=list(),
49
+ p_desc=""
50
+ ){
51
+
52
+ #= Load stuff
53
+ if(!suppressPackageStartupMessages(
54
+ requireNamespace("optparse", quietly=TRUE)))
55
+ stop("Package 'optparse' is required.")
56
+ requireNamespace("tools", quietly=TRUE)
57
+ if(missing(positional_arguments)) positional_arguments <- FALSE
58
+ if(missing(usage)) usage <- "usage: %prog [options]"
59
+
60
+ #= Get help (if any)
61
+ if(!missing(rd_file)){
62
+ rd <- tools::parse_Rd(rd_file)
63
+ for(i in 1:length(rd)){
64
+ tag <- attr(rd[[i]],'Rd_tag')
65
+ if(tag=="\\description" && p_desc==""){
66
+ p_desc <- paste("\n\t",as.character(rd[[i]]),sep='')
67
+ }else if(tag=="\\arguments"){
68
+ for(j in 1:length(rd[[i]])){
69
+ if(length(rd[[i]][[j]])==2){
70
+ name <- as.character(rd[[i]][[j]][[1]])
71
+ if(length(o_desc[[name]])==1) next
72
+ desc <- as.character(rd[[i]][[j]][[2]])
73
+ o_desc[[name]] <- paste(gsub("\n","\n\t\t",desc), collapse='')
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ #= Set options
81
+ o_i <- 0
82
+ opts <- list()
83
+ f <- formals(fx)
84
+ if(length(defaults)>0){
85
+ for(i in 1:length(defaults)) f[[names(defaults)[i]]] <- defaults[[i]]
86
+ }
87
+ for(i in names(f)){
88
+ if(i=="..." || i %in% ignore) next
89
+ o_i <- o_i + 1
90
+ flag <- gsub("\\.","-",i)
91
+
92
+ optopt <- list(help="")
93
+ if(length(o_desc[[i]])==1) optopt$help <- o_desc[[i]]
94
+ if(!is.null(f[[i]]) && !suppressWarnings(is.na(f[[i]])) && is.logical(f[[i]])){
95
+ optopt$opt_str <- paste(ifelse(f[[i]], "--no-", "--"), flag, sep='')
96
+ optopt$action <- ifelse(f[[i]], "store_false", "store_true")
97
+ }else{
98
+ optopt$opt_str <- paste("--", flag, sep='')
99
+ optopt$action <- "store"
100
+ optopt$help <- paste(optopt$help, "\n\t\t[",
101
+ ifelse(i %in% mandatory, "** MANDATORY", "default %default"),
102
+ ifelse(i %in% vectorize, ", separate values by commas", ""),
103
+ "].", sep="")
104
+ }
105
+ if(!is.name(f[[i]])){
106
+ optopt$default <- f[[i]]
107
+ optopt$metavar <- class(f[[i]])
108
+ }
109
+ if(i %in% number) optopt$metavar <- "NUMERIC"
110
+ optopt$dest <- i
111
+
112
+ opts[[o_i]] <- do.call(optparse::make_option, optopt)
113
+ }
114
+ opt <- optparse::parse_args(
115
+ optparse::OptionParser(option_list=opts, description=p_desc, usage=usage),
116
+ positional_arguments=positional_arguments)
117
+
118
+ #= Post-hoc checks
119
+ if(length(opt[['options']])==0) opt <- list(options=opt, args=c())
120
+ for(i in mandatory){
121
+ if(length(opt$options[[i]])==0) stop('Missing mandatory argument: ',i)
122
+ }
123
+ for(i in vectorize){
124
+ if(length(opt$options[[i]])==1)
125
+ opt$options[[i]] <- strsplit(opt$options[[i]],",")[[1]]
126
+ }
127
+ for(i in number){
128
+ if(length(opt$options[[i]])>0)
129
+ opt$options[[i]] <- as.numeric(opt$options[[i]])
130
+ }
131
+ opt$options$help <- NULL
132
+
133
+ return(opt)
134
+ }
135
+
@@ -0,0 +1,154 @@
1
+ #' Enveomics: Data Frame to Dist
2
+ #'
3
+ #' Transform a dataframe (or coercible object, like a table) into a
4
+ #' \strong{dist} object.
5
+ #'
6
+ #' @param x A dataframe (or coercible object) with at least three columns:
7
+ #' \enumerate{
8
+ #' \item ID of the object 1,
9
+ #' \item ID of the object 2, and
10
+ #' \item distance between the two objects.}
11
+ #' @param obj1.index Index of the column containing the ID of the object 1.
12
+ #' @param obj2.index Index of the column containing the ID of the object 2.
13
+ #' @param dist.index Index of the column containing the distance.
14
+ #' @param default.d Default value (for missing values).
15
+ #' @param max.sim If not zero, assumes that the values are similarity
16
+ #' (not distance) and this is the maximum similarity (corresponding to
17
+ #' distance 0). Applies transformation:
18
+ #' \eqn{distance = (max.sim - values)/max.sim.}
19
+ #'
20
+ #' @return Returns a \strong{dist} object.
21
+ #'
22
+ #' @author Luis M. Rodriguez-R [aut, cre]
23
+ #'
24
+ #' @export
25
+
26
+ enve.df2dist <- function(
27
+ x,
28
+ obj1.index = 1,
29
+ obj2.index = 2,
30
+ dist.index = 3,
31
+ default.d = NA,
32
+ max.sim = 0
33
+ ){
34
+ x <- as.data.frame(x)
35
+ a <- as.character(x[, obj1.index])
36
+ b <- as.character(x[, obj2.index])
37
+ d <- as.double(x[, dist.index])
38
+ if(max.sim != 0) d <- (max.sim - d) / max.sim
39
+ ids <- unique(c(a,b))
40
+ m <- matrix(default.d,
41
+ nrow = length(ids), ncol = length(ids), dimnames = list(ids, ids))
42
+ diag(m) <- 0.0
43
+ m[cbind(a,b)] <- d
44
+ m <- pmin(m, t(m), na.rm = TRUE)
45
+ return(as.dist(m))
46
+ }
47
+
48
+ #' Enveomics: Data Frame to Dist (Group)
49
+ #'
50
+ #' Transform a dataframe (or coercible object, like a table) into a
51
+ #' \strong{dist} object, where there are 1 or more distances between each pair
52
+ #' of objects.
53
+ #'
54
+ #' @param x A dataframe (or coercible object) with at least three columns:
55
+ #' \enumerate{
56
+ #' \item ID of the object 1,
57
+ #' \item ID of the object 2, and
58
+ #' \item distance between the two objects.}
59
+ #' @param obj1.index Index of the column containing the ID of the object 1.
60
+ #' @param obj2.index Index of the column containing the ID of the object 2.
61
+ #' @param dist.index Index of the column containing the distance.
62
+ #' @param summary Function summarizing the different distances between the
63
+ #' two objects.
64
+ #' @param empty.rm Remove rows with empty or \code{NA} groups.
65
+ #'
66
+ #' @return Returns a \strong{dist} object.
67
+ #'
68
+ #' @author Luis M. Rodriguez-R [aut, cre]
69
+ #'
70
+ #' @export
71
+
72
+ enve.df2dist.group <- function(
73
+ x,
74
+ obj1.index=1,
75
+ obj2.index=2,
76
+ dist.index=3,
77
+ summary=median,
78
+ empty.rm=TRUE
79
+ ){
80
+ x <- as.data.frame(x);
81
+ if(empty.rm) x <- x[ !(is.na(x[,obj1.index]) | is.na(x[,obj2.index]) | x[,obj1.index]=='' | x[,obj2.index]==''), ]
82
+ a <- as.character(x[, obj1.index]);
83
+ b <- as.character(x[, obj2.index]);
84
+ d <- as.double(x[, dist.index]);
85
+ ids <- unique(c(a,b));
86
+ if(length(ids)<2) return(NA);
87
+ m <- matrix(NA, nrow=length(ids), ncol=length(ids), dimnames=list(ids, ids));
88
+ diag(m) <- 0
89
+ for(i in 2:length(ids)){
90
+ id.i <- ids[i];
91
+ for(j in 1:(i-1)){
92
+ id.j <- ids[j];
93
+ d.ij <- summary(c( d[ a==id.i & b==id.j], d[ b==id.i & a==id.j] ));
94
+ m[id.i, id.j] <- d.ij;
95
+ m[id.j, id.i] <- d.ij;
96
+ }
97
+ }
98
+ return(as.dist(m));
99
+ }
100
+
101
+ #' Enveomics: Data Frame to Dist (List)
102
+ #'
103
+ #' Transform a dataframe (or coercible object, like a table)
104
+ #' into a \strong{dist} object.
105
+ #'
106
+ #' @param x A dataframe (or coercible object) with at least three columns:
107
+ #' \enumerate{
108
+ #' \item ID of the object 1,
109
+ #' \item ID of the object 2, and
110
+ #' \item distance between the two objects.}
111
+ #' @param groups Named array where the IDs correspond to the object IDs,
112
+ #' and the values correspond to the group.
113
+ #' @param obj1.index Index of the column containing the ID of the object 1.
114
+ #' @param obj2.index Index of the column containing the ID of the object 2.
115
+ #' @param dist.index Index of the column containing the distance.
116
+ #' @param empty.rm Remove incomplete matrices.
117
+ #' @param ... Any other parameters supported by
118
+ #' \code{\link{enve.df2dist.group}}.
119
+ #'
120
+ #' @return Returns a \strong{list} of \strong{dist} objects.
121
+ #'
122
+ #' @author Luis M. Rodriguez-R [aut, cre]
123
+ #'
124
+ #' @export
125
+
126
+ enve.df2dist.list <- function(
127
+ x,
128
+ groups,
129
+ obj1.index=1,
130
+ obj2.index=2,
131
+ dist.index=3,
132
+ empty.rm=TRUE,
133
+ ...
134
+ ){
135
+ x <- as.data.frame(x);
136
+ a <- as.character(x[, obj1.index]);
137
+ b <- as.character(x[, obj2.index]);
138
+ d <- as.numeric(x[, dist.index]);
139
+ ids.all <- unique(c(a,b));
140
+ l <- list();
141
+ same_group <- groups[a]==groups[b];
142
+ same_group <- ifelse(is.na(same_group), FALSE, TRUE);
143
+ for(group in unique(groups)){
144
+ ids <- ids.all[ groups[ids.all]==group ];
145
+ if(length(ids)>1 & group!=""){
146
+ x.sub <- x[ same_group & (groups[a]==group) & (groups[b]==group), ]
147
+ if(nrow(x.sub)>0){
148
+ d.g <- enve.df2dist(x.sub, obj1.index, obj2.index, dist.index, ...);
149
+ if(!empty.rm | !any(is.na(d.g))) l[[ group ]] <- d.g;
150
+ }
151
+ }
152
+ }
153
+ return(l);
154
+ }