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,23 @@
|
|
1
|
+
#!/usr/bin/env perl
|
2
|
+
#
|
3
|
+
# @author: Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
4
|
+
# @update: Dec-25-2015
|
5
|
+
# @license: artistic license 2.0
|
6
|
+
#
|
7
|
+
use strict;
|
8
|
+
use warnings;
|
9
|
+
use Bio::SeqIO;
|
10
|
+
|
11
|
+
($ARGV[0] and $ARGV[0] =~ /--?h(elp)?/) and die "
|
12
|
+
Description:
|
13
|
+
Reverse-complement sequences in FastA format.
|
14
|
+
|
15
|
+
Usage:
|
16
|
+
$0 < input.fa > output.fa
|
17
|
+
|
18
|
+
";
|
19
|
+
|
20
|
+
my @len = ();
|
21
|
+
my $seqI = Bio::SeqIO->new(-fh => \*STDIN, -format=>"FastA");
|
22
|
+
my $seqO = Bio::SeqIO->new(-fh => \*STDOUT, -format=>"FastA");
|
23
|
+
while(my $seq = $seqI->next_seq){ $seqO->write_seq($seq->revcom) }
|
@@ -0,0 +1,85 @@
|
|
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 strict;
|
9
|
+
use List::Util qw/min/;
|
10
|
+
|
11
|
+
push @ARGV, undef unless $#ARGV%2;
|
12
|
+
my %params = @ARGV;
|
13
|
+
|
14
|
+
die "
|
15
|
+
Usage:
|
16
|
+
$0 [options] < in.fa > out.fa
|
17
|
+
|
18
|
+
in.fa Input file in FastA format.
|
19
|
+
out.fa Output file in FastA format.
|
20
|
+
|
21
|
+
Options:
|
22
|
+
-seq <str> Input file. If not set, it is expected to be in STDIN.
|
23
|
+
-out <str> Output file. If not set, it is sent to STDOUT.
|
24
|
+
-win <int> Window size. By default: 18.
|
25
|
+
-step <int> Step size. By default: 1.
|
26
|
+
-lerr <int> Expected error in chunks length. By default: 2.
|
27
|
+
-comm <1|0> Generate FastA comments (leaded by semi-colon) to separate
|
28
|
+
input sequences. By default: 0.
|
29
|
+
-short <1|0> Use chunks shorter than the window size 'as is'. By
|
30
|
+
default: 0 (discard those chunks).
|
31
|
+
-h Displays this help message and exits.
|
32
|
+
|
33
|
+
" if exists $params{'--help'} or
|
34
|
+
exists $params{'-h'} or exists $params{'-help'};
|
35
|
+
|
36
|
+
if($params{'-seq'}){
|
37
|
+
open SEQ, "<", $params{'-seq'} or
|
38
|
+
die "I can not open '".$params{'-seq'}."': $!\n";
|
39
|
+
}else{
|
40
|
+
*SEQ = *STDIN;
|
41
|
+
print STDERR "Please input your sequence, and hit ".
|
42
|
+
"Intro and Ctrl+D when you are done:\n";
|
43
|
+
}
|
44
|
+
|
45
|
+
if($params{'-out'}){
|
46
|
+
open OUT, ">", $params{'-out'} or
|
47
|
+
die "I can not open '".$params{'-out'}."': $!\n";
|
48
|
+
}else{
|
49
|
+
*OUT = *STDOUT;
|
50
|
+
}
|
51
|
+
|
52
|
+
$params{'-win'} ||= 18;
|
53
|
+
$params{'-step'} ||= 1;
|
54
|
+
$params{'-lerr'} ||= 2;
|
55
|
+
$params{'-comm'} ||= 0;
|
56
|
+
$params{'-short'} ||= 0;
|
57
|
+
|
58
|
+
my $win = $params{'-win'}+0;
|
59
|
+
my $stp = $params{'-step'}+0;
|
60
|
+
my $lerr = $params{'-lerr'}+0;
|
61
|
+
my $buffer = "";
|
62
|
+
my $i = 0;
|
63
|
+
while(<SEQ>){
|
64
|
+
next if /^;/;
|
65
|
+
chomp;
|
66
|
+
if(m/^>/){
|
67
|
+
print OUT ">", ++$i, "\n", $buffer, "\n" if
|
68
|
+
$params{'-short'}==1 and $buffer;
|
69
|
+
$buffer = "";
|
70
|
+
print OUT ";--- INPUT: $_ ---\n" unless $params{'-comm'}==0;
|
71
|
+
next;
|
72
|
+
}
|
73
|
+
s/[^A-Za-z]//g;
|
74
|
+
$buffer.= $_;
|
75
|
+
while(length($buffer) >= $win){
|
76
|
+
print OUT ">", ++$i, "\n",
|
77
|
+
substr($buffer, 0, $win+int(rand($lerr*2)-$lerr)), "\n";
|
78
|
+
$buffer = substr $buffer, $stp;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
close SEQ if $params{'-seq'};
|
82
|
+
close OUT if $params{'-out'};
|
83
|
+
print STDERR "$i chunks produced.\n";
|
84
|
+
|
85
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env perl
|
2
|
+
#
|
3
|
+
# @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
4
|
+
# @update Oct-13-2015
|
5
|
+
# @license artistic license 2.0
|
6
|
+
#
|
7
|
+
|
8
|
+
use warnings;
|
9
|
+
use strict;
|
10
|
+
use Symbol;
|
11
|
+
|
12
|
+
my ($file, $base, $outN) = @ARGV;
|
13
|
+
|
14
|
+
$outN ||= 12;
|
15
|
+
($file and $base) or die "
|
16
|
+
Usage
|
17
|
+
$0 in_file.fa out_base[ no_files]
|
18
|
+
|
19
|
+
in_file.fa Input file in FastA format.
|
20
|
+
out_base Prefix for the name of the output files. It will
|
21
|
+
be appended with .<i>.fa, where <i> is a consecutive
|
22
|
+
number starting in 1.
|
23
|
+
no_files Number of files to generate. By default: 12.
|
24
|
+
|
25
|
+
";
|
26
|
+
|
27
|
+
|
28
|
+
my @outSym = ();
|
29
|
+
for my $i (1 .. $outN){
|
30
|
+
$outSym[$i-1] = gensym;
|
31
|
+
open $outSym[$i-1], ">", "$base.$i.fa" or
|
32
|
+
die "I can not create the file: $base.$i.fa: $!\n";
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
my($i, $seq) = (-1, '');
|
37
|
+
open FILE, "<", $file or die "I can not read the file: $file: $!\n";
|
38
|
+
while(my $ln=<FILE>){
|
39
|
+
next if $ln=~/^;/;
|
40
|
+
if($ln =~ m/^>/){
|
41
|
+
print { $outSym[$i % $outN] } $seq if $seq;
|
42
|
+
$i++;
|
43
|
+
$seq = '';
|
44
|
+
}
|
45
|
+
$seq.=$ln;
|
46
|
+
}
|
47
|
+
print { $outSym[$i % $outN] } $seq if $seq;
|
48
|
+
close FILE;
|
49
|
+
|
50
|
+
for(my $j=0; $j<$outN; $j++){
|
51
|
+
close $outSym[$j];
|
52
|
+
}
|
53
|
+
|
54
|
+
print STDERR "Sequences: ".($i+1)."\nFiles: $outN\n";
|
55
|
+
|
@@ -0,0 +1,131 @@
|
|
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 strict;
|
9
|
+
use warnings;
|
10
|
+
use List::Util qw| max min sum |;
|
11
|
+
use Getopt::Std;
|
12
|
+
use Symbol;
|
13
|
+
|
14
|
+
my %o;
|
15
|
+
getopts('f:r:o:Fzhq', \%o);
|
16
|
+
|
17
|
+
my $HELP = <<HELP
|
18
|
+
|
19
|
+
Description:
|
20
|
+
Subsamples a set of sequences.
|
21
|
+
|
22
|
+
Usage:
|
23
|
+
# IMPORTANT: options *MUST* precede the input file(s).
|
24
|
+
$0 [options] input.fa...
|
25
|
+
|
26
|
+
Where,
|
27
|
+
input.fa... : File (or files) containing the sequences.
|
28
|
+
|
29
|
+
Options:
|
30
|
+
-f <float> : Fraction of the library to be sampled (as percentage). It can
|
31
|
+
include several values (separated by comma), as well as ranges
|
32
|
+
of values in the form 'from-to/by'. For example, the -f value
|
33
|
+
1-5/1,10-50/10,75,99 will produce 12 subsamples with expected
|
34
|
+
fractions 1%, 2%, 3%, 4%, 5%, 10%, 20%, 30%, 40%, 50%, 75%,
|
35
|
+
and 99%. By default: 10.
|
36
|
+
-r <int> : Number of replicates per fraction. By default: 1.
|
37
|
+
-o <str> : Prefix of the output files to be created. The output files
|
38
|
+
will have a suffix of the form '.fraction-replicate.fa', where
|
39
|
+
'fraction' is the percentage sampled and 'replicate' is an
|
40
|
+
increasing integer for replicates of the same fraction. By
|
41
|
+
default: Path to the input file.
|
42
|
+
-F : Force overwriting output file(s).
|
43
|
+
-z : Include leading zeroes in the numeric parts of the output
|
44
|
+
files (e.g., file.002.50-01.fa instead of file.2.50-1.fa), so
|
45
|
+
that alphabetic sorting of files reflects the sampled
|
46
|
+
fraction.
|
47
|
+
-q : Run quietly.
|
48
|
+
-h : Displays this message and exits.
|
49
|
+
|
50
|
+
HELP
|
51
|
+
;
|
52
|
+
|
53
|
+
sub thousands($){ my $i=shift; $i=~s/(\d{1,3}?)(?=(\d{3})+$)/$1,/g; $i }
|
54
|
+
my @in = @ARGV;
|
55
|
+
$o{f} ||= '10';
|
56
|
+
$o{r} ||= 1;
|
57
|
+
$o{o} ||= $in[0];
|
58
|
+
$#in>=0 or die $HELP;
|
59
|
+
|
60
|
+
my $samples = {};
|
61
|
+
my $sample_no=0;
|
62
|
+
my $format = ($o{z} ? "%s\.%08s\-%02i.fa" : "%s.%s-%s.fa");
|
63
|
+
for my $value (split /,/, $o{f}){
|
64
|
+
my $from = $value;
|
65
|
+
my $to = $value;
|
66
|
+
my $by = 1;
|
67
|
+
if($value =~ m/^([^-]+)-([^\/]+)\/(.+)$/){
|
68
|
+
$from = $1;
|
69
|
+
$to = $2;
|
70
|
+
$by = $3;
|
71
|
+
($from,$to) = ($to,$from) if $from > $to;
|
72
|
+
}
|
73
|
+
for(my $p=$from; $p<=$to; $p+=$by){
|
74
|
+
die "Percentage out of the [0,100] range: $p\n" if $p>100 or $p<0;
|
75
|
+
$samples->{$p} ||= [];
|
76
|
+
for (1 .. $o{r}){
|
77
|
+
my $r = $#{$samples->{$p}}+2;
|
78
|
+
my $file = sprintf $format, $o{o}, sprintf("%.4f", $p), $r;
|
79
|
+
die "File exists: $file.\n" if !$o{F} and -e $file;
|
80
|
+
$samples->{$p}->[$r-1] = [$p, 0, gensym(), $file];
|
81
|
+
open $samples->{$p}->[$r-1]->[2], ">", $file;
|
82
|
+
$sample_no++;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
print STDERR "Open samples: $sample_no.\n" unless $o{q};
|
87
|
+
|
88
|
+
my $sprob = ($o{s} || '10');
|
89
|
+
|
90
|
+
die $HELP unless $sprob and $#in>=0;
|
91
|
+
$o{'h'} and die $HELP;
|
92
|
+
|
93
|
+
my $N = 0;
|
94
|
+
my @ck = qw(*... **.. ***. .*** ..** ...*);
|
95
|
+
SAMPLING: {
|
96
|
+
local $/ = "\n>";
|
97
|
+
print STDERR "Sampling sequences.\n" unless $o{q};
|
98
|
+
FILE: for my $in (@in){
|
99
|
+
open IN, '<', $in or die "I can not open $in: $!\n";
|
100
|
+
SEQ: while(my $seq = <IN>){
|
101
|
+
$N++;
|
102
|
+
$seq =~ s/^>?/>/;
|
103
|
+
$seq =~ s/>$//;
|
104
|
+
$seq =~ s/^;.*//gm;
|
105
|
+
PERC: for my $sperc (values %$samples){
|
106
|
+
SAMPLE: for my $sample (@$sperc){
|
107
|
+
if($sample->[0] > rand 100){
|
108
|
+
$sample->[1]++;
|
109
|
+
print { qualify_to_ref $sample->[2] } $seq;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
print STDERR " [".$ck[($N/5000)%@ck]."] ".&thousands($N).
|
114
|
+
" seqs. \r" unless $o{q} or $N%5000;
|
115
|
+
}
|
116
|
+
close IN;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
print STDERR " Total sequences: ".&thousands($N).". \n" unless $o{q};
|
121
|
+
for my $p (values %$samples){
|
122
|
+
for my $s (@$p){
|
123
|
+
printf STDERR "
|
124
|
+
Sample file: %s
|
125
|
+
Sampled sequences: %d
|
126
|
+
Sampled fraction: %.2f%%\n",
|
127
|
+
$s->[3], $s->[1], $s->[1]*100/$N unless $o{q};
|
128
|
+
close $s->[2];
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# @author Luis M. Rodriguez-R
|
5
|
+
# @update Oct-07-2015
|
6
|
+
# @license artistic license 2.0
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'optparse'
|
10
|
+
|
11
|
+
o = {:q=>FALSE, :p=>"", :s=>"", :d=>FALSE}
|
12
|
+
ARGV << '-h' if ARGV.size==0
|
13
|
+
OptionParser.new do |opts|
|
14
|
+
opts.banner = "
|
15
|
+
Generates easy-to-parse tagged reads from FastA files.
|
16
|
+
|
17
|
+
Usage: #{$0} [options]"
|
18
|
+
opts.separator ""
|
19
|
+
opts.separator "Mandatory"
|
20
|
+
opts.on("-i", "--in FILE",
|
21
|
+
"Path to the FastA file containing the sequences."){ |v| o[:in] = v }
|
22
|
+
opts.on("-o", "--out FILE",
|
23
|
+
"Path to the FastA to create."){ |v| o[:out] = v }
|
24
|
+
opts.separator ""
|
25
|
+
opts.separator "ID options"
|
26
|
+
opts.on("-p", "--prefix STR", "Prefix to use in all IDs."){ |v| o[:p] = v }
|
27
|
+
opts.on("-s", "--suffix STR", "Suffix to use in all IDs."){ |v| o[:s] = v }
|
28
|
+
opts.on("-d", "--defline",
|
29
|
+
"Keep the original defline after a space."){ o[:d]=TRUE }
|
30
|
+
opts.separator ""
|
31
|
+
opts.separator "Other Options"
|
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
|
+
|
42
|
+
begin
|
43
|
+
ifh = File.open(o[:in], 'r');
|
44
|
+
ofh = File.open(o[:out], 'w');
|
45
|
+
i=0
|
46
|
+
while ln=ifh.gets
|
47
|
+
ln.chomp!
|
48
|
+
next if ln =~ /^;/
|
49
|
+
unless /^>/.match(ln).nil?
|
50
|
+
i+=1
|
51
|
+
ofh.puts ">#{o[:p]}#{i}#{o[:s]}#{ o[:d]?" #{ln[1, ln.size-1]}":"" }"
|
52
|
+
else
|
53
|
+
ofh.puts ln
|
54
|
+
end
|
55
|
+
end
|
56
|
+
ifh.close
|
57
|
+
ofh.close
|
58
|
+
rescue => err
|
59
|
+
$stderr.puts "Exception: #{err}\n\n"
|
60
|
+
err.backtrace.each { |l| $stderr.puts l + "\n" }
|
61
|
+
err
|
62
|
+
end
|
63
|
+
|
64
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
o = {wrap:70}
|
5
|
+
ARGV << "-h" if ARGV.empty?
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "
|
8
|
+
Wraps sequences in a FastA to a given line length.
|
9
|
+
|
10
|
+
Usage: #{$0} [options]"
|
11
|
+
opts.separator ""
|
12
|
+
opts.separator "Options"
|
13
|
+
opts.on("-i", "--in FILE", "Input FastA file."){ |v| o[:in] = v }
|
14
|
+
opts.on("-o", "--out FILE", "Output FastA file."){ |v| o[:out] = v }
|
15
|
+
opts.on("-w", "--wrap INT",
|
16
|
+
"Line length to wrap sequences. Use 0 to generate 1-line sequences.",
|
17
|
+
"By default: #{o[:wrap]}."){ |v| o[:wrap] = v.to_i }
|
18
|
+
opts.on("-h", "--help", "Display this screen.") do
|
19
|
+
puts opts
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
opts.separator ""
|
23
|
+
end.parse!
|
24
|
+
abort "-i is mandatory" if o[:in].nil?
|
25
|
+
abort "-o is mandatory" if o[:out].nil?
|
26
|
+
|
27
|
+
def wrap_width(txt, len)
|
28
|
+
return "" if txt.empty?
|
29
|
+
return "#{txt}\n" if len==0
|
30
|
+
txt.gsub(/(.{1,#{len}})/,"\\1\n")
|
31
|
+
end
|
32
|
+
|
33
|
+
ofh = File.open(o[:out], "w")
|
34
|
+
File.open(o[:in], "r") do |ifh|
|
35
|
+
bf = ""
|
36
|
+
ifh.each_line do |ln|
|
37
|
+
if ln =~ /^>/
|
38
|
+
ofh.print wrap_width(bf, o[:wrap])
|
39
|
+
ofh.puts ln
|
40
|
+
bf = ""
|
41
|
+
else
|
42
|
+
ln.chomp!
|
43
|
+
bf << ln
|
44
|
+
end
|
45
|
+
end
|
46
|
+
ofh.print wrap_width(bf, o[:wrap])
|
47
|
+
end
|
48
|
+
ofh.close
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env perl
|
2
|
+
#
|
3
|
+
# @author: Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
|
4
|
+
# @update: Mar-23-2015
|
5
|
+
# @license: artistic license 2.0
|
6
|
+
#
|
7
|
+
|
8
|
+
use warnings;
|
9
|
+
use strict;
|
10
|
+
use Getopt::Std;
|
11
|
+
|
12
|
+
sub HELP_MESSAGE { die "
|
13
|
+
.Description:
|
14
|
+
Extracts a subset of sequences from a FastQ file.
|
15
|
+
|
16
|
+
.Usage: $0 [options] list.txt seqs.fq > subset.fq
|
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.fq FastQ file containing the superset of sequences.
|
26
|
+
subset.fq FastQ file to be created.
|
27
|
+
|
28
|
+
" }
|
29
|
+
|
30
|
+
my %o=();
|
31
|
+
getopts('rhq', \%o);
|
32
|
+
my($list, $fq) = @ARGV;
|
33
|
+
($list and $fq) 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 FastQ.\n" unless $o{q};
|
42
|
+
open FQ, "<", $fq or die "Cannot read file: $fq: $!\n";
|
43
|
+
my $good = 0;
|
44
|
+
while(my $ln = <FQ>){
|
45
|
+
my @ln = ();
|
46
|
+
$ln[$_] = <FQ> for 0 .. 2;
|
47
|
+
chomp $ln;
|
48
|
+
if($ln =~ m/^@((\S+).*)/){ $good = (exists $li{$1} or exists $li{">$1"} or exists $li{"\@$1"} or exists $li{$2} or exists $li{$ln}) }
|
49
|
+
elsif($ln =~ m/^>/){ $good=0; print STDERR "Warning: Non-cannonical defline, line $.: $ln\n" }
|
50
|
+
else{ $good=$o{r}; print STDERR "Warning: Non-cannonical defline, line $.: $ln\n" }
|
51
|
+
print "".join("", "$ln\n", @ln) if (($good and not $o{r}) or ($o{r} and not $good));
|
52
|
+
}
|
53
|
+
close FQ;
|
54
|
+
|