Mercurial > repos > sblanck > smagexp
changeset 33:2d7595c8041d draft
planemo upload for repository https://github.com/sblanck/smagexp/tree/master/smagexp_tools commit d42088af604c5a01e1ccebba1d59f7a28a976f71
author | sblanck |
---|---|
date | Thu, 21 Jun 2018 10:06:23 -0400 |
parents | 2c0df656094a |
children | 0a74b8de4c10 |
files | MetaRNAseq.xml Recount.R Recount.xml |
diffstat | 3 files changed, 100 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/MetaRNAseq.xml Thu Jun 21 08:25:36 2018 -0400 +++ b/MetaRNAseq.xml Thu Jun 21 10:06:23 2018 -0400 @@ -41,7 +41,7 @@ <param format="tabular" name="input" multiple="false" type="data" optional="false" label="DESeq2 result file" help="Must have the same number of row in each study"/> <param name="nbreplicates" type="integer" value="10" label="Number of replicates" help="Number of replicates of the study"/> </repeat> - <param name="fdr" type="float" value="0.05" label="FDR" min="0" max="1" help="adjusted p-value threshold to be declared differentially expressed"/> + <param name="fdr" type="float" value="0.05" label="FDR" min="0" max="1" help="Adjusted p-value threshold to be declared differentially expressed"/> </inputs>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Recount.R Thu Jun 21 10:06:23 2018 -0400 @@ -0,0 +1,47 @@ +#!/usr/bin/env Rscript +# setup R error handling to go to stderr +options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) + +# we need that to not crash galaxy with an UTF8 error on German LC settings. +loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") + +library("optparse") + +##### Read options +option_list=list( + make_option("--id",type="character",default=NULL,help="GSE ID from GEO databse (required)"), + make_option("--report",type="character",default=NULL,help="Text file summarizing conditions of the experiment") + +); + +opt_parser = OptionParser(option_list=option_list); +opt = parse_args(opt_parser); + +if(is.null(opt$id)){ + print_help(opt_parser) + stop("Recount id required.", call.=FALSE) +} + +#loading libraries +suppressPackageStartupMessages(require(GEOquery)) + +studyID=opt$id +reportFile=opt$report + +dir.create("./split", showWarnings = TRUE, recursive = FALSE) + +url <- download_study(studyID) +load(file.path(studyID, 'rse_gene.Rdata')) +rse <- scale_counts(rse_gene) +counts=assay(rse) +conditions=rse$title + +for (i in 1:ncol(counts)) +{ + currentCount=as.data.frame(counts[,i]) + sampleID=colnames(counts)[i] + colnames(currentCount)=sampleID + write.table(x=currentCount,file=paste0("./split/",sampleID,"_",conditions[i]),sep="\t",row.names = T, col.names = T) +} + +write.table(as.data.frame(cbind(sampleID=colnames(counts),title=conditions)),quote = FALSE,col.names =TRUE, row.names=FALSE,file=reportFile,sep="\t") \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Recount.xml Thu Jun 21 10:06:23 2018 -0400 @@ -0,0 +1,52 @@ +<tool id="Recount" name="Recount" version="1.0.0"> + + <description>Get rna-seq count data with R recount Package</description> + + <requirements> + <requirement type="package">bioconductor-recount</requirement> + <requirement type="package">r-optparse</requirement> + </requirements> + <stdio> + <exit_code range="1:" /> + <regex match="Warning" source="both" level="warning"/> + </stdio> + + <command> + <![CDATA[ + Rscript --vanilla + ${__tool_directory__}/Recount.R + --id ${RecountID} + --report ${Report} + ]]> + </command> + + <inputs> + <param name="RecountID" type="text" size="12" optional="false" label="GEOQuery ID" help=""> + <validator type="empty_field"/> + </param> + </inputs> + + <outputs> + <data format="txt" name="report"> + <discover_datasets pattern="__designation_and_ext__" directory="split" visible="true" /> + </data> +</outputs> + + <tests> + </tests> + + <help> +<![CDATA[ +**What it does** + +This tool fetches RNA-seq count data directly from Recount project based on the recount bioconductor R package. Given an ID, it returns a small report +containing the metadata of the experiment. Il also generates one count file per sample. + +**Results** + +- Tabular file containing meta-data +- One count file per sample +]]> + </help> + +</tool>