Mercurial > repos > matthias > dada2_learnerrors
view dada2_learnErrors.xml @ 2:57eb7437f646 draft
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit 5b1603bbcd3f139cad5c876be83fcb39697b5613-dirty
author | matthias |
---|---|
date | Tue, 09 Apr 2019 07:00:24 -0400 |
parents | 56d5be6c03b9 |
children | 10141f4eaae9 |
line wrap: on
line source
<tool id="dada2_learnErrors" name="dada2: learnErrors" version="@DADA2_VERSION@+galaxy@WRAPPER_VERSION@"> <description>Learn Error rates</description> <macros> <import>macros.xml</import> </macros> <expand macro="requirements"/> <expand macro="version_command"/> <command detect_errors="exit_code"><![CDATA[ ## TODO check to remove ln, instead maybe rename output to ids #for $read in $reads: ln -s '$read' '$read.element_identifier' && #end for mkdir '$errors.extra_files_path' && Rscript '$dada2_script' \${GALAXY_SLOTS:-1} ]]></command> <configfiles> <configfile name="dada2_script"><![CDATA[ library(ggplot2, quietly=T) library(dada2, quietly=T) args <- commandArgs(trailingOnly = TRUE) nthreads <- as.integer(args[1]) files <- c() #for $read in $reads: files <- c(files, '$read.element_identifier') #end for err <- learnErrors(files, nbases = 10**$nbases, errorEstimationFunction = $advanced.errfoo, multithread = nthreads, randomize = $advanced.randomize, MAX_CONSIST = $advanced.maxconsist, OMEGA_C = $advanced.omegac) write.table(err\$err_out, file = '$errors', quote = F, sep = "\t", row.names = T, col.names = F) saveRDS(err, file=file.path('$errors.extra_files_path', "Rdata")) ## generate error plots plot <- plotErrors(err, obs = $plotopt.obs, err_out = $plotopt.errout, err_in = $plotopt.errin, nominalQ = $plotopt.nominalQ) ggsave('output.pdf', plot, width = 20,height = 15,units = c("cm")) ]]></configfile> </configfiles> <inputs> <param name="reads" type="data" multiple="true" format="fastqsanger,fastqsanger.gz" label="Short read data" help="forward or reverse reads should be processed separately"/> <param name="nbases" type="integer" value="8" min="0" label="Magnitide of number of bases to use for learning"/> <section name="advanced" title="Advanced Option"> <expand macro="errorEstimationFunction"/> <param name="randomize" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Randomize samples"/> <param name="maxconsist" type="integer" value="10" min="0" label="Maximum number of times to step through the selfconsistency loop" help=""/> <param name="omegac" type="integer" value="0" min="0" label="Threshold at which unique sequences inferred to contain errors are corrected" help=""/> </section> <section name="plotopt" title="Plotting Option"> <param name="obs" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Plot observed error rates"/> <param name="errout" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Plot output error rates"/> <param name="errin" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Plot input error rates"/> <param name="nominalQ" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Plot expected error rates"/> </section> </inputs> <outputs> <data name="errors" format="dada2_errorrates" label="${tool.name} on ${on_string}"/> <data name="output" format="pdf" from_work_dir="output.pdf" label="${tool.name} on ${on_string}: error rates plot"/> </outputs> <tests> <test> <param name="reads" value="filterAndTrim_paired_F3D0_R1.fq.gz,filterAndTrim_paired_F3D141_R1.fq.gz" ftype="fastqsanger.gz"/> <output name="errors" value="learnErrors_forward.tab" ftype="dada_errorrates"> <extra_files type="rdata" name="Rdata" value="learnErrors_forward.Rdata" /> </output> <output name="output" value="learnErrors_forward.pdf" ftype="pdf" /> </test> <!-- test for creating input for dada results for reverse, not needed for testing --> <test> <param name="reads" value="filterAndTrim_paired_F3D0_R2.fq.gz,filterAndTrim_paired_F3D141_R2.fq.gz" ftype="fastqsanger.gz"/> <output name="errors" value="learnErrors_reverse.tab" ftype="dada_errorrates"> <extra_files type="rdata" name="Rdata" value="learnErrors_reverse.Rdata" /> </output> <output name="output" value="learnErrors_reverse.pdf" ftype="pdf" /> </test> <test> <param name="reads" value="filterAndTrim_paired_F3D0_R1.fq.gz,filterAndTrim_paired_F3D141_R1.fq.gz" ftype="fastqsanger.gz"/> <param name="plotopt|obs" value="FALSE" /> <param name="plotopt|errout" value="FALSE" /> <param name="plotopt|errin" value="TRUE" /> <param name="plotopt|nominalQ" value="FALSE"/> <output name="errors" value="learnErrors_reverse.tab" ftype="dada_errorrates" /> <output name="output" value="learnErrors_reverse.pdf" ftype="pdf" /> </test> </tests> <help><![CDATA[ Description ........... Error rates are learned by alternating between sample inference and error rate estimation until convergence. Additionally a plot is generated that shows the observed frequency of each transition (eg. A->C) as a function of the associated quality score, the final estimated error rates (if they exist), the initial input rates, and the expected error rates under the nominal definition of quality scores. Usage ----- **Input** are the FASTQ dataset containing the filtered and trimmed reads of the samples. The main **output** of type dada2_errorrates shows the numeric matrix with the learned error rates. The **plot** shows the error rates for each possible transition (A→C, A→G,...) - Points are the observed error rates for each consensus quality score. - The black line shows the estimated error rates after convergence of the machine-learning algorithm. - The red line shows the error rates expected under the nominal definition of the Q-score. The learned error rates are input the the *dada2: dada* tool. Details ....... The learnErrors method learns a parametric this error model from the data, by alternating estimation of the error rates and inference of sample composition until they converge on a jointly consistent solution. As in many machine-learning problems, the algorithm must begin with an initial guess, for which the maximum possible error rates in this data are used (the error rates if only the most abundant sequence is correct and all the rest are errors). It is expected that the estimated error rates (black lines in the plot) are in a good fit to the observed rates (points in the plot), and that the error rates drop with increased quality. Try to increase the **number of bases to use for learning** if this is not the case. Everything looks reasonable and we proceed with confidence. ]]></help> <expand macro="citations"/> </tool>