Mercurial > repos > matthias > dada2_makesequencetable
comparison dada2_makeSequenceTable.xml @ 0:98e24c66eeb2 draft
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
| author | matthias |
|---|---|
| date | Fri, 08 Mar 2019 06:42:56 -0500 |
| parents | |
| children | d2e7c5f8a9f7 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:98e24c66eeb2 |
|---|---|
| 1 <tool id="dada2_makeSequenceTable" name="dada2: makeSequenceTable" version="@DADA2_VERSION@"> | |
| 2 <description>construct a sequence table (analogous to OTU table)</description> | |
| 3 <macros> | |
| 4 <import>macros.xml</import> | |
| 5 </macros> | |
| 6 <expand macro="requirements"/> | |
| 7 <expand macro="version_command"/> | |
| 8 <command detect_errors="exit_code"><![CDATA[ | |
| 9 Rscript '$dada2_script' | |
| 10 ]]></command> | |
| 11 <configfiles> | |
| 12 <configfile name="dada2_script"><![CDATA[ | |
| 13 @READ_FOO@ | |
| 14 | |
| 15 library(dada2, quietly=T) | |
| 16 #if $filter.plot == "yes" | |
| 17 library(ggplot2, quietly=T) | |
| 18 #end if | |
| 19 | |
| 20 samples <- list() | |
| 21 #for $s in $samples: | |
| 22 #if $len($samples) == 1 | |
| 23 samples <- $read_data($s) | |
| 24 #else | |
| 25 samples[["$s.element_identifier"]] <- $read_data($s) | |
| 26 #end if | |
| 27 #end for | |
| 28 ## make sequence table | |
| 29 seqtab <- makeSequenceTable(samples, orderBy = "$orderby") | |
| 30 | |
| 31 ## get and plot length distribution | |
| 32 seqlen <- data.frame(length = nchar(getSequences(seqtab))) | |
| 33 seqlenq <- quantile(seqlen\$length, probs=c( $filter.plower, $filter.pupper )) | |
| 34 | |
| 35 #if $filter.plot == "yes" | |
| 36 pdf( '$plot' ) | |
| 37 ggplot(seqlen) + | |
| 38 geom_histogram( aes(x=length), binwidth=1 ) + | |
| 39 geom_vline(xintercept=c(seqlenq[1]-0.5, seqlenq[2]+0.5)) | |
| 40 bequiet <- dev.off() | |
| 41 #end if | |
| 42 | |
| 43 ## filter by seqlengths | |
| 44 #if $filter.filter == "yes" | |
| 45 seqtab <- seqtab[,nchar(colnames(seqtab)) %in% seqlenq] | |
| 46 #end if | |
| 47 | |
| 48 write.table(seqtab, "$stable", quote=F, sep="\t", row.names = T, col.names = NA) | |
| 49 ]]></configfile> | |
| 50 </configfiles> | |
| 51 <inputs> | |
| 52 <param name="samples" type="data" multiple="true" format="@DADA_UNIQUES@" label="samples" /> | |
| 53 <param name="orderby" type="select" label="Column order"> | |
| 54 <option value="abundance">abundance</option> | |
| 55 <option value="nsamples">nsamples</option> | |
| 56 </param> | |
| 57 <section name="filter" title="Plot and filter sequence lengths"> | |
| 58 <param name="plower" type="float" min="0" max="1" value="0.01" label="lower quantile" /> | |
| 59 <param name="pupper" type="float" min="0" max="1" value="0.99" label="upper quantile" /> | |
| 60 <param name="plot" type="boolean" truevalue="yes" falsevalue="no" checked="true" label="plot sequence length distribution" /> | |
| 61 <param name="filter" type="boolean" truevalue="yes" falsevalue="no" checked="true" label="filter sequence length using quantiles" /> | |
| 62 </section> | |
| 63 </inputs> | |
| 64 <outputs> | |
| 65 <data name="stable" format="dada2_sequencetable" label="${tool.name} on ${on_string}"/> | |
| 66 <data name="plot" format="pdf" label="${tool.name} on ${on_string}: sequence length distribution"> | |
| 67 <filter>filter['plot']</filter> | |
| 68 </data> | |
| 69 </outputs> | |
| 70 | |
| 71 <help><![CDATA[ | |
| 72 TODO: Fill in help. | |
| 73 ]]></help> | |
| 74 <expand macro="citations"/> | |
| 75 </tool> |
