Previous changeset 26:acdbc67b204a (2013-07-03) Next changeset 28:eeb66cb4f7e0 (2013-07-03) |
Commit message:
Uploaded |
added:
RnBeadsGalaxy.R galaxy_faq.docx install.rnbeads.R rnbeads.xml rnbeads_galaxy_wrapper.sh rnbeads_repos.txt.sample tool_data_table_conf.xml.sample tool_dependencies.xml |
b |
diff -r acdbc67b204a -r 8e9707e719a3 RnBeadsGalaxy.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RnBeadsGalaxy.R Wed Jul 03 04:39:00 2013 -0400 |
[ |
@@ -0,0 +1,198 @@ +#msg.file<-file("RnBeads.messages.out", open="w") +#sink(file=msg.file) + +suppressWarnings(suppressPackageStartupMessages(library(RnBeads))) +suppressWarnings(suppressPackageStartupMessages(library(getopt))) + +#all.opts<-names(rnb.options()) +opt.class<-RnBeads:::OPTION.TYPES[-28] +all.opts<-names(opt.class) +#all.opts<-paste("--", all.opts, sep="") +#all.opts<-gsub("\\.([a-z])", "\\U\\1", all.opts, perl=TRUE) +all.opts<-gsub("\\.","-", all.opts) +#opt.class<-sapply(rnb.options(), class) + +rnb.opt.spec<-data.frame( + Long=all.opts, + Short=as.character(1:length(all.opts)), + Mask=c(1,2)[as.integer((opt.class=="logical"))+1], + Type=opt.class) + +### automated xml file preparation +#xml.strings<-apply(rnb.opt.spec,1, function(row){ +# +# opt.lab<-gsub("-", ".", row[1]) +# opt.def.val<-rnb.getOption(opt.lab) +# opt.name<-gsub("-([0-9a-z])", "\\U\\1", row[1], perl=TRUE) +# tf.opt<-"\t\t\t<option value=\"True\">True</option>\n\t\t\t<option value=\"False\">False</option>" +# opt.lab<-paste(opt.lab, gsub("\\."," ", row[4]), sep=", ") +# if(row[4]=="logical"){ +# opt.type<-'select' +# if(!is.null(opt.def.val) && opt.def.val) +# opt.def.val<-"1" else +# opt.def.val<-"0" +# string<-sprintf("\t\t<param name=\"%s\" type=\"%s\" label=\"%s\" value=\"%s\">\n%s\n\t\t</param>\n", opt.name, opt.type, opt.lab, opt.def.val, tf.opt) +# }else{ +# opt.type<-'text' +# if(!is.null(opt.def.val) && opt.def.val!="") +# opt.def.val<-paste(opt.def.val, collapse=",") else +# opt.def.val<-"" +# string<-sprintf("\t\t<param name=\"%s\" type=\"%s\" label=\"%s\" value=\"%s\"/>\n", opt.name, opt.type, opt.lab, opt.def.val) +# } +# string +# }) +# +#cat(xml.strings, sep="", file="automated.settings.xml.txt") +# +#opt.def.strings<-apply(rnb.opt.spec,1, function(row){ +# +# opt.name<-gsub("-([0-9a-z])", "\\U\\1", row[1], perl=TRUE) +# opt.long<-row[1] +# opt.short<-row[2] +# +# if(row[4]=="logical"){ +# def.string<-sprintf("#if str( $options.%s ) == \"True\"\n\t--%s\n#end if\n", opt.name, opt.long) +# }else{ +# def.string<-sprintf("#if str( $options.%s ) != \"\"\n\t--%s=\"$options.%s\" \n#end if\n", opt.name, opt.long, opt.name) +# } +# def.string +# +# }) +#cat(opt.def.strings, sep="", file="automated.option.assignments.txt") + + +rnb.opt.spec$Type<-gsub("\\.vector", "", rnb.opt.spec$Type) +rnb.opt.spec$Type<-gsub("numeric", "double", rnb.opt.spec$Type) +rnb.opt.spec<-rbind(data.frame( + Long=c("data-type", "pheno", "idat-dir","idat-files","bed-files", "gs-report", "geo-series", "betas", "pvals","output-file", "report-dir"), + Short=c("d","s","a","i","f","g","e","b","p","r","o"), + Mask=c(1,2,2,2,2,2,2,2,2,1,1), + Type=c("character","character","character","character","character","character","character","character","character","character", "character")), + rnb.opt.spec) + +opts<-getopt(as.matrix(rnb.opt.spec)) +#opts<-getopt(as.matrix(rnb.opt.spec), opt=list("--data-type=idats","--report-dir=dir", "--idats=file1\tfile2")) +print(opts) + +if(opts[["data-type"]]=="idatDir"){ + + data.source<-list() + data.type<-"idat.dir" + data.source[["idat.dir"]]<-opts[["idat-dir"]] + data.source[["sample.sheet"]]<-opts[["pheno"]] + +}else if(opts[["data-type"]]=="idatFiles"){ + + data.type<-"idat.dir" + file.string<-gsub(" ","", opts[["idat-files"]]) + files<-strsplit(file.string, ",")[[1]] + files<-files[files!=""] + bed.dir<-sprintf("%s_beds",opts[["report-dir"]]) + dir.create(bed.dir) + file.copy(files, bed.dir) + for(dat.file in list.files(bed.dir, full.names = TRUE)){ + file.rename(dat.file, gsub("\\.dat", ".bed", dat.file)) + } + data.source<-list() + data.source[["bed.dir"]]<-bed.dir + data.source[["sample.sheet"]]<-opts[["pheno"]] + + +}else if(opts[["data-type"]]=="GS.report"){ + + data.type<-"GS.report" + data.source<-opts[["gs-report"]] + +}else if(opts[["data-type"]]=="GEO"){ + + data.type<-"GEO" + data.source<-opts[["geo-series"]] + +}else if(opts[["data-type"]]=="data.files"){ + + data.type<-"GEO" + data.source<-opts[["geo-series"]] + +}else if(opts[["data-type"]]=="data.files"){ + + data.type<-"data.files" + data.source<-c(opts[["pheno"]], opts[["betas"]]) + if(!is.null(opts[["pvals"]])) + data.source<-c(data.source, opts[["pvals"]]) + +}else if(opts[["data-type"]]=="bed.dir"){ + + data.type<-"bed.dir" + file.string<-gsub(" ","", opts[["bed-files"]]) + files<-strsplit(file.string, ",")[[1]] + files<-files[files!=""] + bed.dir<-sprintf("%s_beds",opts[["report-dir"]]) + dir.create(bed.dir) + file.copy(files, bed.dir) + for(dat.file in list.files(bed.dir, full.names = TRUE)){ + file.rename(dat.file, gsub("\\.dat", ".bed", dat.file)) + } + data.source<-list() + data.source[["bed.dir"]]<-bed.dir + + logger.start(fname="NA") + sample.sheet<-rnb.read.annotation(opts[["pheno"]]) + logger.close() + if(length(files) < nrow(sample.sheet)) + stop("Not all bed files are present") + + cn<-colnames(sample.sheet) + dat.files<-sapply(strsplit(files, "\\/"), function(el) el[length(el)]) + sample.sheet<-cbind(sample.sheet, gsub("\\.dat", ".bed", dat.files)) + colnames(sample.sheet)<-c(cn, "BED_files") + data.source[["sample.sheet"]]<-sample.sheet +} + +if("logging" %in% names(opts)){ # TODO create a cleaner way of checking whether the full options set was supplied + + dump<-sapply(names(opt.class), function(on){ + getoptname<-gsub("-", "\\.","-",on) + if(getoptname %in% names(opts)){ + if(opt.class[on]=="logical"){ + ov<-TRUE + }else if(opt.class %in% c("character","character.vector")){ + ov<-opts[[getoptname]] + ov<-gsub("\"", "", ov) + if(opt.class=="character.vector"){ + ov<-as.character(strsplit(ov,",")) + } + + }else if(opt.class %in% c("integer","numeric","integer.vector","numeric.vector")){ + ov<-opts[[getoptname]] + ov<-gsub("\"", "", ov) + if(opt.class %in% c("integer.vector","numeric.vector")){ + ov<-as.character(strsplit(ov,",")) + } + } + eval(parse(text=sprintf("rnb.options(%s=ov)",on))) + } + }) + + logical.opts<-names(opt.class[opt.class=="logical"]) + logical.opts.false<-logical.opts[!logical.opts %in% gsub("-",".",names(opts))] + + + dump<-sapply(logical.opts.false, function(on){ + eval(parse(text=sprintf("rnb.options(%s=FALSE)",on))) + }) +} + +print(rnb.options()) + +#report.out.dir<-sprintf("%s_rnbReport", tempdir()) +report.out.dir<-opts[["report-dir"]] +print("Starting RnBeads with the following inputs:") +print(data.source) +print(report.out.dir) +print(data.type) +rnb.run.analysis(data.source=data.source, dir.report=report.out.dir, data.type=data.type) + + +#sink(file=NULL) +#flush(msg.file) +#close(msg.file) \ No newline at end of file |
b |
diff -r acdbc67b204a -r 8e9707e719a3 galaxy_faq.docx |
b |
Binary file galaxy_faq.docx has changed |
b |
diff -r acdbc67b204a -r 8e9707e719a3 install.rnbeads.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install.rnbeads.R Wed Jul 03 04:39:00 2013 -0400 |
b |
@@ -0,0 +1,1 @@ +source("http://rnbeads.mpi-inf.mpg.de/install.R") \ No newline at end of file |
b |
diff -r acdbc67b204a -r 8e9707e719a3 rnbeads.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rnbeads.xml Wed Jul 03 04:39:00 2013 -0400 |
b |
b'@@ -0,0 +1,508 @@\n+<?xml version="0.9"?>\r\n+<tool id="rnbeads" name="RnBeads" version="0.9">\r\n+ <description>Performs RnBeads analysis for the selected set of </description>\r\n+ <requirements>\r\n+ <requirement type="set_environment" version="1.0">R_SCRIPTS_PATH</requirement>\r\n+ <requirement type="package" version="3.0.0">R</requirement>\r\n+ </requirements>\r\n+ <command interpreter="bash">rnbeads_galaxy_wrapper.sh\r\n+ \t\t--report-dir="$html_file.extra_files_path"\r\n+ \t--output-file="$html_file"\r\n+ #if str( $inputDataSelector.dataType ) == "idats" \r\n+ \t--pheno="$inputDataSelector.sampleAnnotations"\r\n+ #end if\r\n+ #if str( $inputDataSelector.dataType ) != "idats"\r\n+ \t#pass\r\n+ #else if str( $inputDataSelector.idatSelector.idatSource ) == "history"\r\n+ \t--data-type="idatFiles"\r\n+ \t#set $idatList=""\r\n+ \t#for $input_file in $inputDataSelector.idatSelector.idatSeries:\r\n+ \t\t#set $idatList+=str( $input_file.idatFile )\r\n+ \t\t#set $idatList+=","\t\t\t\t\r\n+ \t#end for\r\n+ \t--idat-files="$idatList"\r\n+ #else:\r\n+ \t\t--data-type="idatDir"\r\n+ \t\t--idat-dir="$inputDataSelector.idatSelector.idatRepo.fields.path"\r\n+ #end if\r\n+ #if str( $inputDataSelector.dataType ) == "gsreport"\r\n+ \t--data-type="GS.report"\r\n+ \t--gs-report="$inputDataSelector.gsReportFile"\r\n+ #end if\r\n+ #if str( $inputDataSelector.dataType ) == "geo"\r\n+ \t--data-type="GEO"\r\n+ \t--geo-series=$inputDataSelector.geoSeries\r\n+ #end if\r\n+ #if str( $inputDataSelector.dataType ) == "tables"\r\n+ --data-type="data.files"\r\n+ --pheno="$inputDataSelector.sampleAnnotations"\r\n+ #end if\r\n+ #if str( $inputDataSelector.dataType ) == "tables"\r\n+ \t--data-type="data.files"\r\n+ \t--pheno="$inputDataSelector.sampleAnnotations"\r\n+ \t--betas="$inputDataSelector.betaTable"\r\n+ \t--pvals="$inputDataSelector.pvalTable"\r\n+ #end if\r\n+ #if str( $inputDataSelector.dataType ) == "bed"\r\n+ --data-type="bed.dir"\r\n+ \t--pheno="$inputDataSelector.sampleAnnotations"\r\n+ #set $bedList=""\r\n+ \t#for $input_file in $inputDataSelector.bedSeries:\r\n+ \t\t#set $bedList+=str( $input_file.bedFile )\r\n+ \t\t#set $bedList+=","\t\t\t\t\r\n+ \t#end for\r\n+ \t--bed-files="$bedList"\r\n+ #end if\r\n+ #if str( $options.optionSet ) == "full"\r\n+ #if str( $options.analysisName ) != ""\r\n+\t\t\t\t\t--analysis-name="$options.analysisName" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.logging ) == "True"\r\n+\t\t\t\t\t--logging\r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.email ) != ""\r\n+\t\t\t\t\t--email="$options.email" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.assembly ) != ""\r\n+\t\t\t\t\t--assembly="$options.assembly" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.analyzeSites ) == "True"\r\n+\t\t\t\t\t--analyze-sites\r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.regionTypes ) != ""\r\n+\t\t\t\t\t--region-types="$options.regionTypes" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.identifiersColumn ) != ""\r\n+\t\t\t\t\t--identifiers-column="$options.identifiersColumn" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.pointsCategory ) != ""\r\n+\t\t\t\t\t--points-category="$options.pointsCategory" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.colorsCategory ) != ""\r\n+\t\t\t\t\t--colors-category="$options.colorsCategory" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.colorsGradient ) != ""\r\n+\t\t\t\t\t--colors-gradient="$options.colorsGradient" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.minGroupSize ) != ""\r\n+\t\t\t\t\t--min-group-size="$options.minGroupSize" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.maxGroupCount ) != ""\r\n+\t\t\t\t\t--max-group-count="$options.maxGroupCount" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.gzLargeFiles ) == "True"\r\n+\t\t\t\t\t--gz-large-files\r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.strandSpecific ) == "True"\r\n+\t\t\t\t\t--strand-specific\r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.replicateIdColumn ) != ""\r\n+\t\t\t\t\t--replicate-id-column="$options.replicateIdColumn" \r\n+\t\t\t\t#end if\r\n+\t\t\t\t#if str( $options.loadingNormalization ) == "True"\r\n+\t\t\t\t\t--loading-normalization\r\n+\t\t\t\t#end if\r\n+\t\t'..b'batchCorrelationQc" type="select" label="batch.correlation.qc, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="profiles" type="select" label="profiles, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="profilesBetaDistribution" type="select" label="profiles.beta.distribution, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="profilesIntersample" type="select" label="profiles.intersample, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="profilesDeviationPlots" type="select" label="profiles.deviation.plots, logical" value="0">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="profilesColumns" type="text" label="profiles.columns, integer vector" value=""/>\r\n+\t\t\t\t<param name="profilesClustering" type="select" label="profiles.clustering, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="profilesClusteringTopProbes" type="text" label="profiles.clustering.top.probes, integer vector" value="1000"/>\r\n+\t\t\t\t<param name="regionProfilesTypes" type="text" label="region.profiles.types, character vector" value="genes,promoters,cpgislands"/>\r\n+\t\t\t\t<param name="differential" type="select" label="differential, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="differentialPermutations" type="text" label="differential.permutations, integer" value="0"/>\r\n+\t\t\t\t<param name="differentialComparisonColumns" type="text" label="differential.comparison.columns, integer vector" value=""/>\r\n+\t\t\t\t<param name="differentialEnrichment" type="select" label="differential.enrichment, logical" value="0">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="exportToUcsc" type="text" label="export.to.ucsc, character vector" value="bigBed,bigWig"/>\r\n+\t\t\t\t<param name="exportToBed" type="select" label="export.to.bed, logical" value="1">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="exportToCsv" type="select" label="export.to.csv, logical" value="0">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="exportTypes" type="text" label="export.types, character vector" value="sites"/>\r\n+\t\t\t\t<param name="colors3Gradient" type="text" label="colors.3.gradient, character vector" value="#832424,#FFFFFF,#3A3A98"/>\r\n+\t\t\t\t<param name="loggingMemory" type="select" label="logging.memory, logical" value="0">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+\t\t\t\t<param name="usePstoimg" type="select" label="use.pstoimg, logical" value="0">\r\n+\t\t\t\t\t<option value="True">True</option>\r\n+\t\t\t\t\t<option value="False">False</option>\r\n+\t\t\t\t</param>\r\n+ \t</when>\r\n+ </conditional>\r\n+ </inputs>\r\n+ \r\n+ <outputs>\r\n+\t<data format="html" name="html_file" label="index.html" />\r\n+ </outputs>\r\n+\r\n+ <!--\r\n+ <tests>\r\n+ <test>\r\n+ <param name="input" value="fa_gc_content_input.fa"/>\r\n+ <output name="out_file1" file="fa_gc_content_output.txt"/>\r\n+ </test>\r\n+ </tests> -->\r\n+\r\n+ <help>\r\n+\tRnBeads is an R-package for comprehensive analysis of Illumina Infinium HumanMethylation450 BeadChip data. It extends previous approaches for this type of data analysis by high throughput capabilities, as well as presenting results in a comprehensive, highly interpretable fashion.\r\n+ </help>\r\n+\r\n+</tool>\n\\ No newline at end of file\n' |
b |
diff -r acdbc67b204a -r 8e9707e719a3 rnbeads_galaxy_wrapper.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rnbeads_galaxy_wrapper.sh Wed Jul 03 04:39:00 2013 -0400 |
[ |
@@ -0,0 +1,25 @@ +#!/bin/bash +Rscript --no-save $(dirname $(readlink -f $0))/RnBeadsGalaxy.R $* > /tmp/rnbeads.stdout 2>/tmp/rnbeads.stderr +#Rscript --no-save \$R_SCRIPTS_PATH/RnBeadsGalaxy.R $* +outfile=`echo $* | cut -d\ -f2 | sed -e "s/--output-file=//g"` +echo $outfile +#outdir=`echo $* | sed -e "s/.*--report-dir=\(.*\)[[:blank:]].*/\1/g"` + + +if [ -s /tmp/rnbeads.stderr ] +then + cat /tmp/rnbeads.stdout >&2 + #cat $outdir/analysis.log >&2 + cat /tmp/rnbeads.stderr >&2 + exit 3 +else + echo "<html><body>" >> $outfile + echo "<a href=\"index.html\">RnBeads report</a>" >> $outfile + echo "<br/><br/>Output was generated during the execution:<br/>" >> $outfile + echo "<pre>" >> outfile + cat /tmp/rnbeads.stdout |sed -e "s/$/<br\/>/g" >> $outfile + echo "</pre>" >> outfile + echo "</p>" >> $outfile + echo "</body></html>" >> $outfile + exit 0 +fi \ No newline at end of file |
b |
diff -r acdbc67b204a -r 8e9707e719a3 rnbeads_repos.txt.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rnbeads_repos.txt.sample Wed Jul 03 04:39:00 2013 -0400 |
b |
@@ -0,0 +1,1 @@ +repo1 Repository1 /data/iscan/idats \ No newline at end of file |
b |
diff -r acdbc67b204a -r 8e9707e719a3 tool_data_table_conf.xml.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_data_table_conf.xml.sample Wed Jul 03 04:39:00 2013 -0400 |
b |
@@ -0,0 +1,6 @@ +<tables> + <table name="rnbeads_repos" comment_char="#"> + <columns>id, name, value</columns> + <file path="tool-data/rnbeads_repos.txt" /> + </table> +</tables> \ No newline at end of file |
b |
diff -r acdbc67b204a -r 8e9707e719a3 tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Wed Jul 03 04:39:00 2013 -0400 |
b |
@@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<tool_dependency> + <set_environment version="1.0"> + <environment_variable name="R_SCRIPTS_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> + </set_environment> + <package name="R" version="3.0.0"> + <install version="0.9"> + <actions> + <action type="download_by_url">http://CRAN.R-project.org/src/base/R-3/R-3.0.0.tar.gz</action> + <action type="shell_command">./configure --prefix=$INSTALL_DIR --with-x=no</action> + <action type="shell_command">make</action> + <action type="set_environment"> + <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable> + </action> + <action type="shell_command">R --no-save <<< "install.packages("getopt"); source('http://rnbeads.mpi-inf.mpg.de')"</action> + </actions> + </install> + <readme> + You need a FORTRAN compiler or perhaps f2c in addition to a C compiler to build R. + </readme> + </package> +</tool_dependency> \ No newline at end of file |