Mercurial > repos > matthias > dada2_plotqualityprofile
changeset 5:863ebf0d28d5 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:26:15 -0400 |
| parents | 4be2c17fd0b2 |
| children | 4ce5b0fa84f5 |
| files | README.md dada2_plotQualityProfile.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, 2719 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Sun May 05 12:26:15 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_plotQualityProfile.xml Mon Apr 29 09:49:29 2019 -0400 +++ b/dada2_plotQualityProfile.xml Sun May 05 12:26:15 2019 -0400 @@ -6,25 +6,50 @@ <expand macro="requirements"/> <expand macro="version_command"/> <command detect_errors="exit_code"><![CDATA[ - Rscript --slave '$dada2_script' +##name files by linking +#import re +#if "batch" in str($paired_cond.paired_select) + #set elid = re.sub('[^\w\-\.]', '_', str($paired_cond.fl.element_identifier)) + #if "single" in str($paired_cond.paired_select) + ln -s '$paired_cond.fl' '$elid' && + #else + ln -s '$paired_cond.fl.forward' '$elid'_forward && + ln -s '$paired_cond.fl.reverse' '$elid'_reverse && + #end if +#else + #for $read in $paired_cond.fl: + #set elid = re.sub('[^\w\-\.]', '_', str($read.element_identifier)) + #if "single" in str($paired_cond.paired_select) + ln -s '$read' '$elid' && + #else + ln -s '$read.forward' '$elid'_forward && + ln -s '$read.reverse' '$elid'_reverse && + #end if + #end for +#end if + + Rscript --slave '$dada2_script' ]]></command> <configfiles> <configfile name="dada2_script"><![CDATA[ +#import re files = c() #if "batch" in str($paired_cond.paired_select) + #set elid = re.sub('[^\w\-\.]', '_', str($paired_cond.fl.element_identifier)) #if "single" in str($paired_cond.paired_select) - files = c(files, '$paired_cond.reads') + files = c(files, '$elid') #else - files = c(files, '$paired_cond.reads.forward') - files = c(files, '$paired_cond.reads.reverse') + files = c(files, paste('$elid', 'forward', sep = "_")) + files = c(files, paste('$elid', 'reverse', sep = "_")) #end if #else - #for $read in $paired_cond.reads: + #for $read in $paired_cond.fl: + #set elid = re.sub('[^\w\-\.]', '_', str($read.element_identifier)) #if "single" in str($paired_cond.paired_select) - files = c(files, '$read') + files = c(files, '$elid') #else - files = c(files, '$read.forward') - files = c(files, '$read.reverse') + files = c(files, paste('$elid', 'forward', sep = "_")) + files = c(files, paste('$elid', 'reverse', sep = "_")) #end if #end for #end if @@ -50,16 +75,16 @@ <option value="single_batch">single - batch</option> </param> <when value="paired"> - <param name="reads" type="data_collection" collection_type="list:paired" format="fastqsanger,fastqsanger.gz" label="Short read data"/> + <param argument="fl" type="data_collection" collection_type="list:paired" format="fastqsanger,fastqsanger.gz" label="Short read data"/> </when> <when value="single"> - <param name="reads" type="data" multiple="true" format="fastqsanger,fastqsanger.gz" label="Short read data"/> + <param argument="fl" type="data" multiple="true" format="fastqsanger,fastqsanger.gz" label="Short read data"/> </when> <when value="paired_batch"> - <param name="reads" type="data_collection" collection_type="paired" format="fastqsanger,fastqsanger.gz" label="Short read data"/> + <param argument="fl" type="data_collection" collection_type="paired" format="fastqsanger,fastqsanger.gz" label="Short read data"/> </when> <when value="single_batch"> - <param name="reads" type="data" format="fastqsanger,fastqsanger.gz" label="Short read data"/> + <param argument="fl" type="data" format="fastqsanger,fastqsanger.gz" label="Short read data"/> </when> </conditional> <param argument="aggregate" type="boolean" label="Aggregate data" checked="True" truevalue="TRUE" falsevalue="FALSE" help="Create a single plot for all data sets (default) or a separate plot for each data set"/> @@ -73,7 +98,7 @@ <test> <param name="aggregate" value="TRUE"/> <param name="paired_cond|paired_select" value="paired"/> - <param name="paired_cond|reads"> + <param name="paired_cond|fl"> <collection type="list:paired"> <element name="F3D0_S188_L001"> <collection type="paired"> @@ -89,7 +114,7 @@ <test> <param name="aggregate" value="FALSE"/> <param name="paired_cond|paired_select" value="paired_batch"/> - <param name="paired_cond|reads"> + <param name="paired_cond|fl"> <collection type="paired"> <element name="forward" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> <element name="reverse" value="F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/> @@ -101,7 +126,7 @@ <test> <param name="aggregate" value="TRUE"/> <param name="paired_cond|paired_select" value="single"/> - <param name="paired_cond|reads" value="F3D0_S188_L001_R1_001.fastq.gz,F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/> + <param name="paired_cond|fl" value="F3D0_S188_L001_R1_001.fastq.gz,F3D0_S188_L001_R2_001.fastq.gz" ftype="fastqsanger.gz"/> <param name="n" value="10000"/> <output name="output" value="qualityProfileSmallSample.pdf" ftype="pdf"/> </test> @@ -109,7 +134,7 @@ <test> <param name="aggregate" value="FALSE"/> <param name="paired_cond|paired_select" value="single_batch"/> - <param name="paired_cond|reads" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> + <param name="paired_cond|fl" value="F3D0_S188_L001_R1_001.fastq.gz" ftype="fastqsanger.gz"/> <param name="n" value="10000"/> <output name="output" value="qualityProfileSmallSample.pdf" ftype="pdf" compare="sim_size"/> </test> </tests>
--- a/macros.xml Mon Apr 29 09:49:29 2019 -0400 +++ b/macros.xml Sun May 05 12:26:15 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@"><