Mercurial > repos > iuc > limma_voom
changeset 19:c9c6427edfe9 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/limma_voom commit 4c0406815cb76175d7d90b2874310635694126f5
| author | iuc |
|---|---|
| date | Tue, 28 May 2019 10:04:10 -0400 |
| parents | 97e06a4c7c75 |
| children | 0921444c832d |
| files | limma_voom.R limma_voom.xml test-data/contrasts.txt |
| diffstat | 3 files changed, 88 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/limma_voom.R Sun May 05 09:02:04 2019 -0400 +++ b/limma_voom.R Tue May 28 10:04:10 2019 -0400 @@ -9,7 +9,8 @@ # factFile", "f", 2, "character" -Path to factor information file # factInput", "i", 2, "character" -String containing factors if manually input # annoPath", "a", 2, "character" -Path to input containing gene annotations -# contrastData", "C", 1, "character" -String containing contrasts of interest +# contrastFile", "C", 1, "character" -Path to contrasts information file +# contrastInput", "D", 1, "character" -String containing contrasts of interest # cpmReq", "c", 2, "double" -Float specifying cpm requirement # cntReq", "z", 2, "integer" -Integer specifying minimum total count requirement # sampleReq", "s", 2, "integer" -Integer specifying cpm requirement @@ -161,7 +162,8 @@ "factFile", "f", 2, "character", "factInput", "i", 2, "character", "annoPath", "a", 2, "character", - "contrastData", "C", 1, "character", + "contrastFile", "C", 1, "character", + "contrastInput", "D", 1, "character", "cpmReq", "c", 1, "double", "totReq", "y", 0, "logical", "cntReq", "z", 1, "integer", @@ -343,11 +345,18 @@ #Create output directory dir.create(opt$outPath, showWarnings=FALSE) -# Split up contrasts seperated by comma into a vector then sanitise -contrastData <- unlist(strsplit(opt$contrastData, split=",")) +# Process contrasts +if (is.null(opt$contrastInput)) { + contrastData <- read.table(opt$contrastFile, header=TRUE, sep="\t", quote= "", strip.white=TRUE, stringsAsFactors=FALSE) + contrastData <- contrastData[, 1, drop=TRUE] +} else { + # Split up contrasts seperated by comma into a vector then sanitise + contrastData <- unlist(strsplit(opt$contrastInput, split=",")) +} + +# in case input groups start with numbers this will make the names valid R names, required for makeContrasts contrastData <- sanitiseEquation(contrastData) contrastData <- gsub(" ", ".", contrastData, fixed=TRUE) -# in case input groups start with numbers this will make the names valid R names, required for makeContrasts cons <- NULL for (i in contrastData) { i <- strsplit(i, split="-")
--- a/limma_voom.xml Sun May 05 09:02:04 2019 -0400 +++ b/limma_voom.xml Tue May 28 10:04:10 2019 -0400 @@ -1,4 +1,4 @@ -<tool id="limma_voom" name="limma" version="3.38.3+galaxy2"> +<tool id="limma_voom" name="limma" version="3.38.3+galaxy3"> <description> Perform differential expression with limma-voom or limma-trend </description> @@ -57,7 +57,11 @@ -a '$anno.geneanno' #end if --C '${ ','.join( ['%s' % $x.contrast for x in $rep_contrast] ) }' +#if $cont.cfile=='yes': + -C '$cont.cinfo' +#else: + -D '${ ','.join( ['%s' % $x.contrast for x in $cont.rep_contrast] ) }' +#end if #if $f.filt.filt_select == 'yes': #if $f.filt.cformat.format_select == 'cpm': @@ -223,12 +227,24 @@ </conditional> <!-- Contrasts --> - <repeat name="rep_contrast" title="Contrast" min="1" default="1"> - <param name="contrast" type="text" label="Contrast of Interest" help="Names of two groups to compare separated by a hyphen e.g. Mut-WT. If the order is Mut-WT the fold changes in the results will be up/down in Mut relative to WT. If you have more than one contrast enter each separately using the Insert Contrast button below. For differences between contrasts use e.g. (Mut1-Ctrl1)-(Mut2-Ctrl2). For more info, see Chapter 8 in the limma User's guide: https://www.bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf"> - <validator type="empty_field" /> - <validator type="regex" message="Please only use letters, numbers or underscores">^[\(\w\)-]+$</validator> + <conditional name="cont"> + <param name="cfile" type="select" label="Input Contrast information from file?" + help="You can choose to input the contrast information for the samples from a file or manually enter below. NOTE: Please only use letters, numbers or underscores (case sensitive), the group names MUST not contain hyphens. Use a hyphen to separate the groups you want to compare, as shown in the Help section below."> + <option value="no">No</option> + <option value="yes">Yes</option> </param> - </repeat> + <when value="yes"> + <param name="cinfo" type="data" format="tabular" label="Contrasts File"/> + </when> + <when value="no" > + <repeat name="rep_contrast" title="Contrast" min="1" default="1"> + <param name="contrast" type="text" label="Contrast of Interest" help="Names of two groups to compare separated by a hyphen e.g. Mut-WT. If the order is Mut-WT the fold changes in the results will be up/down in Mut relative to WT. If you have more than one contrast enter each separately using the Insert Contrast button below. For differences between contrasts use e.g. (Mut1-Ctrl1)-(Mut2-Ctrl2). For more info, see Chapter 8 in the limma User's guide: https://www.bioconductor.org/packages/release/bioc/vignettes/limma/inst/doc/usersguide.pdf"> + <validator type="empty_field" /> + <validator type="regex" message="Please only use letters, numbers or underscores">^[\(\w\)-]+$</validator> + </param> + </repeat> + </when> + </conditional> <!-- Filter Options --> <section name="f" expanded="false" title="Filter Low Counts"> @@ -360,6 +376,7 @@ <param name="factorName" value="Genotype"/> <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -400,6 +417,7 @@ <param name="factorName" value="Genotype"/> <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -424,6 +442,7 @@ <param name="factorName" value="Genotype"/> <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -452,6 +471,7 @@ <param name="factorName" value="Batch"/> <param name="groupNames" value="b1,b2,b3,b1,b2,b3"/> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -472,6 +492,7 @@ <param name="ffile" value="yes" /> <param name="finfo" value="factorinfo.txt" /> <param name="counts" value="matrix.txt" /> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -496,6 +517,7 @@ <param name="factorName" value="Genotype"/> <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -559,6 +581,7 @@ </repeat> <param name="annoOpt" value="yes" /> <param name="geneanno" value="anno.txt" /> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -596,6 +619,7 @@ <param name="factorName" value="Genotype"/> <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -626,6 +650,7 @@ <param name="factorName" value="Genotype"/> <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="Mut-WT" /> </repeat> @@ -656,6 +681,7 @@ <param name="factorName" value="Group"/> <param name="groupNames" value="2,2,2,1,1,1" /> </repeat> + <param name="cfile" value="no" /> <repeat name="rep_contrast"> <param name="contrast" value="2-1" /> </repeat> @@ -683,6 +709,33 @@ </assert_contents> </output> </test> + <!-- Ensure contrasts file works --> + <test expect_num_outputs="2"> + <param name="format" value="matrix" /> + <param name="counts" value="matrix.txt" /> + <repeat name="rep_factor"> + <param name="factorName" value="Genotype"/> + <param name="groupNames" value="Mut,Mut,Mut,WT,WT,WT" /> + </repeat> + <param name="cfile" value="yes" /> + <param name="cinfo" value="contrasts.txt" /> + <param name="normalisationOption" value="TMM" /> + <param name="topgenes" value="6" /> + <output_collection name="outTables" count="2"> + <element name="limma-voom_Mut-WT" ftype="tabular" > + <assert_contents> + <has_text_matching expression="GeneID.*logFC.*AveExpr.*t.*P.Value.*adj.P.Val.*B" /> + <has_text_matching expression="11304.*0.4573" /> + </assert_contents> + </element> + <element name="limma-voom_WT-Mut" ftype="tabular" > + <assert_contents> + <has_text_matching expression="GeneID.*logFC.*AveExpr.*t.*P.Value.*adj.P.Val.*B" /> + <has_text_matching expression="11304.*-0.4573" /> + </assert_contents> + </element> + </output_collection> + </test> </tests> <help><