Mercurial > repos > matthias > dada2_mergepairs
changeset 5:e76f2213f0cc draft
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit 990192685955e9cda0282e348c28ef6462d88a38
| author | matthias |
|---|---|
| date | Sun, 05 May 2019 12:32:30 -0400 |
| parents | e727d31bcb60 |
| children | 31fce2b8aa46 |
| files | README.md dada2_mergePairs.xml macros.xml test-data/.reference.fa.swp test-data/.reference_species.fa.swp test-data/assignTaxonomyAddspecies_F3D0_boot.tab test-data/filterAndTrim_F3D0.tab test-data/makeSequenceTable_F3D0.pdf test-data/makeSequenceTable_F3D0.tab test-data/mergePairs_F3D0_nondefault.Rdata test-data/qualityProfile.pdf test-data/removeBimeraDenovo_F3D0.tab test-data/removeBimeraDenovo_F3D0_dada_uniques.tab test-data/removeBimeraDenovo_F3D0_derep_uniques.tab test-data/removeBimeraDenovo_F3D0_mergepairs.Rdata test-data/seqCounts_F3D0_dadaF.tab test-data/seqCounts_F3D0_derepF.tab test-data/seqCounts_F3D0_filter.tab test-data/seqCounts_F3D0_merge.tab test-data/seqCounts_F3D0_nochim.tab test-data/seqCounts_F3D0_seqtab.tab todo.txt |
| diffstat | 22 files changed, 2707 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Sun May 05 12:32:30 2019 -0400 @@ -0,0 +1,39 @@ +Wrappers for the core functionality of the dada2 package https://benjjneb.github.io/dada2/index.html. + +- filterAndTrim +- derep +- learnErrors +- dada +- mergePairs +- makeSequenceTable +- removeBimeraDenovo + +Datatypes +========= + +The dada2 Galaxy wrappers use a few extra data types to ensure that only inputs of the correct type can be used. + +For the outputs of derep, dada, learnErrors, and mergePairs the following datatypes are used that derive from Rdata (which contains the named list that is returned from the corresponding dada function): + +- dada2_derep (Rdata: named list see docs for derep-class) +- dada2_dada (Rdata: named list, see docs for dada-class) +- dada2_errorrates (Rdata: named list, see docs for learnErrors) +- dada2_mergepairs (Rdata: named list, see docs for mergePairs) + +For the outputs of makeSequenceTable and removeBimeraDenovo the following data types are used which derive from tabular: + +- dada2_uniques +-- in R a named integer vector (names are the unique sequences) +-- in Galaxy written as a table (each row corresponding to a unique sequence, column 1: the sequence, column 2: the count) +- dada2_sequencetable +-- in R a named integer matrix (rows = samples, columns = unique sequences) +-- in Galaxy written as a table (rows = unique sequences, columns = samples) + +Note the difference between the R and Galaxy representations! The main motivation is that the dada2_sequencetable is analogous to OTU tables as produced for instance by qiime (and it seemed natural to extend this to the uniques which are essentially a sequencetables of single samples). + + +TODOs +===== + +- implememt getUniques tool to view intermediate results? +- implement tests for cached reference data
--- a/dada2_mergePairs.xml Mon Apr 29 09:51:19 2019 -0400 +++ b/dada2_mergePairs.xml Sun May 05 12:32:30 2019 -0400 @@ -12,13 +12,13 @@ <configfile name="dada2_script"><![CDATA[ library(dada2, quietly=T) -dadaF <- readRDS('$dadaf') -dadaR <- readRDS('$dadar') -derepF <- readRDS('$derepf') -derepR <- readRDS('$derepr') +dadaF <- readRDS('$dadaF') +dadaR <- readRDS('$dadaR') +derepF <- readRDS('$derepF') +derepR <- readRDS('$derepR') merged <- mergePairs(dadaF, derepF, dadaR, derepR, minOverlap = $minOverlap, maxMismatch = $maxMismatch, - returnRejects = FALSE, propagateCol = character(0), +## currently not accessible by the wrapper returnRejects = FALSE, propagateCol = character(0), justConcatenate = $justConcatenate, trimOverhang = $trimOverhang) saveRDS(merged, file='$merged') @@ -27,32 +27,44 @@ ]]></configfile> </configfiles> <inputs> - <param name="dadaf" type="data" format="dada2_dada" label="Dada results for forward reads"/> - <param name="derepf" type="data" format="dada2_derep" label="Dereplicated forward reads"/> - <param name="dadar" type="data" format="dada2_dada" label="Dada results for reverse reads"/> - <param name="derepr" type="data" format="dada2_derep" label="Dereplicated reverse reads"/> + <param argument="dadaF" type="data" format="dada2_dada" label="Dada results for forward reads"/> + <param argument="derepF" type="data" format="dada2_derep" label="Dereplicated forward reads"/> + <param argument="dadaR" type="data" format="dada2_dada" label="Dada results for reverse reads"/> + <param argument="derepR" type="data" format="dada2_derep" label="Dereplicated reverse reads"/> <param argument="minOverlap" type="integer" value="12" min="0" label="Minimum length of the overlap"/> <param argument="maxMismatch" type="integer" value="0" min="0" label="Maximum number of mismatches"/> - <param argument="justConcatenate" type="boolean" checked="false" truevalue="FALSE" falsevalue="FALSE" label="Concatenated rather than merge" help="The forward and reverse-complemented reverse read are concatenated rather than merged, with a 10 Ns spacer inserted between them"/> - <param argument="trimOverhang" type="boolean" checked="false" truevalue="FALSE" falsevalue="FALSE" label="Trim overhangs" help="Overhangs are when the reverse read extends past the start of the forward read, and vice-versa, as can happen when reads are longer than the amplicon and read into the other-direction primer region"/> + <param argument="justConcatenate" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Concatenated rather than merge" help="The forward and reverse-complemented reverse read are concatenated rather than merged, with a 10 Ns spacer inserted between them"/> + <param argument="trimOverhang" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Trim overhangs" help="Overhangs are when the reverse read extends past the start of the forward read, and vice-versa, as can happen when reads are longer than the amplicon and read into the other-direction primer region"/> </inputs> <outputs> <data name="merged" format="dada2_mergepairs" label="${tool.name} on ${on_string}"/> </outputs> <tests> <test> - <param name="dadaf" ftype="dada2_dada" value="dada_F3D0_R1.Rdata"/> - <param name="derepf" ftype="dada2_derep" value="derepFastq_F3D0_R1.Rdata"/> - <param name="dadar" ftype="dada2_dada" value="dada_F3D0_R2.Rdata"/> - <param name="derepr" ftype="dada2_derep" value="derepFastq_F3D0_R2.Rdata"/> + <param name="dadaF" ftype="dada2_dada" value="dada_F3D0_R1.Rdata"/> + <param name="derepF" ftype="dada2_derep" value="derepFastq_F3D0_R1.Rdata"/> + <param name="dadaR" ftype="dada2_dada" value="dada_F3D0_R2.Rdata"/> + <param name="derepR" ftype="dada2_derep" value="derepFastq_F3D0_R2.Rdata"/> <output name="merged" value="mergePairs_F3D0.Rdata" ftype="dada2_mergepairs" /> </test> + <!-- test non-default options --> + <test> + <param name="dadaF" ftype="dada2_dada" value="dada_F3D0_R1.Rdata"/> + <param name="derepF" ftype="dada2_derep" value="derepFastq_F3D0_R1.Rdata"/> + <param name="dadaR" ftype="dada2_dada" value="dada_F3D0_R2.Rdata"/> + <param name="derepR" ftype="dada2_derep" value="derepFastq_F3D0_R2.Rdata"/> + <output name="merged" value="mergePairs_F3D0_nondefault.Rdata" ftype="dada2_mergepairs" /> + <param name="minOverlap" value="8" /> + <param name="maxMismatch" value="1"/> + <param name="justConcatenate" value="TRUE" /> + <param name="trimOverhang" value="TRUE" /> + </test> </tests> <help><![CDATA[ Description ........... -This function attempts to merge each denoised pair of forward and reverse reads, rejecting any pairs which do not sufficiently overlap (at least 12bp by sefault) or which contain too many (>0 by default) mismatches in the overlap region. +This function attempts to merge each denoised pair of forward and reverse reads, rejecting any pairs which do not sufficiently overlap (at least 12bp by default) or which contain too many (>0 by default) mismatches in the overlap region. Usage ..... @@ -60,7 +72,7 @@ **Input** - dereplicated reads and learned error rates of the forward reads -- dereplicated reads and learned error rates of the reversereads +- dereplicated reads and learned error rates of the reverse reads **Output**
--- a/macros.xml Mon Apr 29 09:51:19 2019 -0400 +++ b/macros.xml Sun May 05 12:32:30 2019 -0400 @@ -25,23 +25,44 @@ <token name="@DADA_UNIQUES@">dada2_derep,dada2_dada,dada2_mergepairs</token> + <!-- function to read dada2 data types + - derep, dada, and mergepairs are simply read as RDS + - sequence_table is a named integer matrix (rows=samples, columns=ASVs) + - uniques is a named integer vector (columns=ASVs, only one rows)--> <token name="@READ_FOO@"><![CDATA[ + read.uniques <- function ( fname ) { + p <- read.table(fname, header=F, sep="\t") + n <-x[,2] + names(n)<-x[,1] + } #def read_data($dataset) - #if $dataset.is_of_type('dada2_derep') - readRDS('$dataset) - #else if $dataset.is_of_type('dada2_dada') + #if $dataset.is_of_type('dada2_sequencetable') + t(as.matrix( read.table('$dataset', header=T, sep="\t", row.names=1) )) + #else if $dataset.is_of_type('dada2_uniques') + read.uniques('$dataset') + #else if $dataset.is_of_type('tabular') + read.table('$dataset', header=T, sep="\t", row.names=1) + #else readRDS('$dataset') - #else if $dataset.is_of_type('dada2_sequencetable') - as.matrix( read.table('$dataset', header=T, sep="\t", row.names=1) ) - #else if $dataset.is_of_type('dada2_mergepairs') - readRDS('$dataset') - #else if $dataset.is_of_type('tabular') - read.table('$dataset', header=T, sep="\t", row.names=1 ) - #else - #raise Exception("error: unknown input type") #end if #end def ]]></token> + <!-- function to write dada2 data types (the content or the R variable 'out' is written) + - derep, dada, and mergepairs are written as RDS + - sequence_table is a named integer matrix (rows=samples, columns=ASVs) + - uniques is a named integer vector (columns=ASVs, only one rows)--> + <token name="@WRITE_FOO@"><![CDATA[ +write.data <- function( data, fname, type ){ + if( type == 'dada2_uniques'){ + write.table(data, file = fname, quote = F, sep = "\t", row.names = T, col.names = F) + }else if( type== 'dada2_sequencetable'){ + write.table(t(data), file=fname, quote=F, sep="\t", row.names = T, col.names = NA) + }else{ + saveRDS(data, file=fname) + } +} + ]]></token> + <!-- for filterAndTrim --> <xml name="trimmers"> <section name="trim" title="Trimming parameters"> @@ -63,9 +84,9 @@ <xml name="errorEstimationFunction"> <param name="errfoo" argument="errorEstimationFunction" type="select" label="Error function"> - <option value="loessErrfun">loess</option> - <option value="noqualErrfun">noqual</option> - <option value="PacBioErrfun">PacBio</option> + <option value="loessErrfun">loess: Use a loess fit to estimate error rates from transition counts</option> + <option value="noqualErrfun">noqual: Estimate error rates for each type of transition while ignoring quality scores.</option> + <option value="PacBioErrfun">PacBio: Estimate error rates from transition counts in PacBio CCS data.</option> </param> </xml> <token name="@HELP_OVERVIEW@"><