miga-base 0.3.0.0 → 0.3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -4
- data/actions/init.rb +258 -0
- data/actions/run_local.rb +1 -2
- data/actions/test_taxonomy.rb +4 -1
- data/bin/miga +8 -1
- data/lib/miga/dataset.rb +4 -4
- data/lib/miga/dataset_result.rb +7 -4
- data/lib/miga/version.rb +2 -2
- data/scripts/_distances_noref_nomulti.bash +3 -1
- data/scripts/clade_finding.bash +1 -1
- data/scripts/init.bash +1 -1
- data/scripts/miga.bash +1 -1
- data/scripts/mytaxa.bash +78 -72
- data/scripts/mytaxa_scan.bash +67 -62
- data/scripts/ogs.bash +1 -1
- data/scripts/trimmed_fasta.bash +4 -3
- data/utils/enveomics/Examples/aai-matrix.bash +66 -0
- data/utils/enveomics/Examples/ani-matrix.bash +66 -0
- data/utils/enveomics/Examples/essential-phylogeny.bash +105 -0
- data/utils/enveomics/Examples/unus-genome-phylogeny.bash +100 -0
- data/utils/enveomics/LICENSE.txt +73 -0
- data/utils/enveomics/Makefile +52 -0
- data/utils/enveomics/Manifest/Tasks/aasubs.json +103 -0
- data/utils/enveomics/Manifest/Tasks/blasttab.json +703 -0
- data/utils/enveomics/Manifest/Tasks/distances.json +161 -0
- data/utils/enveomics/Manifest/Tasks/fasta.json +571 -0
- data/utils/enveomics/Manifest/Tasks/fastq.json +208 -0
- data/utils/enveomics/Manifest/Tasks/graphics.json +126 -0
- data/utils/enveomics/Manifest/Tasks/ogs.json +339 -0
- data/utils/enveomics/Manifest/Tasks/other.json +746 -0
- data/utils/enveomics/Manifest/Tasks/remote.json +355 -0
- data/utils/enveomics/Manifest/Tasks/sequence-identity.json +454 -0
- data/utils/enveomics/Manifest/Tasks/tables.json +308 -0
- data/utils/enveomics/Manifest/Tasks/trees.json +68 -0
- data/utils/enveomics/Manifest/Tasks/variants.json +111 -0
- data/utils/enveomics/Manifest/categories.json +132 -0
- data/utils/enveomics/Manifest/examples.json +154 -0
- data/utils/enveomics/Manifest/tasks.json +4 -0
- data/utils/enveomics/Pipelines/assembly.pbs/CONFIG.mock.bash +69 -0
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.N50.pl +56 -0
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.filterN.pl +60 -0
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.length.pl +38 -0
- data/utils/enveomics/Pipelines/assembly.pbs/README.md +189 -0
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME-2.bash +112 -0
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME-3.bash +23 -0
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME-4.bash +44 -0
- data/utils/enveomics/Pipelines/assembly.pbs/RUNME.bash +50 -0
- data/utils/enveomics/Pipelines/assembly.pbs/kSelector.R +37 -0
- data/utils/enveomics/Pipelines/assembly.pbs/newbler.pbs +68 -0
- data/utils/enveomics/Pipelines/assembly.pbs/newbler_preparator.pl +49 -0
- data/utils/enveomics/Pipelines/assembly.pbs/soap.pbs +80 -0
- data/utils/enveomics/Pipelines/assembly.pbs/stats.pbs +57 -0
- data/utils/enveomics/Pipelines/assembly.pbs/velvet.pbs +63 -0
- data/utils/enveomics/Pipelines/blast.pbs/01.pbs.bash +38 -0
- data/utils/enveomics/Pipelines/blast.pbs/02.pbs.bash +73 -0
- data/utils/enveomics/Pipelines/blast.pbs/03.pbs.bash +21 -0
- data/utils/enveomics/Pipelines/blast.pbs/BlastTab.recover_job.pl +72 -0
- data/utils/enveomics/Pipelines/blast.pbs/CONFIG.mock.bash +98 -0
- data/utils/enveomics/Pipelines/blast.pbs/FastA.split.pl +55 -0
- data/utils/enveomics/Pipelines/blast.pbs/README.md +127 -0
- data/utils/enveomics/Pipelines/blast.pbs/RUNME.bash +109 -0
- data/utils/enveomics/Pipelines/blast.pbs/TASK.check.bash +128 -0
- data/utils/enveomics/Pipelines/blast.pbs/TASK.dry.bash +16 -0
- data/utils/enveomics/Pipelines/blast.pbs/TASK.eo.bash +22 -0
- data/utils/enveomics/Pipelines/blast.pbs/TASK.pause.bash +26 -0
- data/utils/enveomics/Pipelines/blast.pbs/TASK.run.bash +89 -0
- data/utils/enveomics/Pipelines/blast.pbs/sentinel.pbs.bash +29 -0
- data/utils/enveomics/Pipelines/idba.pbs/README.md +49 -0
- data/utils/enveomics/Pipelines/idba.pbs/RUNME.bash +95 -0
- data/utils/enveomics/Pipelines/idba.pbs/run.pbs +56 -0
- data/utils/enveomics/Pipelines/trim.pbs/README.md +54 -0
- data/utils/enveomics/Pipelines/trim.pbs/RUNME.bash +70 -0
- data/utils/enveomics/Pipelines/trim.pbs/run.pbs +130 -0
- data/utils/enveomics/README.md +40 -0
- data/utils/enveomics/Scripts/AAsubs.log2ratio.rb +171 -0
- data/utils/enveomics/Scripts/Aln.cat.rb +162 -0
- data/utils/enveomics/Scripts/Aln.convert.pl +35 -0
- data/utils/enveomics/Scripts/AlphaDiversity.pl +152 -0
- data/utils/enveomics/Scripts/BlastPairwise.AAsubs.pl +102 -0
- data/utils/enveomics/Scripts/BlastTab.addlen.rb +61 -0
- data/utils/enveomics/Scripts/BlastTab.advance.bash +48 -0
- data/utils/enveomics/Scripts/BlastTab.best_hit_sorted.pl +55 -0
- data/utils/enveomics/Scripts/BlastTab.catsbj.pl +106 -0
- data/utils/enveomics/Scripts/BlastTab.cogCat.rb +76 -0
- data/utils/enveomics/Scripts/BlastTab.filter.pl +47 -0
- data/utils/enveomics/Scripts/BlastTab.kegg_pep2path_rest.pl +194 -0
- data/utils/enveomics/Scripts/BlastTab.metaxaPrep.pl +104 -0
- data/utils/enveomics/Scripts/BlastTab.pairedHits.rb +157 -0
- data/utils/enveomics/Scripts/BlastTab.recplot2.R +40 -0
- data/utils/enveomics/Scripts/BlastTab.seqdepth.pl +86 -0
- data/utils/enveomics/Scripts/BlastTab.seqdepth_ZIP.pl +119 -0
- data/utils/enveomics/Scripts/BlastTab.seqdepth_nomedian.pl +86 -0
- data/utils/enveomics/Scripts/BlastTab.subsample.pl +47 -0
- data/utils/enveomics/Scripts/BlastTab.sumPerHit.pl +114 -0
- data/utils/enveomics/Scripts/BlastTab.taxid2taxrank.pl +90 -0
- data/utils/enveomics/Scripts/BlastTab.topHits_sorted.rb +101 -0
- data/utils/enveomics/Scripts/Chao1.pl +97 -0
- data/utils/enveomics/Scripts/CharTable.classify.rb +234 -0
- data/utils/enveomics/Scripts/EBIseq2tax.rb +83 -0
- data/utils/enveomics/Scripts/FastA.N50.pl +56 -0
- data/utils/enveomics/Scripts/FastA.filter.pl +52 -0
- data/utils/enveomics/Scripts/FastA.filterLen.pl +28 -0
- data/utils/enveomics/Scripts/FastA.filterN.pl +60 -0
- data/utils/enveomics/Scripts/FastA.fragment.rb +92 -0
- data/utils/enveomics/Scripts/FastA.gc.pl +42 -0
- data/utils/enveomics/Scripts/FastA.interpose.pl +87 -0
- data/utils/enveomics/Scripts/FastA.length.pl +38 -0
- data/utils/enveomics/Scripts/FastA.per_file.pl +36 -0
- data/utils/enveomics/Scripts/FastA.qlen.pl +57 -0
- data/utils/enveomics/Scripts/FastA.rename.pl +65 -0
- data/utils/enveomics/Scripts/FastA.revcom.pl +23 -0
- data/utils/enveomics/Scripts/FastA.slider.pl +85 -0
- data/utils/enveomics/Scripts/FastA.split.pl +55 -0
- data/utils/enveomics/Scripts/FastA.subsample.pl +131 -0
- data/utils/enveomics/Scripts/FastA.tag.rb +64 -0
- data/utils/enveomics/Scripts/FastA.wrap.rb +48 -0
- data/utils/enveomics/Scripts/FastQ.filter.pl +54 -0
- data/utils/enveomics/Scripts/FastQ.interpose.pl +90 -0
- data/utils/enveomics/Scripts/FastQ.offset.pl +90 -0
- data/utils/enveomics/Scripts/FastQ.split.pl +53 -0
- data/utils/enveomics/Scripts/FastQ.tag.rb +63 -0
- data/utils/enveomics/Scripts/FastQ.toFastA.awk +24 -0
- data/utils/enveomics/Scripts/GenBank.add_fields.rb +84 -0
- data/utils/enveomics/Scripts/HMM.essential.rb +254 -0
- data/utils/enveomics/Scripts/HMMsearch.extractIds.rb +83 -0
- data/utils/enveomics/Scripts/JPlace.distances.rb +88 -0
- data/utils/enveomics/Scripts/JPlace.to_iToL.rb +306 -0
- data/utils/enveomics/Scripts/M5nr.getSequences.rb +81 -0
- data/utils/enveomics/Scripts/MeTaxa.distribution.pl +198 -0
- data/utils/enveomics/Scripts/MyTaxa.fragsByTax.pl +35 -0
- data/utils/enveomics/Scripts/MyTaxa.seq-taxrank.rb +49 -0
- data/utils/enveomics/Scripts/NCBIacc2tax.rb +92 -0
- data/utils/enveomics/Scripts/Newick.autoprune.R +27 -0
- data/utils/enveomics/Scripts/RAxML-EPA.to_iToL.pl +228 -0
- data/utils/enveomics/Scripts/RefSeq.download.bash +48 -0
- data/utils/enveomics/Scripts/SRA.download.bash +50 -0
- data/utils/enveomics/Scripts/TRIBS.plot-test.R +36 -0
- data/utils/enveomics/Scripts/TRIBS.test.R +39 -0
- data/utils/enveomics/Scripts/Table.barplot.R +30 -0
- data/utils/enveomics/Scripts/Table.df2dist.R +30 -0
- data/utils/enveomics/Scripts/Table.filter.pl +61 -0
- data/utils/enveomics/Scripts/Table.merge.pl +77 -0
- data/utils/enveomics/Scripts/Table.replace.rb +69 -0
- data/utils/enveomics/Scripts/Table.round.rb +63 -0
- data/utils/enveomics/Scripts/Table.split.pl +57 -0
- data/utils/enveomics/Scripts/Taxonomy.silva2ncbi.rb +227 -0
- data/utils/enveomics/Scripts/VCF.KaKs.rb +147 -0
- data/utils/enveomics/Scripts/VCF.SNPs.rb +88 -0
- data/utils/enveomics/Scripts/aai.rb +373 -0
- data/utils/enveomics/Scripts/ani.rb +362 -0
- data/utils/enveomics/Scripts/gi2tax.rb +103 -0
- data/utils/enveomics/Scripts/in_silico_GA_GI.pl +96 -0
- data/utils/enveomics/Scripts/lib/data/essential.hmm.gz +0 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/enveomics.rb +26 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/jplace.rb +253 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/og.rb +182 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/remote_data.rb +74 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/seq_range.rb +237 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/stat.rb +30 -0
- data/utils/enveomics/Scripts/lib/enveomics_rb/vcf.rb +135 -0
- data/utils/enveomics/Scripts/ogs.annotate.rb +88 -0
- data/utils/enveomics/Scripts/ogs.core-pan.rb +160 -0
- data/utils/enveomics/Scripts/ogs.extract.rb +125 -0
- data/utils/enveomics/Scripts/ogs.mcl.rb +186 -0
- data/utils/enveomics/Scripts/ogs.rb +104 -0
- data/utils/enveomics/Scripts/ogs.stats.rb +131 -0
- data/utils/enveomics/Scripts/rbm.rb +137 -0
- data/utils/enveomics/Tests/Makefile +10 -0
- data/utils/enveomics/Tests/Mgen_M2288.faa +3189 -0
- data/utils/enveomics/Tests/Mgen_M2288.fna +8282 -0
- data/utils/enveomics/Tests/Mgen_M2321.fna +8288 -0
- data/utils/enveomics/Tests/Nequ_Kin4M.faa +2970 -0
- data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.tribs.Rdata +0 -0
- data/utils/enveomics/Tests/Xanthomonas_oryzae-PilA.txt +7 -0
- data/utils/enveomics/Tests/Xanthomonas_oryzae.aai-mat.tsv +17 -0
- data/utils/enveomics/Tests/Xanthomonas_oryzae.aai.tsv +137 -0
- data/utils/enveomics/Tests/a_mg.cds-go.blast.tsv +123 -0
- data/utils/enveomics/Tests/a_mg.reads-cds.blast.tsv +200 -0
- data/utils/enveomics/Tests/a_mg.reads-cds.counts.tsv +55 -0
- data/utils/enveomics/Tests/alkB.nwk +1 -0
- data/utils/enveomics/Tests/anthrax-cansnp-data.tsv +13 -0
- data/utils/enveomics/Tests/anthrax-cansnp-key.tsv +17 -0
- data/utils/enveomics/Tests/hiv1.faa +59 -0
- data/utils/enveomics/Tests/hiv1.fna +134 -0
- data/utils/enveomics/Tests/hiv2.faa +70 -0
- data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv +233 -0
- data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.lim +1 -0
- data/utils/enveomics/Tests/hiv_mix-hiv1.blast.tsv.rec +233 -0
- data/utils/enveomics/Tests/phyla_counts.tsv +10 -0
- data/utils/enveomics/Tests/primate_lentivirus.ogs +11 -0
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv1.rbm +9 -0
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-hiv2.rbm +8 -0
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv1-siv.rbm +6 -0
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-hiv2.rbm +9 -0
- data/utils/enveomics/Tests/primate_lentivirus.rbm/hiv2-siv.rbm +6 -0
- data/utils/enveomics/Tests/primate_lentivirus.rbm/siv-siv.rbm +6 -0
- data/utils/enveomics/build_enveomics_r.bash +44 -0
- data/utils/enveomics/enveomics.R/DESCRIPTION +31 -0
- data/utils/enveomics/enveomics.R/NAMESPACE +35 -0
- data/utils/enveomics/enveomics.R/R/autoprune.R +121 -0
- data/utils/enveomics/enveomics.R/R/barplot.R +165 -0
- data/utils/enveomics/enveomics.R/R/cliopts.R +119 -0
- data/utils/enveomics/enveomics.R/R/df2dist.R +117 -0
- data/utils/enveomics/enveomics.R/R/growthcurve.R +263 -0
- data/utils/enveomics/enveomics.R/R/recplot.R +320 -0
- data/utils/enveomics/enveomics.R/R/recplot2.R +745 -0
- data/utils/enveomics/enveomics.R/R/tribs.R +423 -0
- data/utils/enveomics/enveomics.R/R/utils.R +16 -0
- data/utils/enveomics/enveomics.R/README.md +52 -0
- 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/enve.GrowthCurve-class.Rd +30 -0
- data/utils/enveomics/enveomics.R/man/enve.TRIBS-class.Rd +43 -0
- data/utils/enveomics/enveomics.R/man/enve.TRIBS.merge.Rd +19 -0
- data/utils/enveomics/enveomics.R/man/enve.TRIBStest-class.Rd +37 -0
- data/utils/enveomics/enveomics.R/man/enve.__prune.iter.Rd +24 -0
- data/utils/enveomics/enveomics.R/man/enve.__prune.reduce.Rd +24 -0
- data/utils/enveomics/enveomics.R/man/enve.__tribs.Rd +33 -0
- data/utils/enveomics/enveomics.R/man/enve.barplot.Rd +64 -0
- data/utils/enveomics/enveomics.R/man/enve.cliopts.Rd +37 -0
- data/utils/enveomics/enveomics.R/man/enve.col.alpha.Rd +19 -0
- data/utils/enveomics/enveomics.R/man/enve.col2alpha.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/enve.df2dist.Rd +26 -0
- data/utils/enveomics/enveomics.R/man/enve.df2dist.group.Rd +25 -0
- data/utils/enveomics/enveomics.R/man/enve.df2dist.list.Rd +26 -0
- data/utils/enveomics/enveomics.R/man/enve.growthcurve.Rd +49 -0
- data/utils/enveomics/enveomics.R/man/enve.prune.dist.Rd +28 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +97 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2-class.Rd +40 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.Rd +40 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__counts.Rd +24 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__findPeak.Rd +40 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__findPeaks.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__peakHist.Rd +22 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.__whichClosestPeak.Rd +20 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.changeCutoff.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.corePeak.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +27 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.Rd +53 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.peak-class.Rd +44 -0
- data/utils/enveomics/enveomics.R/man/enve.tribs.Rd +44 -0
- data/utils/enveomics/enveomics.R/man/enve.tribs.test.Rd +21 -0
- data/utils/enveomics/enveomics.R/man/enveomics.R-package.Rd +15 -0
- data/utils/enveomics/enveomics.R/man/growth.curves.Rd +14 -0
- data/utils/enveomics/enveomics.R/man/phyla.counts.Rd +13 -0
- data/utils/enveomics/enveomics.R/man/plot.enve.GrowthCurve.Rd +43 -0
- data/utils/enveomics/enveomics.R/man/plot.enve.TRIBS.Rd +29 -0
- data/utils/enveomics/enveomics.R/man/plot.enve.TRIBStest.Rd +30 -0
- data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +71 -0
- data/utils/enveomics/enveomics.R/man/summary.enve.GrowthCurve.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/summary.enve.TRIBS.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/summary.enve.TRIBStest.Rd +18 -0
- data/utils/enveomics/enveomics.R/man/z$-methods.Rd +27 -0
- data/utils/enveomics/globals.mk +8 -0
- data/utils/enveomics/manifest.json +9 -0
- data/utils/index_metadata.rb +0 -0
- data/utils/plot-taxdist.R +0 -0
- data/utils/requirements.txt +19 -19
- metadata +242 -2
@@ -0,0 +1,162 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# @author Luis M. Rodriguez-R
|
4
|
+
# @update Nov-30-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 = {:q=>false, :missing=>"-", :model=>"AUTO", :removeinvar=>false,
|
12
|
+
:undefined=>"-.Xx?"}
|
13
|
+
OptionParser.new do |opt|
|
14
|
+
opt.banner = "
|
15
|
+
Concatenates several multiple alignments in FastA format into a single
|
16
|
+
multiple alignment. The IDs of the sequences (or the ID prefixes, if using
|
17
|
+
--ignore-after) must coincide across files.
|
18
|
+
|
19
|
+
Usage: #{$0} [options] aln1.fa aln2.fa ... > aln.fa".gsub(/^ +/,"")
|
20
|
+
opt.separator ""
|
21
|
+
opt.on("-c", "--coords FILE",
|
22
|
+
"Output file of coordinates in RAxML-compliant format."
|
23
|
+
){ |v| o[:coords]=v }
|
24
|
+
opt.on("-i", "--ignore-after STRING",
|
25
|
+
"Remove everything in the IDs after the specified string."
|
26
|
+
){ |v| o[:ignoreafter]=v }
|
27
|
+
opt.on("-I", "--remove-invariable", "Remove invariable sites.",
|
28
|
+
"Note: Invariable sites are defined as columns with only one state and",
|
29
|
+
"undefined characters. Additional ambiguous characters may exist and",
|
30
|
+
"should be declared using --undefined."){ |v| o[:removeinvar]=v }
|
31
|
+
opt.on("-u", "--missing-char CHAR",
|
32
|
+
"Character denoting missing data. By default: '#{o[:missing]}'.") do |v|
|
33
|
+
abort "Missing positions can only be denoted by single characters, " +
|
34
|
+
"offending value: '#{v}'." if v.length != 1
|
35
|
+
o[:missing]=v
|
36
|
+
end
|
37
|
+
opt.on("-m", "--model STRING",
|
38
|
+
"Name of the model to use if --coords is used. See RAxML's docs; ",
|
39
|
+
"supported values in v8+ include:",
|
40
|
+
"o For DNA alignments:",
|
41
|
+
" 'DNA[F|X]', or 'DNA[F|X]/3' (to estimate rates per codon position,",
|
42
|
+
" particular notation for this script).",
|
43
|
+
"o General protein alignments:",
|
44
|
+
" 'AUTO' (default in this script), 'DAYHOFF' (1978), 'DCMUT' (MBE 2005;",
|
45
|
+
" 22(2):193-199), 'JTT' (Nat 1992;358:86-89), 'VT' (JCompBiol 2000;",
|
46
|
+
" 7(6):761-776), 'BLOSUM62' (PNAS 1992;89:10915), and 'LG' (MBE 2008;",
|
47
|
+
" 25(7):1307-1320).",
|
48
|
+
"o Specialized protein alignments:",
|
49
|
+
" 'MTREV' (mitochondrial, JME 1996;42(4):459-468), 'WAG' (globular, MBE",
|
50
|
+
" 2001;18(5):691-699), 'RTREV' (retrovirus, JME 2002;55(1):65-73), ",
|
51
|
+
" 'CPREV' (chloroplast, JME 2000;50(4):348-358), and 'MTMAM' (nuclear",
|
52
|
+
" mammal proteins, JME 1998;46(4):409-418)."){|v| o[:model]=v}
|
53
|
+
opt.on("--undefined STRING",
|
54
|
+
"All characters to be regarded as 'undefined'. It should include all",
|
55
|
+
"ambiguous and missing data chars. Ignored unless --remove-invariable.",
|
56
|
+
"By default: '#{o[:undefined]}'."){|v| o[:undefined]=v}
|
57
|
+
opt.on("-q", "--quiet", "Run quietly (no STDERR output)."){ o[:q] = TRUE }
|
58
|
+
opt.on("-h", "--help", "Display this screen.") do
|
59
|
+
puts opt
|
60
|
+
exit
|
61
|
+
end
|
62
|
+
opt.separator ""
|
63
|
+
end.parse!
|
64
|
+
alns = ARGV
|
65
|
+
abort "Alignment files are mandatory" if alns.nil? or alns.empty?
|
66
|
+
|
67
|
+
##### MAIN:
|
68
|
+
begin
|
69
|
+
$stderr.puts "Reading." unless o[:q]
|
70
|
+
a = {}
|
71
|
+
n = alns.size-1
|
72
|
+
lengths = []
|
73
|
+
(0 .. n).each do |i|
|
74
|
+
key = nil
|
75
|
+
File.open(alns[i],"r").each do |ln|
|
76
|
+
ln.chomp!
|
77
|
+
if ln =~ /^>(\S+)/
|
78
|
+
key = $1
|
79
|
+
key.sub!(/#{o[:ignoreafter]}.*/,"") unless o[:ignoreafter].nil?
|
80
|
+
a[key] ||= []
|
81
|
+
a[key][i] = ""
|
82
|
+
else
|
83
|
+
abort "#{alns[i]}: Leading line is not a def-line, is this a "+
|
84
|
+
"valid FastA file?" if key.nil?
|
85
|
+
ln.gsub!(/\s/,"")
|
86
|
+
a[key][i] += ln
|
87
|
+
end
|
88
|
+
end
|
89
|
+
abort "#{alns[i]}: Empty alignment?" if key.nil?
|
90
|
+
lengths[i] = a[key][i].length
|
91
|
+
end
|
92
|
+
if o[:removeinvar]
|
93
|
+
$stderr.puts "Removing invariable sites." unless o[:q]
|
94
|
+
invs = 0
|
95
|
+
(0 .. n).each do |i|
|
96
|
+
olen = lengths[i]
|
97
|
+
(0 .. (lengths[i]-1)).each do |pos|
|
98
|
+
chr = nil
|
99
|
+
inv = true
|
100
|
+
a.keys.each do |key|
|
101
|
+
next if a[key][i].nil?
|
102
|
+
chr = a[key][i][pos] if
|
103
|
+
chr.nil? or o[:undefined].chars.include? chr
|
104
|
+
if chr != a[key][i][pos] and
|
105
|
+
not o[:undefined].chars.include? a[key][i][pos]
|
106
|
+
inv = false
|
107
|
+
break
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if inv
|
111
|
+
a.keys.each{|key| a[key][i][pos]="!" unless a[key][i].nil?}
|
112
|
+
lengths[i] -= 1
|
113
|
+
invs += 1
|
114
|
+
end
|
115
|
+
end
|
116
|
+
a.keys.each{|key| a[key][i].gsub!("!", "") unless a[key][i].nil?}
|
117
|
+
end
|
118
|
+
$stderr.puts " Removed #{invs} sites." unless o[:q]
|
119
|
+
end
|
120
|
+
$stderr.puts "Concatenating." unless o[:q]
|
121
|
+
a.keys.each do |key|
|
122
|
+
(0 .. n).each do |i|
|
123
|
+
a[key][i] = (o[:missing] * lengths[i]) if a[key][i].nil?
|
124
|
+
end
|
125
|
+
abort "Inconsistent lengths in '#{key}'
|
126
|
+
exp:#{lengths.join(" ")}
|
127
|
+
obs:#{a[key].map{|i| i.length}.join(" ")}." unless
|
128
|
+
lengths == a[key].map{|i| i.length}
|
129
|
+
puts ">#{key}", a[key].join("").gsub(/(.{1,60})/, "\\1\n")
|
130
|
+
a.delete(key)
|
131
|
+
end
|
132
|
+
unless o[:coords].nil?
|
133
|
+
$stderr.puts "Generating coordinates." unless o[:q]
|
134
|
+
coords = File.open(o[:coords],"w")
|
135
|
+
s = 0
|
136
|
+
names = (alns.map do |a|
|
137
|
+
File.basename(a).gsub(/\..*/,"").gsub(/[^A-Za-z0-9_]/,"_")
|
138
|
+
end)
|
139
|
+
(0 .. n).each do |i|
|
140
|
+
l = lengths[i]
|
141
|
+
next unless l > 0
|
142
|
+
names[i] += "_#{i}" while names.count(names[i])>1
|
143
|
+
if o[:model] =~ /(DNA.?)\/3/
|
144
|
+
coords.puts "#{$1}, #{names[i]}codon1 = #{s+1}-#{s+l}\\3"
|
145
|
+
coords.puts "#{$1}, #{names[i]}codon2 = #{s+2}-#{s+l}\\3"
|
146
|
+
coords.puts "#{$1}, #{names[i]}codon3 = #{s+3}-#{s+l}\\3"
|
147
|
+
else
|
148
|
+
coords.puts "#{o[:model]}, #{names[i]} = #{s+1}-#{s+l}"
|
149
|
+
end
|
150
|
+
s += l
|
151
|
+
end
|
152
|
+
coords.close
|
153
|
+
end
|
154
|
+
# Save the output matrix
|
155
|
+
$stderr.puts "Done.\n" unless o[:q]
|
156
|
+
rescue => err
|
157
|
+
$stderr.puts "Exception: #{err}\n\n"
|
158
|
+
err.backtrace.each { |l| $stderr.puts l + "\n" }
|
159
|
+
err
|
160
|
+
end
|
161
|
+
|
162
|
+
|
@@ -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
|
+
|
@@ -0,0 +1,152 @@
|
|
1
|
+
#!/usr/bin/env perl
|
2
|
+
|
3
|
+
#
|
4
|
+
# @author: Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
5
|
+
# @update: Nov-29-2015
|
6
|
+
# @license: artistic license 2.0
|
7
|
+
#
|
8
|
+
|
9
|
+
use warnings;
|
10
|
+
use strict;
|
11
|
+
use Getopt::Std;
|
12
|
+
use List::Util qw/min max sum/;
|
13
|
+
|
14
|
+
sub VERSION_MESSAGE(){print "Alpha-diversity indices (enveomics)\n"}
|
15
|
+
sub HELP_MESSAGE(){die "
|
16
|
+
Description:
|
17
|
+
Takes a table of OTU abundance in one or more samples and calculates the Rao
|
18
|
+
(Q_alpha), Rao-Jost (Q_alpha_eqv), Shannon (Hprime), and inverse Simpson
|
19
|
+
(1_lambda) indices of alpha diversity for each sample.
|
20
|
+
|
21
|
+
To use it with Qiime OTU Tables, run it as:
|
22
|
+
$0 -i OTU_Table.txt -h
|
23
|
+
|
24
|
+
Usage:
|
25
|
+
$0 [opts]
|
26
|
+
|
27
|
+
-i <str> * Input table (columns:samples, rows:OTUs, first column:OTU
|
28
|
+
names).
|
29
|
+
-r <int> Number of rows to ignore. By default: 0.
|
30
|
+
-c <int> Number of columns to ignore after the first column (i.e.,
|
31
|
+
between the first column, containing the name of the categories,
|
32
|
+
and the first column of abundance values). By default: 0.
|
33
|
+
-C <int> Number of columns to ignore at the end of each line.
|
34
|
+
By default: 0.
|
35
|
+
-d <str> Delimiter. Supported escaped characters are: \"\\t\"
|
36
|
+
(tabulation), and \"\\0\" (null bit). By default: \"\\t\".
|
37
|
+
-h If set, the first row is assumed to have the names of the
|
38
|
+
samples.
|
39
|
+
-D <str> Distances file. A squared matrix (or bottom-left half matrix)
|
40
|
+
with the distances between categories (OTUs or functions). The
|
41
|
+
first column must contain the names of the categories, and it
|
42
|
+
shouldn't have headers. If not set, all distances are assumed
|
43
|
+
to be one. Only used for Rao.
|
44
|
+
-R Do not calculate Rao indices. This significantly decreases the
|
45
|
+
total running time. Note that Rao indices are highly susceptible
|
46
|
+
to precision errors, and shouldn't be trusted for very big
|
47
|
+
numbers.
|
48
|
+
-q <int> Estimate the qD index (true diversity order q). By default: 0.
|
49
|
+
--help This help message.
|
50
|
+
|
51
|
+
* Mandatory.
|
52
|
+
|
53
|
+
"}
|
54
|
+
|
55
|
+
# Input arguments
|
56
|
+
my %o;
|
57
|
+
getopts('i:c:C:d:r:hD:Rq:', \%o);
|
58
|
+
|
59
|
+
#$o{B} and (eval("use bignum; 1") or die "Cannot use bignum.\n");
|
60
|
+
&HELP_MESSAGE() unless $o{i};
|
61
|
+
$o{c} ||= 0;
|
62
|
+
$o{C} ||= 0;
|
63
|
+
$o{r} ||= 0;
|
64
|
+
$o{d} ||= "\\t";
|
65
|
+
$o{q} ||= 0;
|
66
|
+
|
67
|
+
$o{d}="\t" if $o{d} eq "\\t";
|
68
|
+
$o{d}="\0" if $o{d} eq "\\0";
|
69
|
+
|
70
|
+
# Distance matrix
|
71
|
+
my $D = {};
|
72
|
+
if($o{D} and not $o{R}){
|
73
|
+
my @Didx = ();
|
74
|
+
open DIST, "<", $o{D} or die "Cannot read file: $o{D}: $!\n";
|
75
|
+
while(<DIST>){
|
76
|
+
chomp;
|
77
|
+
my @d = split /\t/;
|
78
|
+
my $idx = shift @d;
|
79
|
+
push @Didx, $idx;
|
80
|
+
$D->{ $idx } ||= {};
|
81
|
+
$D->{ $idx }->{ $Didx[$_] } = $d[$_] for(0 .. $#d);
|
82
|
+
}
|
83
|
+
close DIST;
|
84
|
+
undef @Didx;
|
85
|
+
}
|
86
|
+
|
87
|
+
# Abundance matrix
|
88
|
+
my @names = ();
|
89
|
+
my @cats = ();
|
90
|
+
my @values = ();
|
91
|
+
open TABLE, "<", $o{i} or die "Cannot open file: ".$o{i}.": $!\n";
|
92
|
+
<TABLE> for (1 .. $o{r});
|
93
|
+
if($o{h}){
|
94
|
+
my $h = <TABLE>;
|
95
|
+
$h or die "Empty table!\n";
|
96
|
+
chomp $h;
|
97
|
+
@names = split $o{d}, $h;
|
98
|
+
shift @names for (0 .. $o{c});
|
99
|
+
}
|
100
|
+
|
101
|
+
while(<TABLE>){
|
102
|
+
chomp;
|
103
|
+
my @ln = split $o{d};
|
104
|
+
push @cats, shift(@ln);
|
105
|
+
shift @ln for (1 .. $o{c});
|
106
|
+
pop @ln for (1 .. $o{C});
|
107
|
+
push @{$values[$_] ||= []}, $ln[$_] for (0 .. $#ln);
|
108
|
+
push @{$values[$#ln+1]}, sum(@ln);
|
109
|
+
}
|
110
|
+
close TABLE;
|
111
|
+
$names[$#values] = "gamma";
|
112
|
+
|
113
|
+
if($o{R}){
|
114
|
+
print "".join($o{d}, qw/Sample Hprime 1_lambda qD/)."\n";
|
115
|
+
}else{
|
116
|
+
print "".join($o{d}, qw/Sample Q_alpha Q_alpha_eqv Hprime 1_lambda qD/)."\n";
|
117
|
+
}
|
118
|
+
for my $i (0 .. $#values){
|
119
|
+
print "".(exists $names[$i] ? $names[$i] : $i).$o{d};
|
120
|
+
my $N = sum @{$values[$i]};
|
121
|
+
my $Q = 0;
|
122
|
+
my $H = 0;
|
123
|
+
my $l = 0;
|
124
|
+
my $qD = 0 unless $o{q}==1;
|
125
|
+
for my $ik (0 .. $#{$values[$i]}){
|
126
|
+
unless($o{R}){
|
127
|
+
my $Qi = 0;
|
128
|
+
for my $jk (0 .. $#{$values[$i]}){
|
129
|
+
my $dij = (!$o{D}) ? 1 :
|
130
|
+
exists $D->{ $cats[$ik] }->{ $cats[$jk] } ?
|
131
|
+
$D->{ $cats[$ik] }->{ $cats[$jk] } :
|
132
|
+
exists $D->{ $cats[$jk] }->{ $cats[$ik] } ?
|
133
|
+
$D->{ $cats[$jk] }->{ $cats[$ik] } :
|
134
|
+
die "Cannot find distance between ".$cats[$ik].
|
135
|
+
" and ".$cats[$jk].".\n";
|
136
|
+
$Qi += $dij * ($values[$i]->[$ik]/$N) * ($values[$i]->[$jk]/$N);
|
137
|
+
}
|
138
|
+
$Q += $Qi;
|
139
|
+
}
|
140
|
+
my $pi = $N ? $values[$i]->[$ik]/$N : 0;
|
141
|
+
$H -= $pi * log($pi) if $pi;
|
142
|
+
$l += $pi**2;
|
143
|
+
$qD += $pi * ($pi**($o{q}-1)) unless $o{q}==1 or not $pi;
|
144
|
+
}
|
145
|
+
$qD = $o{q}==1 ? exp($H) : 1/($qD**(1/($o{q}-1)));
|
146
|
+
if($o{R}){
|
147
|
+
print "".join($o{d}, $H, $l ? 1/$l : "Inf", $qD)."\n";
|
148
|
+
}else{
|
149
|
+
print "".join($o{d}, $Q, ($Q==1 ? "NA" : 1/(1-$Q)), $H, 1/$l, $qD)."\n";
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env perl
|
2
|
+
#
|
3
|
+
# @authors Konstantinos Konstantinidis (initial version)
|
4
|
+
# modified to work with the BLASTp 2.2.25+ m0 output by
|
5
|
+
# Despina Tsementzi & Luis M. Rodriguez-R
|
6
|
+
# @updated Dec-21-2015
|
7
|
+
#
|
8
|
+
|
9
|
+
|
10
|
+
$/ = "Lambda ";
|
11
|
+
use strict;
|
12
|
+
my %hash_depth;
|
13
|
+
|
14
|
+
my @query;
|
15
|
+
my @subject;
|
16
|
+
my @similarity;
|
17
|
+
my $length = "0";
|
18
|
+
|
19
|
+
my($cigar_chr, $blast) = @ARGV;
|
20
|
+
|
21
|
+
($cigar_chr and $blast) or die "
|
22
|
+
.Description:
|
23
|
+
Counts the different AA substitutions in the best hit blast alignments, from
|
24
|
+
a BLASTP pairwise format output (-outfmt 0 in BLAST+, -m 0 in legacy BLAST).
|
25
|
+
|
26
|
+
.Usage: $0 cigar_char blast.m0.txt > aa-subs.list
|
27
|
+
|
28
|
+
cigar_char Use '+' for similar substitutions, use '_' for non similar
|
29
|
+
substitutions
|
30
|
+
blast.m0.txt Blast in 'text' format (-outfmt/-m 0).
|
31
|
+
aa-subs.list A tab-delimited raw file with one substitution per row and
|
32
|
+
columns:
|
33
|
+
(1) Name-of-query_Name-of-subject
|
34
|
+
(2) AA-in-subject
|
35
|
+
(3) AA-in-query
|
36
|
+
(4) Total-Align-Length
|
37
|
+
|
38
|
+
";
|
39
|
+
|
40
|
+
# For each blast result (i.e., for each query)
|
41
|
+
open BLAST, "<", $blast or die "Cannot read file: $blast: $!\n";
|
42
|
+
while(my $data=<BLAST>) {
|
43
|
+
$data =~ s/\r//g;
|
44
|
+
my ($data_q, @array_matches) = split(/>/,$data);
|
45
|
+
my ($name_query) = ($data_q =~ /Query\= (\S+?)(?:_GENE|\s)/);
|
46
|
+
my ($length_query) = ($data_q =~ /\(([\d,]+) letters/ );
|
47
|
+
($length_query) = ($data_q =~ /Length=([\d,]+)/) unless $length_query;
|
48
|
+
$length_query =~ tr/,//d;
|
49
|
+
|
50
|
+
# For each alignment (i.e., for each HSP),
|
51
|
+
# note the "last" at the end of the block,
|
52
|
+
# so only the best match is considered
|
53
|
+
foreach my $data_f (@array_matches) {
|
54
|
+
# Capture statistics
|
55
|
+
my ($length_match) = ($data_f =~ /Identities = \d+\/(\d+)/);
|
56
|
+
my ($identity_match) = ($data_f =~ /Identities = \d+\/\d+ \((\d+)%/);
|
57
|
+
my ($target_name) = ($data_f =~ /^\s?(\S+)/);
|
58
|
+
|
59
|
+
# If the alignment meets minimum requirements
|
60
|
+
if ($length_query >30 && ($length_match/$length_query > 0.7) && $identity_match > 60) {
|
61
|
+
$data_f =~ tr/ /_/;
|
62
|
+
my @array = split ("\n", $data_f);
|
63
|
+
my $blanks = 0;
|
64
|
+
my $prefix_size = 0;
|
65
|
+
|
66
|
+
# For each line in the alignment
|
67
|
+
for my $data_fff (@array) {
|
68
|
+
if ($data_fff =~ /(Query[:_]_+\d+_+)([^_]+)/){
|
69
|
+
# Query lines
|
70
|
+
$prefix_size = length($1);
|
71
|
+
$length = length($2);
|
72
|
+
@query = split (//, $2);
|
73
|
+
}elsif ($data_fff =~ /^_{11}/){
|
74
|
+
# Cigar lines
|
75
|
+
@similarity = split(//, substr($data_fff, $prefix_size, $length));
|
76
|
+
}elsif ($data_fff =~ /Sbjct[:_]_+\d+_+([^_]+)/){
|
77
|
+
# Subject lines
|
78
|
+
@subject = split(//, $1);
|
79
|
+
# For each alignment column
|
80
|
+
for(my $i=0; $i <= $length; $i++){
|
81
|
+
if ($similarity[$i] eq $cigar_chr) {
|
82
|
+
print "$name_query\_$target_name\t$subject[$i]\t$query[$i]\t$length_match\n";
|
83
|
+
}
|
84
|
+
}
|
85
|
+
undef @query;
|
86
|
+
undef @similarity;
|
87
|
+
undef @subject;
|
88
|
+
}
|
89
|
+
|
90
|
+
# Remove secondary alignments
|
91
|
+
if ($data_fff =~ /^$/){
|
92
|
+
$blanks++;
|
93
|
+
last if $blanks >= 3;
|
94
|
+
}else{
|
95
|
+
$blanks=0;
|
96
|
+
}
|
97
|
+
} # for my $data_fff (@array)
|
98
|
+
} # if ($length_query >30 ...
|
99
|
+
last; # <---- So it takes only the best match!
|
100
|
+
} # foreach my $data_f (@array_matches)
|
101
|
+
} # while(my $data=<>)
|
102
|
+
|