miga-base 0.7.23.0 → 0.7.25.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/Rakefile +1 -0
- data/lib/miga/cli/action/add.rb +10 -8
- data/lib/miga/cli/action/classify_wf.rb +12 -11
- data/lib/miga/cli/action/derep_wf.rb +3 -9
- data/lib/miga/cli/action/edit.rb +0 -1
- data/lib/miga/cli/action/find.rb +1 -1
- data/lib/miga/cli/action/generic.rb +1 -1
- data/lib/miga/cli/action/get.rb +7 -2
- data/lib/miga/cli/action/index_wf.rb +4 -2
- data/lib/miga/cli/action/init.rb +60 -59
- data/lib/miga/cli/action/init/files_helper.rb +2 -1
- data/lib/miga/cli/action/ncbi_get.rb +1 -1
- data/lib/miga/cli/action/new.rb +15 -9
- data/lib/miga/cli/action/option.rb +63 -0
- data/lib/miga/cli/action/preproc_wf.rb +7 -5
- data/lib/miga/cli/action/quality_wf.rb +3 -3
- data/lib/miga/cli/action/tax_dist.rb +1 -1
- data/lib/miga/cli/action/tax_test.rb +1 -1
- data/lib/miga/cli/action/wf.rb +72 -54
- data/lib/miga/cli/base.rb +17 -5
- data/lib/miga/cli/objects_helper.rb +23 -18
- data/lib/miga/common.rb +1 -1
- data/lib/miga/common/with_option.rb +83 -0
- data/lib/miga/common/with_result.rb +2 -1
- data/lib/miga/dataset/base.rb +20 -2
- data/lib/miga/dataset/result.rb +3 -2
- data/lib/miga/metadata.rb +25 -13
- data/lib/miga/project/base.rb +82 -2
- data/lib/miga/project/result.rb +4 -4
- data/lib/miga/result.rb +18 -15
- data/lib/miga/result/stats.rb +2 -2
- data/lib/miga/version.rb +2 -2
- data/scripts/essential_genes.bash +18 -3
- data/scripts/miga.bash +8 -2
- data/scripts/ogs.bash +2 -3
- data/test/dataset_test.rb +5 -5
- data/test/lair_test.rb +1 -2
- data/test/result_test.rb +22 -0
- data/test/with_option_test.rb +115 -0
- data/utils/cleanup-databases.rb +1 -2
- data/utils/distance/base.rb +9 -0
- data/utils/distance/commands.rb +183 -81
- data/utils/distance/database.rb +69 -10
- data/utils/distance/pipeline.rb +15 -21
- data/utils/distance/runner.rb +28 -49
- data/utils/distance/temporal.rb +4 -2
- data/utils/distances.rb +2 -2
- data/utils/index_metadata.rb +1 -2
- data/utils/requirements.txt +1 -1
- data/utils/subclade/runner.rb +9 -10
- metadata +9 -273
- data/utils/enveomics/Docs/recplot2.md +0 -244
- data/utils/enveomics/Examples/aai-matrix.bash +0 -66
- data/utils/enveomics/Examples/ani-matrix.bash +0 -66
- data/utils/enveomics/Examples/essential-phylogeny.bash +0 -105
- data/utils/enveomics/Examples/unus-genome-phylogeny.bash +0 -100
- data/utils/enveomics/LICENSE.txt +0 -73
- data/utils/enveomics/Makefile +0 -52
- data/utils/enveomics/Manifest/Tasks/aasubs.json +0 -103
- data/utils/enveomics/Manifest/Tasks/blasttab.json +0 -786
- data/utils/enveomics/Manifest/Tasks/distances.json +0 -161
- data/utils/enveomics/Manifest/Tasks/fasta.json +0 -766
- data/utils/enveomics/Manifest/Tasks/fastq.json +0 -243
- data/utils/enveomics/Manifest/Tasks/graphics.json +0 -126
- data/utils/enveomics/Manifest/Tasks/mapping.json +0 -67
- data/utils/enveomics/Manifest/Tasks/ogs.json +0 -382
- data/utils/enveomics/Manifest/Tasks/other.json +0 -829
- data/utils/enveomics/Manifest/Tasks/remote.json +0 -355
- data/utils/enveomics/Manifest/Tasks/sequence-identity.json +0 -501
- data/utils/enveomics/Manifest/Tasks/tables.json +0 -308
- data/utils/enveomics/Manifest/Tasks/trees.json +0 -68
- data/utils/enveomics/Manifest/Tasks/variants.json +0 -111
- data/utils/enveomics/Manifest/categories.json +0 -156
- data/utils/enveomics/Manifest/examples.json +0 -154
- data/utils/enveomics/Manifest/tasks.json +0 -4
- data/utils/enveomics/Pipelines/assembly.pbs/CONFIG.mock.bash +0 -69
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.N50.pl +0 -1
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.filterN.pl +0 -1
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.length.pl +0 -1
- data/utils/enveomics/Pipelines/assembly.pbs/README.md +0 -189
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME-2.bash +0 -112
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME-3.bash +0 -23
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME-4.bash +0 -44
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME.bash +0 -50
- data/utils/enveomics/Pipelines/assembly.pbs/kSelector.R +0 -37
- data/utils/enveomics/Pipelines/assembly.pbs/newbler.pbs +0 -68
- data/utils/enveomics/Pipelines/assembly.pbs/newbler_preparator.pl +0 -49
- data/utils/enveomics/Pipelines/assembly.pbs/soap.pbs +0 -80
- data/utils/enveomics/Pipelines/assembly.pbs/stats.pbs +0 -57
- data/utils/enveomics/Pipelines/assembly.pbs/velvet.pbs +0 -63
- data/utils/enveomics/Pipelines/blast.pbs/01.pbs.bash +0 -38
- data/utils/enveomics/Pipelines/blast.pbs/02.pbs.bash +0 -73
- data/utils/enveomics/Pipelines/blast.pbs/03.pbs.bash +0 -21
- data/utils/enveomics/Pipelines/blast.pbs/BlastTab.recover_job.pl +0 -72
- data/utils/enveomics/Pipelines/blast.pbs/CONFIG.mock.bash +0 -98
- data/utils/enveomics/Pipelines/blast.pbs/FastA.split.pl +0 -1
- data/utils/enveomics/Pipelines/blast.pbs/README.md +0 -127
- data/utils/enveomics/Pipelines/blast.pbs/RUNME.bash +0 -109
- data/utils/enveomics/Pipelines/blast.pbs/TASK.check.bash +0 -128
- data/utils/enveomics/Pipelines/blast.pbs/TASK.dry.bash +0 -16
- data/utils/enveomics/Pipelines/blast.pbs/TASK.eo.bash +0 -22
- data/utils/enveomics/Pipelines/blast.pbs/TASK.pause.bash +0 -26
- data/utils/enveomics/Pipelines/blast.pbs/TASK.run.bash +0 -89
- data/utils/enveomics/Pipelines/blast.pbs/sentinel.pbs.bash +0 -29
- data/utils/enveomics/Pipelines/idba.pbs/README.md +0 -49
- data/utils/enveomics/Pipelines/idba.pbs/RUNME.bash +0 -95
- data/utils/enveomics/Pipelines/idba.pbs/run.pbs +0 -56
- data/utils/enveomics/Pipelines/trim.pbs/README.md +0 -54
- data/utils/enveomics/Pipelines/trim.pbs/RUNME.bash +0 -70
- data/utils/enveomics/Pipelines/trim.pbs/run.pbs +0 -130
- data/utils/enveomics/README.md +0 -42
- data/utils/enveomics/Scripts/AAsubs.log2ratio.rb +0 -171
- data/utils/enveomics/Scripts/Aln.cat.rb +0 -163
- data/utils/enveomics/Scripts/Aln.convert.pl +0 -35
- data/utils/enveomics/Scripts/AlphaDiversity.pl +0 -152
- data/utils/enveomics/Scripts/BedGraph.tad.rb +0 -93
- data/utils/enveomics/Scripts/BedGraph.window.rb +0 -71
- data/utils/enveomics/Scripts/BlastPairwise.AAsubs.pl +0 -102
- data/utils/enveomics/Scripts/BlastTab.addlen.rb +0 -63
- data/utils/enveomics/Scripts/BlastTab.advance.bash +0 -48
- data/utils/enveomics/Scripts/BlastTab.best_hit_sorted.pl +0 -55
- data/utils/enveomics/Scripts/BlastTab.catsbj.pl +0 -104
- data/utils/enveomics/Scripts/BlastTab.cogCat.rb +0 -76
- data/utils/enveomics/Scripts/BlastTab.filter.pl +0 -47
- data/utils/enveomics/Scripts/BlastTab.kegg_pep2path_rest.pl +0 -194
- data/utils/enveomics/Scripts/BlastTab.metaxaPrep.pl +0 -104
- data/utils/enveomics/Scripts/BlastTab.pairedHits.rb +0 -157
- data/utils/enveomics/Scripts/BlastTab.recplot2.R +0 -48
- data/utils/enveomics/Scripts/BlastTab.seqdepth.pl +0 -86
- data/utils/enveomics/Scripts/BlastTab.seqdepth_ZIP.pl +0 -119
- data/utils/enveomics/Scripts/BlastTab.seqdepth_nomedian.pl +0 -86
- data/utils/enveomics/Scripts/BlastTab.subsample.pl +0 -47
- data/utils/enveomics/Scripts/BlastTab.sumPerHit.pl +0 -114
- data/utils/enveomics/Scripts/BlastTab.taxid2taxrank.pl +0 -90
- data/utils/enveomics/Scripts/BlastTab.topHits_sorted.rb +0 -101
- data/utils/enveomics/Scripts/Chao1.pl +0 -97
- data/utils/enveomics/Scripts/CharTable.classify.rb +0 -234
- data/utils/enveomics/Scripts/EBIseq2tax.rb +0 -83
- data/utils/enveomics/Scripts/FastA.N50.pl +0 -56
- data/utils/enveomics/Scripts/FastA.extract.rb +0 -152
- data/utils/enveomics/Scripts/FastA.filter.pl +0 -52
- data/utils/enveomics/Scripts/FastA.filterLen.pl +0 -28
- data/utils/enveomics/Scripts/FastA.filterN.pl +0 -60
- data/utils/enveomics/Scripts/FastA.fragment.rb +0 -92
- data/utils/enveomics/Scripts/FastA.gc.pl +0 -42
- data/utils/enveomics/Scripts/FastA.interpose.pl +0 -93
- data/utils/enveomics/Scripts/FastA.length.pl +0 -38
- data/utils/enveomics/Scripts/FastA.mask.rb +0 -89
- data/utils/enveomics/Scripts/FastA.per_file.pl +0 -36
- data/utils/enveomics/Scripts/FastA.qlen.pl +0 -57
- data/utils/enveomics/Scripts/FastA.rename.pl +0 -65
- data/utils/enveomics/Scripts/FastA.revcom.pl +0 -23
- data/utils/enveomics/Scripts/FastA.sample.rb +0 -83
- data/utils/enveomics/Scripts/FastA.slider.pl +0 -85
- data/utils/enveomics/Scripts/FastA.split.pl +0 -55
- data/utils/enveomics/Scripts/FastA.split.rb +0 -79
- data/utils/enveomics/Scripts/FastA.subsample.pl +0 -131
- data/utils/enveomics/Scripts/FastA.tag.rb +0 -65
- data/utils/enveomics/Scripts/FastA.wrap.rb +0 -48
- data/utils/enveomics/Scripts/FastQ.filter.pl +0 -54
- data/utils/enveomics/Scripts/FastQ.interpose.pl +0 -90
- data/utils/enveomics/Scripts/FastQ.offset.pl +0 -90
- data/utils/enveomics/Scripts/FastQ.split.pl +0 -53
- data/utils/enveomics/Scripts/FastQ.tag.rb +0 -63
- data/utils/enveomics/Scripts/FastQ.test-error.rb +0 -81
- data/utils/enveomics/Scripts/FastQ.toFastA.awk +0 -24
- data/utils/enveomics/Scripts/GFF.catsbj.pl +0 -127
- data/utils/enveomics/Scripts/GenBank.add_fields.rb +0 -84
- data/utils/enveomics/Scripts/HMM.essential.rb +0 -351
- data/utils/enveomics/Scripts/HMM.haai.rb +0 -168
- data/utils/enveomics/Scripts/HMMsearch.extractIds.rb +0 -83
- data/utils/enveomics/Scripts/JPlace.distances.rb +0 -88
- data/utils/enveomics/Scripts/JPlace.to_iToL.rb +0 -320
- data/utils/enveomics/Scripts/M5nr.getSequences.rb +0 -81
- data/utils/enveomics/Scripts/MeTaxa.distribution.pl +0 -198
- data/utils/enveomics/Scripts/MyTaxa.fragsByTax.pl +0 -35
- data/utils/enveomics/Scripts/MyTaxa.seq-taxrank.rb +0 -49
- data/utils/enveomics/Scripts/NCBIacc2tax.rb +0 -92
- data/utils/enveomics/Scripts/Newick.autoprune.R +0 -27
- data/utils/enveomics/Scripts/RAxML-EPA.to_iToL.pl +0 -228
- data/utils/enveomics/Scripts/RecPlot2.compareIdentities.R +0 -32
- data/utils/enveomics/Scripts/RefSeq.download.bash +0 -48
- data/utils/enveomics/Scripts/SRA.download.bash +0 -57
- data/utils/enveomics/Scripts/TRIBS.plot-test.R +0 -36
- data/utils/enveomics/Scripts/TRIBS.test.R +0 -39
- data/utils/enveomics/Scripts/Table.barplot.R +0 -31
- data/utils/enveomics/Scripts/Table.df2dist.R +0 -30
- data/utils/enveomics/Scripts/Table.filter.pl +0 -61
- data/utils/enveomics/Scripts/Table.merge.pl +0 -77
- data/utils/enveomics/Scripts/Table.replace.rb +0 -69
- data/utils/enveomics/Scripts/Table.round.rb +0 -63
- data/utils/enveomics/Scripts/Table.split.pl +0 -57
- data/utils/enveomics/Scripts/Taxonomy.silva2ncbi.rb +0 -227
- data/utils/enveomics/Scripts/VCF.KaKs.rb +0 -147
- data/utils/enveomics/Scripts/VCF.SNPs.rb +0 -88
- data/utils/enveomics/Scripts/aai.rb +0 -418
- data/utils/enveomics/Scripts/ani.rb +0 -362
- data/utils/enveomics/Scripts/clust.rand.rb +0 -102
- data/utils/enveomics/Scripts/gi2tax.rb +0 -103
- data/utils/enveomics/Scripts/in_silico_GA_GI.pl +0 -96
- data/utils/enveomics/Scripts/lib/data/dupont_2012_essential.hmm.gz +0 -0
- data/utils/enveomics/Scripts/lib/data/lee_2019_essential.hmm.gz +0 -0
- data/utils/enveomics/Scripts/lib/enveomics.R +0 -1
- data/utils/enveomics/Scripts/lib/enveomics_rb/enveomics.rb +0 -24
- data/utils/enveomics/Scripts/lib/enveomics_rb/jplace.rb +0 -253
- data/utils/enveomics/Scripts/lib/enveomics_rb/og.rb +0 -182
- data/utils/enveomics/Scripts/lib/enveomics_rb/remote_data.rb +0 -74
- data/utils/enveomics/Scripts/lib/enveomics_rb/seq_range.rb +0 -237
- data/utils/enveomics/Scripts/lib/enveomics_rb/stat.rb +0 -30
- data/utils/enveomics/Scripts/lib/enveomics_rb/vcf.rb +0 -135
- data/utils/enveomics/Scripts/ogs.annotate.rb +0 -88
- data/utils/enveomics/Scripts/ogs.core-pan.rb +0 -160
- data/utils/enveomics/Scripts/ogs.extract.rb +0 -125
- data/utils/enveomics/Scripts/ogs.mcl.rb +0 -186
- data/utils/enveomics/Scripts/ogs.rb +0 -104
- data/utils/enveomics/Scripts/ogs.stats.rb +0 -131
- data/utils/enveomics/Scripts/rbm.rb +0 -146
- data/utils/enveomics/Tests/Makefile +0 -10
- data/utils/enveomics/Tests/Mgen_M2288.faa +0 -3189
- data/utils/enveomics/Tests/Mgen_M2288.fna +0 -8282
- data/utils/enveomics/Tests/Mgen_M2321.fna +0 -8288
- data/utils/enveomics/Tests/Nequ_Kin4M.faa +0 -2970
- data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.tribs.Rdata +0 -0
- data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.txt +0 -7
- data/utils/enveomics/Tests/Xanthomonas_oryzae.aai-mat.tsv +0 -17
- data/utils/enveomics/Tests/Xanthomonas_oryzae.aai.tsv +0 -137
- data/utils/enveomics/Tests/a_mg.cds-go.blast.tsv +0 -123
- data/utils/enveomics/Tests/a_mg.reads-cds.blast.tsv +0 -200
- data/utils/enveomics/Tests/a_mg.reads-cds.counts.tsv +0 -55
- data/utils/enveomics/Tests/alkB.nwk +0 -1
- data/utils/enveomics/Tests/anthrax-cansnp-data.tsv +0 -13
- data/utils/enveomics/Tests/anthrax-cansnp-key.tsv +0 -17
- data/utils/enveomics/Tests/hiv1.faa +0 -59
- data/utils/enveomics/Tests/hiv1.fna +0 -134
- data/utils/enveomics/Tests/hiv2.faa +0 -70
- data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv +0 -233
- data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.lim +0 -1
- data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.rec +0 -233
- data/utils/enveomics/Tests/phyla_counts.tsv +0 -10
- data/utils/enveomics/Tests/primate_lentivirus.ogs +0 -11
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv1.rbm +0 -9
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv2.rbm +0 -8
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-siv.rbm +0 -6
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-hiv2.rbm +0 -9
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-siv.rbm +0 -6
- data/utils/enveomics/Tests/primate_lentivirus.rbm/siv-siv.rbm +0 -6
- data/utils/enveomics/build_enveomics_r.bash +0 -45
- data/utils/enveomics/enveomics.R/DESCRIPTION +0 -31
- data/utils/enveomics/enveomics.R/NAMESPACE +0 -39
- data/utils/enveomics/enveomics.R/R/autoprune.R +0 -155
- data/utils/enveomics/enveomics.R/R/barplot.R +0 -184
- data/utils/enveomics/enveomics.R/R/cliopts.R +0 -135
- data/utils/enveomics/enveomics.R/R/df2dist.R +0 -154
- data/utils/enveomics/enveomics.R/R/growthcurve.R +0 -331
- data/utils/enveomics/enveomics.R/R/recplot.R +0 -354
- data/utils/enveomics/enveomics.R/R/recplot2.R +0 -1631
- data/utils/enveomics/enveomics.R/R/tribs.R +0 -583
- data/utils/enveomics/enveomics.R/R/utils.R +0 -50
- data/utils/enveomics/enveomics.R/README.md +0 -80
- data/utils/enveomics/enveomics.R/data/growth.curves.rda +0 -0
- data/utils/enveomics/enveomics.R/data/phyla.counts.rda +0 -0
- data/utils/enveomics/enveomics.R/man/cash-enve.GrowthCurve-method.Rd +0 -17
- data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2-method.Rd +0 -17
- data/utils/enveomics/enveomics.R/man/cash-enve.RecPlot2.Peak-method.Rd +0 -17
- data/utils/enveomics/enveomics.R/man/enve.GrowthCurve-class.Rd +0 -25
- data/utils/enveomics/enveomics.R/man/enve.TRIBS-class.Rd +0 -46
- data/utils/enveomics/enveomics.R/man/enve.TRIBS.merge.Rd +0 -23
- data/utils/enveomics/enveomics.R/man/enve.TRIBStest-class.Rd +0 -47
- data/utils/enveomics/enveomics.R/man/enve.__prune.iter.Rd +0 -23
- data/utils/enveomics/enveomics.R/man/enve.__prune.reduce.Rd +0 -23
- data/utils/enveomics/enveomics.R/man/enve.__tribs.Rd +0 -32
- data/utils/enveomics/enveomics.R/man/enve.barplot.Rd +0 -91
- data/utils/enveomics/enveomics.R/man/enve.cliopts.Rd +0 -57
- data/utils/enveomics/enveomics.R/man/enve.col.alpha.Rd +0 -24
- data/utils/enveomics/enveomics.R/man/enve.col2alpha.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/enve.df2dist.Rd +0 -39
- data/utils/enveomics/enveomics.R/man/enve.df2dist.group.Rd +0 -38
- data/utils/enveomics/enveomics.R/man/enve.df2dist.list.Rd +0 -40
- data/utils/enveomics/enveomics.R/man/enve.growthcurve.Rd +0 -67
- data/utils/enveomics/enveomics.R/man/enve.prune.dist.Rd +0 -37
- data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +0 -122
- data/utils/enveomics/enveomics.R/man/enve.recplot2-class.Rd +0 -45
- data/utils/enveomics/enveomics.R/man/enve.recplot2.ANIr.Rd +0 -24
- data/utils/enveomics/enveomics.R/man/enve.recplot2.Rd +0 -68
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__counts.Rd +0 -25
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__peakHist.Rd +0 -21
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__whichClosestPeak.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/enve.recplot2.changeCutoff.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/enve.recplot2.compareIdentities.Rd +0 -41
- data/utils/enveomics/enveomics.R/man/enve.recplot2.coordinates.Rd +0 -29
- data/utils/enveomics/enveomics.R/man/enve.recplot2.corePeak.Rd +0 -18
- data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +0 -40
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.Rd +0 -36
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_e.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__em_m.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__emauto_one.Rd +0 -27
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mow_one.Rd +0 -41
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.__mower.Rd +0 -17
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.em.Rd +0 -43
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.emauto.Rd +0 -37
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.mower.Rd +0 -74
- data/utils/enveomics/enveomics.R/man/enve.recplot2.peak-class.Rd +0 -59
- data/utils/enveomics/enveomics.R/man/enve.recplot2.seqdepth.Rd +0 -27
- data/utils/enveomics/enveomics.R/man/enve.recplot2.windowDepthThreshold.Rd +0 -32
- data/utils/enveomics/enveomics.R/man/enve.tribs.Rd +0 -59
- data/utils/enveomics/enveomics.R/man/enve.tribs.test.Rd +0 -28
- data/utils/enveomics/enveomics.R/man/enve.truncate.Rd +0 -27
- data/utils/enveomics/enveomics.R/man/growth.curves.Rd +0 -14
- data/utils/enveomics/enveomics.R/man/phyla.counts.Rd +0 -13
- data/utils/enveomics/enveomics.R/man/plot.enve.GrowthCurve.Rd +0 -63
- data/utils/enveomics/enveomics.R/man/plot.enve.TRIBS.Rd +0 -38
- data/utils/enveomics/enveomics.R/man/plot.enve.TRIBStest.Rd +0 -38
- data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +0 -111
- data/utils/enveomics/enveomics.R/man/summary.enve.GrowthCurve.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/summary.enve.TRIBS.Rd +0 -19
- data/utils/enveomics/enveomics.R/man/summary.enve.TRIBStest.Rd +0 -19
- data/utils/enveomics/globals.mk +0 -8
- data/utils/enveomics/manifest.json +0 -9
@@ -1,83 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#
|
4
|
-
# @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
5
|
-
# @update Oct-13-2015
|
6
|
-
# @license Artistic License 2.0
|
7
|
-
#
|
8
|
-
|
9
|
-
$:.push File.expand_path(File.dirname(__FILE__) + "/lib")
|
10
|
-
require "enveomics_rb/remote_data"
|
11
|
-
use "nokogiri"
|
12
|
-
|
13
|
-
#================================[ Options parsing ]
|
14
|
-
$o = {
|
15
|
-
q: false, ids: [], dbfrom: "uniprotkb", header: true,
|
16
|
-
ret: "ScientificName",
|
17
|
-
ranks: %w(superkingdom phylum class order family genus species)}
|
18
|
-
|
19
|
-
OptionParser.new do |opt|
|
20
|
-
opt.banner = "
|
21
|
-
Maps a list of EBI-supported IDs to their corresponding NCBI taxonomy using
|
22
|
-
EBI RESTful API. Avoid using this script on millions of entries at a time,
|
23
|
-
since each entry elicits requests to EBI and NCBI servers.
|
24
|
-
|
25
|
-
Usage: #{$0} [options]".gsub(/^ +/,"")
|
26
|
-
opt.separator ""
|
27
|
-
opt.on("-i", "--ids ID1,ID2,...", Array,
|
28
|
-
"Comma-separated list of EBI IDs. Required unless -I is passed."
|
29
|
-
){ |v| $o[:ids]=v }
|
30
|
-
opt.on("-I", "--infile FILE",
|
31
|
-
"Raw text file containing the list of EBI IDs, one per line.",
|
32
|
-
"Required unless -i is passed."){ |v| $o[:infile]=v }
|
33
|
-
opt.on("-d", "--database DB",
|
34
|
-
"EBI database defining the EBI IDs. By default: " + $o[:dbfrom].to_s + "."
|
35
|
-
){ |v| $o[:dbfrom]=v }
|
36
|
-
opt.on("-r", "--ranks RANK1,RANK2,...", Array,
|
37
|
-
"Taxonomic ranks to report. By default:",
|
38
|
-
$o[:ranks].join(",") + "."){ |v| $o[:ranks]=v }
|
39
|
-
opt.on("-n", "--noheader",
|
40
|
-
"Do not includ a header in the output."){ $o[:header]=false }
|
41
|
-
opt.on("-t", "--taxids",
|
42
|
-
"Return Taxonomy IDs instead of scientific names."){ $o[:ret]="TaxId" }
|
43
|
-
opt.on("-q", "--quiet", "Run quietly."){ |v| $o[:q]=true }
|
44
|
-
opt.on("-h", "--help","Display this screen") do
|
45
|
-
puts opt
|
46
|
-
exit
|
47
|
-
end
|
48
|
-
opt.separator ""
|
49
|
-
end.parse!
|
50
|
-
|
51
|
-
#================================[ Main ]
|
52
|
-
begin
|
53
|
-
$o[:ids] += File.readlines($o[:infile]).map{ |l| l.chomp } unless
|
54
|
-
$o[:infile].nil?
|
55
|
-
$o[:ranks].map!{ |r| r.downcase }
|
56
|
-
puts (["ID", "TaxId"] + $o[:ranks].map{ |r| r.capitalize }).join("\t") if
|
57
|
-
$o[:header]
|
58
|
-
$o[:ids].each do |id|
|
59
|
-
id = $1 if id =~ /^[a-z]+\|\S+\|(\S+)/
|
60
|
-
taxid = RemoteData.ebiseq2taxid(id, $o[:dbfrom])
|
61
|
-
if taxid.nil?
|
62
|
-
warn "Cannot find link to taxonomy: #{id}"
|
63
|
-
next
|
64
|
-
end
|
65
|
-
taxonomy = {}
|
66
|
-
unless taxid.nil?
|
67
|
-
doc = Nokogiri::XML( RemoteData.efetch({db: "taxonomy", id: taxid}) )
|
68
|
-
taxonomy[ doc.at_xpath("/TaxaSet/Taxon/Rank").content ] =
|
69
|
-
doc.at_xpath("/TaxaSet/Taxon/#{$o[:ret]}").content
|
70
|
-
doc.xpath("/TaxaSet/Taxon/LineageEx/Taxon").each do |taxon|
|
71
|
-
taxonomy[ taxon.at_xpath("./Rank").content ] =
|
72
|
-
taxon.at_xpath("./#{$o[:ret]}").content
|
73
|
-
end
|
74
|
-
end
|
75
|
-
puts ([id, taxid] +
|
76
|
-
$o[:ranks].map{ |rank| taxonomy[ rank ] ||= "" }).join("\t")
|
77
|
-
end # $o[:ids].each
|
78
|
-
rescue => err
|
79
|
-
$stderr.puts "Exception: #{err}\n\n"
|
80
|
-
err.backtrace.each { |l| $stderr.puts l + "\n" }
|
81
|
-
err
|
82
|
-
end
|
83
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
#!/usr/bin/env perl
|
2
|
-
#
|
3
|
-
# @author: Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
4
|
-
# @update: Oct 07 2015
|
5
|
-
# @license: artistic license 2.0
|
6
|
-
#
|
7
|
-
use strict;
|
8
|
-
use warnings;
|
9
|
-
use List::Util qw/sum min max/;
|
10
|
-
|
11
|
-
my ($seqs, $minlen, $n__) = @ARGV;
|
12
|
-
$seqs or die "
|
13
|
-
Description:
|
14
|
-
Calculates the N50 value of a set of sequences. Alternatively, it
|
15
|
-
can calculate other N** values. It also calculates the total number
|
16
|
-
of sequences and the total added length.
|
17
|
-
|
18
|
-
Usage:
|
19
|
-
$0 seqs.fa[ minlen[ **]]
|
20
|
-
|
21
|
-
seqs.fa A FastA file containing the sequences.
|
22
|
-
minlen (optional) The minimum length to take into consideration.
|
23
|
-
By default: 0.
|
24
|
-
** Value N** to calculate. By default: 50 (N50).
|
25
|
-
";
|
26
|
-
$minlen ||= 0;
|
27
|
-
$n__ ||= 50;
|
28
|
-
|
29
|
-
my @len = ();
|
30
|
-
open SEQ, "<", $seqs or die "Cannot open file: $seqs: $!\n";
|
31
|
-
while(<SEQ>){
|
32
|
-
if(/^>/){
|
33
|
-
push @len, 0;
|
34
|
-
}else{
|
35
|
-
next if /^;/;
|
36
|
-
chomp;
|
37
|
-
s/\W//g;
|
38
|
-
$len[-1]+=length $_;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
close SEQ;
|
42
|
-
@len = sort { $a <=> $b } map { $_>=$minlen?$_:() } @len;
|
43
|
-
my $tot = (sum(@len) || 0);
|
44
|
-
|
45
|
-
my $thr = $n__*$tot/100;
|
46
|
-
my $pos = 0;
|
47
|
-
for(@len){
|
48
|
-
$pos+= $_;
|
49
|
-
if($pos>=$thr){
|
50
|
-
print "N$n__: $_\n";
|
51
|
-
last;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
print "Sequences: ".scalar(@len)."\n";
|
55
|
-
print "Total length: $tot\n";
|
56
|
-
|
@@ -1,152 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#
|
4
|
-
# @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
5
|
-
# @license Artistic-2.0
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'optparse'
|
9
|
-
|
10
|
-
o = {q: false}
|
11
|
-
ARGV << '-h' if ARGV.size==0
|
12
|
-
|
13
|
-
OptionParser.new do |opt|
|
14
|
-
opt.banner = "
|
15
|
-
Extracts a list of sequences and/or coordinates from multi-FastA files.
|
16
|
-
|
17
|
-
Usage: #{$0} [options]"
|
18
|
-
opt.separator ''
|
19
|
-
opt.separator 'Mandatory'
|
20
|
-
opt.on('-i', '--in PATH', 'Input FastA file.'){ |v| o[:i] = v }
|
21
|
-
opt.on('-o', '--out PATH', 'Output FastA file.'){ |v| o[:o] = v }
|
22
|
-
opt.on('-c', '--coords STRING',
|
23
|
-
'Comma-delimited list of coordinates (mandatory unless -C is passed).',
|
24
|
-
'The format of the coordinates is "SEQ:FROM..TO" or "SEQ:FROM~LEN":',
|
25
|
-
'SEQ: Sequence ID, or * (asterisk) to extract range from all sequences',
|
26
|
-
'FROM: Integer, position of the first base to include (can be negative)',
|
27
|
-
'TO: Integer, last base to include (can be negative)',
|
28
|
-
'LEN: Length of the range to extract'
|
29
|
-
){ |v| o[:c] = v }
|
30
|
-
opt.separator ''
|
31
|
-
opt.separator 'Options'
|
32
|
-
opt.on('-C', '--coords-file PATH',
|
33
|
-
'File containing the coordinates, one per line.',
|
34
|
-
'Each line must follow the format described for -c.'){ |v| o[:C] = v }
|
35
|
-
opt.on('-q', '--quiet', 'Run quietly (no STDERR output).'){ o[:q] = true }
|
36
|
-
opt.on('-h', '--help', 'Display this screen.') do
|
37
|
-
puts opt
|
38
|
-
exit
|
39
|
-
end
|
40
|
-
opt.separator ''
|
41
|
-
end.parse!
|
42
|
-
abort '-i is mandatory.' if o[:i].nil?
|
43
|
-
abort '-o is mandatory.' if o[:o].nil?
|
44
|
-
abort '-c is mandatory.' if o[:c].nil? and o[:C].nil?
|
45
|
-
|
46
|
-
# Classses to parse coordinates
|
47
|
-
class SeqCoords
|
48
|
-
attr :id, :from, :to, :length, :str
|
49
|
-
def initialize(str)
|
50
|
-
@str = str
|
51
|
-
m = /(\S+):(-?\d+)(~|\.\.)(-?\d+)/.match str
|
52
|
-
raise "Cannot parse coordinates: #{str}" if m.nil?
|
53
|
-
@id = m[1]
|
54
|
-
@from = m[2].to_i
|
55
|
-
if m[3] == '~'
|
56
|
-
@length = m[4].to_i
|
57
|
-
else
|
58
|
-
@to = m[4].to_i
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def extract(id, seq)
|
63
|
-
return nil unless concerns? id
|
64
|
-
from_i = from > 0 ? from : seq.length + 1 + from
|
65
|
-
if to.nil?
|
66
|
-
seq[from_i, length]
|
67
|
-
else
|
68
|
-
to_i = to > 0 ? to : seq.length + 1 + to
|
69
|
-
seq[from_i .. to_i]
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def concerns?(seq_id)
|
74
|
-
return true if id == '*'
|
75
|
-
return id == seq_id
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
class SeqCoordsCollection
|
80
|
-
class << self
|
81
|
-
def from_str(str)
|
82
|
-
c = new
|
83
|
-
str.split(',').each { |i| c << SeqCoords.new(i) }
|
84
|
-
c
|
85
|
-
end
|
86
|
-
def from_file(path)
|
87
|
-
c = new
|
88
|
-
File.open(path, 'r') do |fh|
|
89
|
-
fh.each{ |i| c << SeqCoords.new(i.chomp) }
|
90
|
-
end
|
91
|
-
c
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
attr :collection
|
96
|
-
|
97
|
-
def initialize
|
98
|
-
@collection = []
|
99
|
-
end
|
100
|
-
|
101
|
-
def <<(coords)
|
102
|
-
@collection << coords
|
103
|
-
end
|
104
|
-
|
105
|
-
def extract(id, seq)
|
106
|
-
@collection.map{ |c| c.extract(id, seq) }.compact
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Functions to parse sequences
|
111
|
-
def do_stuff(id, sq)
|
112
|
-
return if id.nil? or sq.empty?
|
113
|
-
@n_in += 1
|
114
|
-
sq.gsub!(/[^A-Za-z]/, '')
|
115
|
-
i = 0
|
116
|
-
@coll.extract(id, sq).each do |new_sq|
|
117
|
-
@ofh.puts ">#{id}:#{i += 1}"
|
118
|
-
@ofh.puts new_sq
|
119
|
-
@n_out += 1
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
# Parse coordinates
|
124
|
-
$stderr.puts 'Parsing coordinates' unless o[:q]
|
125
|
-
@coll = o[:c].nil? ? SeqCoordsCollection.from_file(o[:C]) :
|
126
|
-
SeqCoordsCollection.from_str(o[:c])
|
127
|
-
$stderr.puts " Coordinates found: #{@coll.collection.size}"
|
128
|
-
|
129
|
-
# Parse sequences
|
130
|
-
$stderr.puts 'Parsing sequences' unless o[:q]
|
131
|
-
@n_in = 0
|
132
|
-
@n_out = 0
|
133
|
-
@ofh = File.open(o[:o], 'w')
|
134
|
-
File.open(o[:i], 'r') do |fh|
|
135
|
-
id = nil
|
136
|
-
sq = ''
|
137
|
-
fh.each do |ln|
|
138
|
-
next if ln =~ /^;/
|
139
|
-
if ln =~ /^>(\S+)/
|
140
|
-
id = $1
|
141
|
-
do_stuff(id, sq)
|
142
|
-
sq = ''
|
143
|
-
else
|
144
|
-
sq << ln
|
145
|
-
end
|
146
|
-
end
|
147
|
-
do_stuff(id, sq)
|
148
|
-
end
|
149
|
-
@ofh.close
|
150
|
-
$stderr.puts " Input sequences: #{@n_in}"
|
151
|
-
$stderr.puts " Output fragments: #{@n_out}"
|
152
|
-
|
@@ -1,52 +0,0 @@
|
|
1
|
-
#!/usr/bin/env perl
|
2
|
-
#
|
3
|
-
# @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
4
|
-
# @update Oct-07-2015
|
5
|
-
# @license artistic license 2.0
|
6
|
-
#
|
7
|
-
|
8
|
-
use warnings;
|
9
|
-
use strict;
|
10
|
-
use Getopt::Std;
|
11
|
-
|
12
|
-
sub HELP_MESSAGE { die "
|
13
|
-
.Description:
|
14
|
-
Extracts a subset of sequences from a FastA file.
|
15
|
-
|
16
|
-
.Usage: $0 [options] list.txt seqs.fa > subset.fa
|
17
|
-
|
18
|
-
[options]
|
19
|
-
-r Reverse list. Extracts sequences NOT present in the list.
|
20
|
-
-q Runs quietly.
|
21
|
-
-h Prints this message and exits.
|
22
|
-
|
23
|
-
[mandatory]
|
24
|
-
list.txt List of sequences to extract.
|
25
|
-
seqs.fa FastA file containing the superset of sequences.
|
26
|
-
subset.fa FastA file to be created.
|
27
|
-
|
28
|
-
" }
|
29
|
-
|
30
|
-
my %o=();
|
31
|
-
getopts('rhq', \%o);
|
32
|
-
my($list, $fa) = @ARGV;
|
33
|
-
($list and $fa) or &HELP_MESSAGE;
|
34
|
-
$o{h} and &HELP_MESSAGE;
|
35
|
-
|
36
|
-
print STDERR "Reading list.\n" unless $o{q};
|
37
|
-
open LI, "<", $list or die "Cannot read file: $list: $!\n";
|
38
|
-
my %li = map { chomp; $_ => 1 } <LI>;
|
39
|
-
close LI;
|
40
|
-
|
41
|
-
print STDERR "Filtering FastA.\n" unless $o{q};
|
42
|
-
open FA, "<", $fa or die "Cannot read file: $fa: $!\n";
|
43
|
-
my $good = 0;
|
44
|
-
while(my $ln = <FA>){
|
45
|
-
next if $ln =~ /^;/;
|
46
|
-
chomp $ln;
|
47
|
-
if($ln =~ m/^>((\S+).*)/){ $good = (exists $li{$1} or exists $li{">$1"} or exists $li{$2} or exists $li{$ln}) }
|
48
|
-
elsif($ln =~ m/^>/){ $good=$o{r}; print STDERR "Warning: Non-cannonical defline, line $.: $ln\n" }
|
49
|
-
print "$ln\n" if (($good and not $o{r}) or ($o{r} and not $good));
|
50
|
-
}
|
51
|
-
close FA;
|
52
|
-
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/env perl
|
2
|
-
|
3
|
-
use warnings;
|
4
|
-
use strict;
|
5
|
-
use Bio::SeqIO;
|
6
|
-
|
7
|
-
my $file = $ARGV[0];
|
8
|
-
my $min = $ARGV[1];
|
9
|
-
($file and $min) or die <<HELP
|
10
|
-
|
11
|
-
This script will filter a multi fastA file by length
|
12
|
-
|
13
|
-
Usage "perl $0 fastafile minlenght "
|
14
|
-
HELP
|
15
|
-
;
|
16
|
-
my $seq_in = Bio::SeqIO->new( -format => 'fasta',-file => $file);
|
17
|
-
|
18
|
-
while( my $seq1 = $seq_in->next_seq() ) {
|
19
|
-
|
20
|
-
my $id = $seq1->primary_id;
|
21
|
-
chomp $id;
|
22
|
-
my $seq = $seq1->seq;
|
23
|
-
chomp $seq;
|
24
|
-
my $lseq = length($seq);
|
25
|
-
if($lseq>=$min){
|
26
|
-
print ">$id","\n",$seq,"\n";
|
27
|
-
}
|
28
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
#!/usr/bin/env perl
|
2
|
-
#
|
3
|
-
# @author Luis M. Rodriguez-R
|
4
|
-
# @update Oct-07-2015
|
5
|
-
# @license artistic license 2.0
|
6
|
-
#
|
7
|
-
|
8
|
-
use warnings;
|
9
|
-
use strict;
|
10
|
-
|
11
|
-
my($file, $content, $stretch) = @ARGV;
|
12
|
-
$file or die <<HELP
|
13
|
-
|
14
|
-
Description:
|
15
|
-
Filter sequences by N-content and presence of long homopolymers.
|
16
|
-
Usage:
|
17
|
-
$0 sequences.fa [content [stretch]] > filtered.fa
|
18
|
-
Where:
|
19
|
-
sequences.fa Input file in FastA format
|
20
|
-
content A number between 0 and 1 indicating the maximum proportion of Ns
|
21
|
-
(1 to turn off, 0.5 by default)
|
22
|
-
stretch A number indicating the maximum number of consecutive identical
|
23
|
-
nucleotides allowed (0 to turn off, 100 by default)
|
24
|
-
filtered.fa Filtered set of sequences.
|
25
|
-
|
26
|
-
HELP
|
27
|
-
;
|
28
|
-
($content ||= 0.5)+=0;
|
29
|
-
($stretch ||= 100)+=0;
|
30
|
-
|
31
|
-
my $good = 0;
|
32
|
-
my $N = 0;
|
33
|
-
|
34
|
-
FASTA: {
|
35
|
-
local $/ = "\n>";
|
36
|
-
open FILE, "<", $file or die "I can not open the file: $file: $!\n";
|
37
|
-
SEQ: while(<FILE>){
|
38
|
-
$N++;
|
39
|
-
s/^;.*//gm;
|
40
|
-
s/>//g;
|
41
|
-
my($n,$s) = split /\n/, $_, 2;
|
42
|
-
(my $clean = $s) =~ s/[^ACTGN]//g;
|
43
|
-
if($content < 1){
|
44
|
-
(my $Ns = $clean) =~ s/[^N]//g;
|
45
|
-
next SEQ if length($Ns)>length($clean)*$content;
|
46
|
-
}
|
47
|
-
if($stretch > 0){
|
48
|
-
for my $nuc (qw(A C T G N)){
|
49
|
-
next SEQ if $clean =~ m/[$nuc]{$stretch}/;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
print ">$n\n$s\n";
|
53
|
-
$good++;
|
54
|
-
}
|
55
|
-
close FILE;
|
56
|
-
print STDERR "Total sequences: $N\nAfter filtering: $good\n";
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
|
@@ -1,92 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# @author Luis M. Rodriguez-R
|
4
|
-
# @license artistic license 2.0
|
5
|
-
|
6
|
-
$:.push File.expand_path("../lib", __FILE__)
|
7
|
-
require "enveomics_rb/enveomics"
|
8
|
-
require "enveomics_rb/stat"
|
9
|
-
|
10
|
-
o = {q:false, completeness:nil, minlen:500, shuffle:true}
|
11
|
-
OptionParser.new do |opts|
|
12
|
-
opts.banner = "
|
13
|
-
Simulates incomplete (fragmented) drafts from complete genomes.
|
14
|
-
|
15
|
-
Usage: #{$0} [options]"
|
16
|
-
opts.separator ""
|
17
|
-
opts.separator "Mandatory"
|
18
|
-
opts.on("-i", "--in FILE",
|
19
|
-
"Path to the FastA file containing the complete sequences."
|
20
|
-
){ |v| o[:in] = v }
|
21
|
-
opts.on("-o", "--out FILE", "Path to the FastA to create."){ |v| o[:out] = v }
|
22
|
-
opts.on("-c", "--completeness FLOAT",
|
23
|
-
"Fraction of genome completeness to simulate from 0 to 1."
|
24
|
-
){ |v| o[:completeness] = v.to_f }
|
25
|
-
opts.separator ""
|
26
|
-
opts.separator "Options"
|
27
|
-
opts.on("-m", "--minlen INT",
|
28
|
-
"Minimum fragment length to report. By default: #{o[:minlen]}."
|
29
|
-
){ |v| o[:minlen] = v.to_i }
|
30
|
-
opts.on("-s", "--sorted", "Keep fragments sorted as in the input file. ",
|
31
|
-
"By default, fragments are shuffled."){ |v| o[:shuffle] = !v }
|
32
|
-
opts.on("-q", "--quiet", "Run quietly (no STDERR output)"){ o[:q] = true }
|
33
|
-
opts.on("-h", "--help", "Display this screen") do
|
34
|
-
puts opts
|
35
|
-
exit
|
36
|
-
end
|
37
|
-
opts.separator ""
|
38
|
-
end.parse!
|
39
|
-
abort "-i is mandatory" if o[:in].nil?
|
40
|
-
abort "-o is mandatory" if o[:out].nil?
|
41
|
-
abort "-c is mandatory" if o[:completeness].nil?
|
42
|
-
|
43
|
-
begin
|
44
|
-
# Read input sequences
|
45
|
-
g_id = []
|
46
|
-
g_seq = []
|
47
|
-
File.open(o[:in], "r") do |ifh|
|
48
|
-
id = ""
|
49
|
-
ifh.each_line do |ln|
|
50
|
-
if ln =~ /^>(\S*)/
|
51
|
-
g_id << $1
|
52
|
-
g_seq << ""
|
53
|
-
else
|
54
|
-
g_seq[g_seq.size-1] += ln.gsub(/[^A-Za-z]/,"")
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Fragment genomes
|
60
|
-
f = {}
|
61
|
-
binlen = [1, (o[:minlen].to_f/(1.5**2)).ceil].max
|
62
|
-
p = [0.001, [1.0, 1.0 - (o[:completeness]/1.25 + 0.1)].min].max
|
63
|
-
while not g_seq.empty?
|
64
|
-
id = g_id.shift
|
65
|
-
seq = g_seq.shift
|
66
|
-
gL = seq.length
|
67
|
-
while not seq.empty?
|
68
|
-
fL = [0, ((Enve::Stat.r_geom(p).to_f +
|
69
|
-
Enve::Stat.r_unif(-0.5,0.5))*binlen).round].max
|
70
|
-
f["#{f.size+1}_#{id}"] = seq[0,fL] if fL >= o[:minlen]
|
71
|
-
seq = seq[(fL+1) .. -1]
|
72
|
-
seq = "" if seq.nil?
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# Save output
|
77
|
-
k = f.keys
|
78
|
-
k.shuffle! if o[:shuffle]
|
79
|
-
File.open(o[:out], "w") do |ofh|
|
80
|
-
k.each do |id|
|
81
|
-
ofh.puts ">#{id}"
|
82
|
-
ofh.puts f[id].gsub(/(\S{50})/, "\\1\n")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
rescue => err
|
87
|
-
$stderr.puts "Exception: #{err}\n\n"
|
88
|
-
err.backtrace.each { |l| $stderr.puts l + "\n" }
|
89
|
-
err
|
90
|
-
end
|
91
|
-
|
92
|
-
|