Previous changeset 16:ed9594c25fad (2017-05-31) Next changeset 18:565118df598a (2017-05-31) |
Commit message:
Deleted selected files |
removed:
iwtomics/.Rapp.history iwtomics/.Rhistory iwtomics/._.DS_Store iwtomics/._ETn_example iwtomics/._example iwtomics/._loadandplot.R iwtomics/._plotwithscale.R iwtomics/._testandplot.R iwtomics/loadandplot.R iwtomics/loadandplot.xml iwtomics/macros.xml iwtomics/plotwithscale.R iwtomics/plotwithscale.xml iwtomics/testandplot.R iwtomics/testandplot.xml |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/.Rhistory --- a/iwtomics/.Rhistory Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,3 +0,0 @@ -require(IWTomics) -require(pheatmap) -install.packages(pheatmap) |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/._.DS_Store |
b |
Binary file iwtomics/._.DS_Store has changed |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/._ETn_example |
b |
Binary file iwtomics/._ETn_example has changed |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/._example |
b |
Binary file iwtomics/._example has changed |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/._loadandplot.R |
b |
Binary file iwtomics/._loadandplot.R has changed |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/._plotwithscale.R |
b |
Binary file iwtomics/._plotwithscale.R has changed |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/._testandplot.R |
b |
Binary file iwtomics/._testandplot.R has changed |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/loadandplot.R --- a/iwtomics/loadandplot.R Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,146 +0,0 @@ -if (require("IWTomics",character.only = TRUE,quietly = FALSE)) { - require(tools,quietly = FALSE) - args=commandArgs(TRUE) - - for (i in seq_along(args)) { - message(args[[i]]) - } - - # get args names and values - args_values=strsplit(args,'=') - args_names=unlist(lapply(args_values,function(arg) arg[1])) - names(args_values)=args_names - args_values=lapply(args_values,function(arg) arg[2]) - # read filenames - outrdata=args_values$outrdata - outregions=args_values$outregions - outfeatures=args_values$outfeatures - outpdf=args_values$outpdf - regionspaths=unlist(strsplit(args_values$regionspaths,'\\|')) - if("regionsheaderfile" %in% args_names){ - # the file regionsheaderfile must contain as first column the (unique) regionsfilenames, - # as second column the corresponding ids and as third column the names - tryCatch({ - regionsheader=read.delim(args_values$regionsheaderfile,header=FALSE,stringsAsFactors=FALSE,row.names=1,sep="\t") - regionsfilenames=unlist(strsplit(args_values$regionsfilenames,'\\|')) - if(length(setdiff(regionsfilenames,row.names(regionsheader)))) { - quit(save="no", status=11) - stop('Not all regionsfilenames are present in the first column of regionsheader.') - } - id_regions=regionsheader[regionsfilenames,1] - name_regions=regionsheader[regionsfilenames,2] - }, error = function(err) { - quit(save="no", status=10) #error on header file - stop(err) - }) - }else{ - eval(parse(text=args[[which(args_names=='regionsgalaxyids')]])) - id_regions=paste0('data_',regionsgalaxyids) - name_regions=paste0('data_',regionsgalaxyids) - } - featurespaths=unlist(strsplit(args_values$featurespaths,'\\|')) - if("featuresheaderfile" %in% args_names){ - # the file featuresheaderfile must contain as first column the (unique) featuresfilenames, - # as second column the corresponding ids and as third column the names - tryCatch({ - featuresheader=read.delim(args_values$featuresheaderfile,header=FALSE,stringsAsFactors=FALSE,row.names=1,sep="\t") - featuresfilenames=unlist(strsplit(args_values$featuresfilenames,'\\|')) - if(length(setdiff(featuresfilenames,row.names(featuresheader)))) { - quit(save="no", status=21) - stop('Not all featuresfilenames are present in the first column of featuresheader.') - } - id_features=featuresheader[featuresfilenames,1] - name_features=featuresheader[featuresfilenames,2] - }, error = function(err) { - quit(save="no", status=20) #error on header file - stop(err) - }) - }else{ - eval(parse(text=args[[which(args_names=='featuresgalaxyids')]])) - id_features=paste0('data_',featuresgalaxyids) - name_features=paste0('data_',featuresgalaxyids) - } - # read parameters (from smoothing on) - i_smoothing=which(args_names=='smoothing') - for(i in i_smoothing:length(args)){ - eval(parse(text=args[[i]])) - } - - # load data - tryCatch({ - regionsFeatures=IWTomicsData(regionspaths,featurespaths,alignment, - id_regions,name_regions,id_features,name_features,start.are.0based=start.are.0based) - }, error = function(err) { - if(grepl('invalid format',err$message)){ - quit(save="no", status=31) # error, not enough columns in input file - }else if(grepl('duplicated regions',err$message)){ - quit(save="no", status=32) # error, duplicated regions in region file - }else if(grepl('duplicated windows',err$message)){ - quit(save="no", status=33) # error, duplicated windows in feature file - }else if(grepl('overlapping windows',err$message)){ - quit(save="no", status=34) # error, overlapping windows in feature file - }else if(grepl('not all regions in datasets',err$message)){ - quit(save="no", status=35) # error, windows in feature files do not cover all regions in region files - }else if(grepl('ifferent size windows',err$message)){ - quit(save="no", status=36) # error, all windows in a feature files must have the same size - } - #error loading data - - stop(err) - - quit(save="no", status=30) - - }) - - # smooth data - if(smoothing!='no'){ - tryCatch({ - if(smoothing=='locpoly'){ - dist_knots=10 - }else if(smoothing=='kernel'){ - degree=3 - dist_knots=10 - }else if(smoothing=='splines'){ - bandwidth=5 - } - if(alignment=='scale'){ - if(scale==0){ - regionsFeatures=smooth(regionsFeatures,type=smoothing,fill_gaps=fill_gaps, - bandwidth=bandwidth,degree=degree,dist_knots=dist_knots) - }else{ - regionsFeatures=smooth(regionsFeatures,type=smoothing,fill_gaps=fill_gaps, - bandwidth=bandwidth,degree=degree,dist_knots=dist_knots,scale_grid=scale) - } - }else{ - regionsFeatures=smooth(regionsFeatures,type=smoothing,fill_gaps=fill_gaps, - bandwidth=bandwidth,degree=degree,dist_knots=dist_knots) - } - }, error = function(err) { - quit(save="no", status=40) #error on smoothing - stop(err) - }) - } - - # plot data - pdf(outpdf,width=10,height=8) - if(plottype=='boxplot'){ - # fix repeated probs - probs=sort(unique(probs)) - }else{ - probs=c(0.25,0.5,0.75) - } - plot(regionsFeatures,type=plottype,probs=probs,average=average,size=size,ask=FALSE) - dev.off() - - # create output - #write.table(cbind(unlist(strsplit(args_values$regionsfilenames,'\\|')),idRegions(regionsFeatures),nameRegions(regionsFeatures)), - #file=outregions,quote=FALSE,sep='\t',row.names=FALSE,col.names=FALSE) - write.table(as.data.frame(t(idRegions(regionsFeatures))),file=outregions,quote=FALSE,sep='\t',row.names=FALSE,col.names=FALSE) - #write.table(cbind(unlist(strsplit(args_values$featuresfilenames,'\\|')),idFeatures(regionsFeatures),nameFeatures(regionsFeatures)), - #file=outfeatures,quote=FALSE,sep='\t',row.names=FALSE,col.names=FALSE) - write.table(as.data.frame(t(idFeatures(regionsFeatures))),file=outfeatures,quote=FALSE,sep='\t',row.names=FALSE,col.names=FALSE) - save(regionsFeatures,file=outrdata) -}else{ - quit(save="no", status=255) - stop("Missing IWTomics package") -} \ No newline at end of file |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/loadandplot.xml --- a/iwtomics/loadandplot.xml Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,325 +0,0 @@\n-<tool id="loadandplot" name="IWTomics Load" version="@VERSION@.0">\n- <description>Smooth and Plot</description>\n- <macros>\n- <import>macros.xml</import>\n- </macros>\n- <expand macro="requirements" />\n- <stdio>\n- <exit_code range="255" source="both" level="fatal" description="Missing IWTomics package. Please be sure to have it installed before using this tool." />\n- <exit_code range="10" source="both" level="fatal" description="An error has occurred reading the header file for regions. Please try again." />\n- <exit_code range="11" source="both" level="fatal" description="Not all region files are present in the first column of header file for regions." />\n- <exit_code range="20" source="both" level="fatal" description="An error has occurred reading the header file for features. Please try again." />\n- <exit_code range="21" source="both" level="fatal" description="Not all feature files are present in the first column of header file for features." />\n- <exit_code range="30" source="both" level="fatal" description="An error has occurred reading the data. Please try again." />\n- <exit_code range="31" source="both" level="fatal" description="Not enough columns in input file." />\n- <exit_code range="32" source="both" level="fatal" description="Duplicated regions in region file." />\n- <exit_code range="33" source="both" level="fatal" description="Duplicated windows in feature file." />\n- <exit_code range="34" source="both" level="fatal" description="Overlapping windows in feature file." />\n- <exit_code range="35" source="both" level="fatal" description="Windows in feature files do not cover all regions in region files." />\n- <exit_code range="36" source="both" level="fatal" description="All windows in a feature file must have the same size." />\n- <exit_code range="40" source="both" level="fatal" description="An error has occurred smoothing the data. Please try again." />\n- <regex match="Error" source="both" level="fatal" description="An error has occurred. Please try again." />\n- </stdio>\n-\n- <command>\n-<![CDATA[\n- Rscript $__tool_directory__/loadandplot.R outrdata="${outrdata}" outregions="${outregions}" outfeatures="${outfeatures}" outpdf="${outpdf}"\n-\n- #set region_paths = \'"\\\\|"\'.join( [ str( $r ) for $r in $regions ] )\n- regionspaths="${region_paths}"\n- #set region_galaxyids = \'","\'.join( [ str( $r.hid ) for $r in $regions ] )\n- regionsgalaxyids="c(${region_galaxyids})"\n- #set region_names = \'"\\\\|"\'.join( [ str( $r.name ) for $r in $regions ] )\n- regionsfilenames="${region_names}"\n- #set region_header = \'"\\\\|"\'.join( [ str( $rh.regionsheader ) for $rh in $regionsheaderrepeat ] )\n- #if $region_header != "":\n- regionsheaderfile="${region_header}"\n- #end if\n-\n- #set feature_paths = \'"\\\\|"\'.join( [ str( $f ) for $f in $features ] )\n- featurespaths="${feature_paths}"\n- #set feature_galaxyids = \'","\'.join( [ str( $f.hid ) for $f in $features ] )\n- featuresgalaxyids="c(${feature_galaxyids})"\n- #set feature_names = \'"\\\\|"\'.join( [ str( $f.name ) for $f in $features ] )\n- featuresfilenames="${feature_names}"\n- #set feature_header = \'"\\\\|"\'.join( [ str( $fh.featuresheader ) for $fh in $featuresheaderrepeat ] )\n- #if $feature_header != "":\n- featuresheaderfile="${feature_header}"\n- #end if\n-\n- smoothing="\'${conditionaltype.smoothing}\'"\n- start.are.0based="${zerobased}"\n- #if $conditionaltype.smoothing == \'no\':\n- alignment="\'${conditionaltype.alignment}\'"\n- #elif $conditionaltype.smoothing == \'locpoly\':\n- alignment="\'${conditionaltype.locpolyconditionalscale.alignment}\'"\n- #if $conditionaltype.locpolyconditionalscale.alignment == \'scale\':\n- scale="${conditionaltype.locpolyconditionalscale.scalegrid}"\n- #end if\n- bandwidth="${conditionaltype.locpolybandwidth}"\n- degree="${conditionaltype.locpolydegr'..b'/section>\n- </inputs>\n-\n- <outputs>\n- <!--<data format="txt" name="stackerr" label="iwtomics.loadandplot.stackerr.txt" from_work_dir="iwtomics.loadandplot.stackerr.txt" />-->\n- <data format="rdata" name="outrdata" label="${tool.name} on ${on_string}: IWTomicsData Object" from_work_dir="iwtomics.loadandplot.RData" />\n- <data format="tabular" name="outregions" label="${tool.name} on ${on_string}: Region Dataset IDs" from_work_dir="iwtomics.loadandplot.regions.txt" />\n- <data format="tabular" name="outfeatures" label="${tool.name} on ${on_string}: Feature IDs" from_work_dir="iwtomics.loadandplot.features.txt" />\n- <data format="pdf" name="outpdf" label="${tool.name} on ${on_string}: Plotted Data" from_work_dir="iwtomics.loadandplot.pdf" />\n- </outputs>\n-\n- <help>\n-This tool imports a collection of genomic region datasets, and associates to each region\n-multiple genomic feature measurements. It allows to align the regions in multiple ways\n-(center, left, right or scale alignment), to smooth the feature curves (possibly filling gaps in the\n-measurements) and to create a graphical representation of the feature measurements in each\n-region datasets (aligned curves or pointwise quantile curves).\n-\n------\n-\n-**Region datasets**\n-\n-Each region dataset can be provided as a BED or Tabular file with tab delimited columns chr\n-start end (extra columns present in the input file are ignored). Regions can be of different\n-length::\n-\n- chr2 49960150 50060150\n- chr2 55912445 56012445\n- ...\n-\n------\n-\n-**Feature measurements**\n-\n-Feature measurements corresponding to all the regions can be provided as a BED or Tabular\n-file with tab delimited columns chr start end value::\n-\n- chr2 49960150 49962150 0.9426\n- chr2 49962150 49964150 0.7816\n- ...\n-\n-Each feature must be measured in windows of a fixed size inside all the regions (missing\n-values must be indicated as NA). Another way to import feature measurements is from a\n-Tabular file with the first three columns chr start end corresponding to the different genomic\n-regions, followed on the same row by all the measurements in fixed-size windows::\n-\n- chr2 49960150 50060150 0.9426 0.7816 0.8921 ... ... 1.2063\n- chr2 55912445 56012445 0.8719 0.9975 1.1619 ... ... 0.9601\n- ...\n-\n------\n-\n-**Output**\n-\n-The tool returns:\n-\n-1. RData with the IWTomicsData object, that stores the aligned genomic region datasets, and their associated feature measurements;\n-2. Region dataset identifiers;\n-3. Feature identifiers;\n-4. PDF file with the plotted data.\n-\n-1-3 can be used as input of the tool *IWTomics Test and Plot*\n-\n------\n-\n-.. class:: infomark\n-\n-**Notes**\n-\n-This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA).\n-\n-It implements a simplified version of the methods *smooth* and *plot* for *IWTomicsData* objects.\n-The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_).\n-\n-.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf\n- </help>\n-\n- <citations>\n- <citation type="bibtex">\n- @ARTICLE{\n- iwt-functional-data,\n- author = {Pini, Alessia and Vantini, Simone},\n- title = {Interval-Wise Testing for functional data},\n- journal = {Journal of Nonparametric Statistics},\n- year = {2017},\n- volume = {29},\n- number = {2},\n- pages = {407-424}\n- }\n- </citation>\n- <citation type="bibtex">\n- @MANUAL{\n- iwtomics,\n- author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone},\n- title = {IWTomics: Interval-Wise Testing for Omics Data},\n- note = {R package version 0.99.12},\n- year = {2017}\n- }\n- </citation>\n- </citations>\n-\n-</tool>\n' |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/macros.xml --- a/iwtomics/macros.xml Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,9 +0,0 @@ -<macros> - <token name="@VERSION@">1.0.0</token> - <xml name="requirements"> - <requirements> - <requirement type="package" version="3.3.1">R</requirement> - <requirement type="package" version="@VERSION">bioconductor-iwtomics</requirement> - </requirements> - </xml> -</macros> \ No newline at end of file |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/plotwithscale.R --- a/iwtomics/plotwithscale.R Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,117 +0,0 @@ -if (require("IWTomics",character.only = TRUE,quietly = FALSE)) { - args=commandArgs(TRUE) - - # get args names and values - args_values=strsplit(args,'=') - args_names=unlist(lapply(args_values,function(arg) arg[1])) - names(args_values)=args_names - args_values=lapply(args_values,function(arg) arg[2]) - # read filenames - adjustedpvalue=args_values$adjustedpvalue - iwtomicsrespdf=args_values$iwtomicsrespdf - iwtomicssumpdf=args_values$iwtomicssumpdf - iwtomicsrdata=args_values$iwtomicsrdata - iwtomicstests=args_values$iwtomicstests - iwtomicsselectedfeatures=args_values$iwtomicsselectedfeatures - test_subset=paste0('c(',strsplit(args_values$test_subset,'\\|')[[1]],')') - feature_subset=paste0('c(',strsplit(args_values$feature_subset,'\\|')[[1]],')') - # read parameters (from test_subset on) - i_scale_subset=which(args_names=='scale_subset') - for(i in i_scale_subset:length(args)){ - eval(parse(text=args[[i]])) - } - - # load RData - load(iwtomicsrdata) - # read testids and featureids and check them - unlisted=lapply(seq_along(test_subset), - function(i){ - test_subset_i=eval(parse(text=test_subset[i])) - feature_subset_i=eval(parse(text=feature_subset[i])) - test_subset_i=rep(test_subset_i,each=length(feature_subset_i)) - feature_subset_i=rep(feature_subset_i,length.out=length(test_subset_i)) - scale_subset_i=rep(scale_subset[i],length(test_subset_i)) - return(list(test_subset=test_subset_i,feature_subset=feature_subset_i,scale_subset=scale_subset_i)) - }) - test_subset=unlist(lapply(unlisted,function(l) l$test_subset)) - feature_subset=unlist(lapply(unlisted,function(l) l$feature_subset)) - scale_subset=unlist(lapply(unlisted,function(l) l$scale_subset)) - testids=as.character(read.delim(iwtomicstests,header=FALSE,sep='\t',stringsAsFactors=FALSE)) - featureids=as.character(read.delim(iwtomicsselectedfeatures,header=FALSE,sep='\t',stringsAsFactors=FALSE)) - id_features_subset=featureids[feature_subset] - if(sum(testids!=paste(testInput(regionsFeatures_test)$id_region1,'vs',testInput(regionsFeatures_test)$id_region2))){ - quit(save="no", status=10) - stop('Wrong test ids') - } - if(sum(featureids!=idFeatures(regionsFeatures_test))){ - quit(save="no", status=20) - stop('Wrong feature ids') - } - # retrieve test and features_subset ids - id_features_subset=featureids[feature_subset] - if(sum(duplicated(paste0(test_subset,id_features_subset)))){ - quit(save="no", status=30) - stop('Two scale thresholds selected for the same test and feature.') - } - # If scale_subset=0, do not change the threshold - default=(scale_subset==0) - scale_subset=scale_subset[!default] - test_subset=test_subset[!default] - id_features_subset=id_features_subset[!default] - - # get scale threshold - scale_threshold=lapply(regionsFeatures_test@test$result, - function(result) unlist(lapply(result,function(feature) feature$max_scale))) - for(i in seq_along(test_subset)){ - if(scale_threshold[[test_subset[i]]][id_features_subset[i]]<scale_subset[i]){ - quit(save="no", status=40) - stop('Scale threshold too high.') - } - scale_threshold[[test_subset[i]]][id_features_subset[i]]=scale_subset[i] - } - - # create adjustedvalue output - pval=adjusted_pval(regionsFeatures_test,scale_threshold=scale_threshold) - for(test in seq_along(pval)){ - for(id_feature in idFeatures(regionsFeatures_test)){ - write(paste0('Test: ',testids[test],', on feature ',id_feature), - file=adjustedpvalue,append=TRUE,sep='\t') - pval_i=as.data.frame(t(pval[[test]][[id_feature]])) - row.names(pval_i)=paste('Scale',scale_threshold[[test]][[id_feature]]) - write.table(pval_i,file=adjustedpvalue,append=TRUE,sep='\t',quote=FALSE,row.names=TRUE,col.names=FALSE) - write('',file=adjustedpvalue,append=TRUE,sep='\t') - } - } - - - # plot test results - pdf(iwtomicsrespdf,width=5,height=7) - if(plottype=='boxplot'){ - # fix repeated probs - probs=sort(unique(probs)) - }else{ - probs=c(0.25,0.5,0.75) - } - plotTest(regionsFeatures_test,alpha=testalpha,type=plottype,probs=probs,average=average,size=size,scale_threshold=scale_threshold,ask=FALSE) - dev.off() - - # plot summary results - if(groupby!='none'){ - tryCatch({ - pdf(iwtomicssumpdf,width=15,height=10) - plotSummary(regionsFeatures_test,alpha=summaryalpha,only_significant=only_significant,groupby=groupby,scale_threshold=scale_threshold,ask=FALSE,append=TRUE) - dev.off() - }, error = function(err) { - if (grepl('selected features with different resolution',err$message)) { - quit(save="no", status=50) #error: groupby 'test' but selected features with different resolution. - stop(err) - } - quit(save="no", status=60) #error - stop(err) - }) - } - -}else{ - quit(save="no", status=255) - stop("Missing IWTomics package") -} \ No newline at end of file |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/plotwithscale.xml --- a/iwtomics/plotwithscale.xml Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,201 +0,0 @@\n-<tool id="plotwithscale" name="IWTomics Plot with Threshold" version="@VERSION@.0">\n- <description>on Test Scale</description>\n- <macros>\n- <import>macros.xml</import>\n- </macros>\n- <expand macro="requirements" />\n- <stdio>\n- <exit_code range="-1" source="both" level="fatal" description="Missing IWTomics package. Please be sure to have it installed before using this tool." />\n- <exit_code range="10" source="both" level="fatal" description="Wrong test ids." />\n- <exit_code range="20" source="both" level="fatal" description="Wrong feature ids." />\n- <exit_code range="30" source="both" level="fatal" description="Two scale thresholds selected for the same test and feature." />\n- <exit_code range="40" source="both" level="fatal" description="Scale threshold too high." />\n- <exit_code range="50" source="both" level="fatal" description="Group by \'test\' but selected features with different resolution." />\n- <exit_code range="60" source="both" level="fatal" description="Summary plot error. Please try again." />\n- <regex match="Error" source="both" level="fatal" description="An error has occurred. Please try again." />\n- </stdio>\n-\n- <command>\n-<![CDATA[\n- Rscript $__tool_directory__/plotwithscale.R adjustedpvalue="${adjustedpvalue}" iwtomicsrespdf="${iwtomicsrespdf}" iwtomicssumpdf="${iwtomicssumpdf}"\n- iwtomicsrdata="${rdata}"\n- iwtomicstests="${testids}"\n- iwtomicsselectedfeatures="${featureids}"\n-\n- #set test_subset = \'"\\\\|"\'.join( [ str( $e.test ) for $e in $scalesection.thresholdontestscale ] )\n- test_subset="${test_subset}"\n- #set feature_subset = \'"\\\\|"\'.join( [ str( $e.feature ) for $e in $scalesection.thresholdontestscale ] )\n- feature_subset="${feature_subset}"\n- #set scale_subset = \'","\'.join( [ str( $e.scale ) for $e in $scalesection.thresholdontestscale ] )\n- scale_subset="c(${scale_subset})"\n-\n- testalpha="${plotres.alpha}"\n- average="${plotres.average}"\n- size="${plotres.size}"\n- plottype="\'${plotres.conditionalplottype.plottype}\'"\n- #if $plotres.conditionalplottype.plottype == \'boxplot\':\n- #set probs = \'","\'.join( [ str( $p.prob ) for $p in $plotres.conditionalplottype.probabilitiessection.probabilities ] )\n- #if $probs != "":\n- probs="c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2},${probs})"\n- #else:\n- probs="c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2})"\n- #end if\n- #end if\n-\n- groupby="\'${plotsum.conditionalgroupby.groupby}\'"\n- #if $plotsum.conditionalgroupby.groupby == "test":\n- summaryalpha="${plotsum.conditionalgroupby.testalphaplot}"\n- only_significant="${plotsum.conditionalgroupby.testonlysig}"\n- #elif $plotsum.conditionalgroupby.groupby == "feature":\n- summaryalpha="${plotsum.conditionalgroupby.featurealphaplot}"\n- only_significant="${plotsum.conditionalgroupby.featureonlysig}"\n- #end if\n-\n- >& /dev/null\n-]]>\n- <!--\n- to print the stack add the following line at the end of the command and enable the corresponding entry in output\n- 2> "${stackerr}"\n- -->\n- </command>\n-\n- <inputs>\n- <help>\n- ...\n- </help>\n-\n- <!-- RData -->\n- <param format="rdata" name="rdata" type="data" label="Select IWTomicsData object with test results" help="File created by \'IWTomics Test and Plot\'." />\n- <!-- test IDs -->\n- <param format="tabular" name="testids" type="data" label="Select test IDs" help="File created by \'IWTomics Test and Plot\'." />\n- <!-- feature IDs -->\n- <param format="tabular" name="featureids" type="data" label="Select feature IDs" help="File created by \'IWTomics Test and Plot\'." />\n-\n- <!-- rep'..b'epeat>\n- </section>\n- </when>\n- </conditional>\n- </section>\n-\n- <!-- summary plot -->\n- <section name="plotsum" title="Summary plot" expanded="True">\n- <!-- conditional group by -->\n- <conditional name="conditionalgroupby">\n- <!-- group by -->\n- <param name="groupby" type="select" label="Group by" help="How tests should be grouped.">\n- <option value="none">No plot</option>\n- <option value="test">Group by test</option>\n- <option value="feature">Group by feature</option>\n- </param>\n- <when value="test">\n- <param name="testalphaplot" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />\n- <param name="testonlysig" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Plot only significant tests" />\n- </when>\n- <when value="feature">\n- <param name="featurealphaplot" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />\n- <param name="featureonlysig" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Plot only significant tests" />\n- </when>\n- </conditional>\n- </section>\n- </inputs>\n-\n- <outputs>\n- <!--<data format="txt" name="stackerr" label="iwtomics.testandplot.stackerr.txt" from_work_dir="iwtomics.testandplot.stackerr.txt" />-->\n- <data format="txt" name="adjustedpvalue" label="${tool.name} on ${on_string}: Adjusted p-value" from_work_dir="iwtomics.testandplot.adjustedpvalue.txt" />\n- <data format="pdf" name="iwtomicsrespdf" label="${tool.name} on ${on_string}: Plotted Test Results" from_work_dir="iwtomics.testandplot.iwtomicstestresults.pdf" />\n- <data format="pdf" name="iwtomicssumpdf" label="${tool.name} on ${on_string}: Summary Plot" from_work_dir="iwtomics.testandplot.summaryplot.pdf" />\n- </outputs>\n-\n- <help>\n-This tool allows to select the scale for the Interval-Wise Testing results. In particular, it returns the p-value curves\n-for the different tests performed at the selected scale, and it creates a graphical representation of the\n-Interval-Wise Testing results and a summary plot (optional) at the selected scale.\n-\n------\n-\n-**Input files**\n-\n-RData file with the IWTomicsData object with test results, tabular files with test IDs and feature IDs.\n-These files are created by the tool *IWTomics Test and Plot*.\n-\n------\n-\n-**Output**\n-\n-The tool returns:\n-\n-1. TXT file with an adjusted p-value curve for every test performed at the selected scale;\n-2. PDF file with the plotted test results;\n-3. PDF file with the summary plot.\n-\n------\n-\n-.. class:: infomark\n-\n-**Notes**\n-\n-This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA).\n-\n-It implements a simplified version of the function *IWTomicsTest*, *plotTest* and *plotSummary* for *IWTomicsData* objects.\n-The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_).\n-\n-.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf\n- </help>\n-\n- <citations>\n- <citation type="bibtex">\n- @ARTICLE{\n- iwt-functional-data,\n- author = {A Pini and S. Vantini},\n- title = {Interval-Wise Testing for functional data},\n- journal = {Journal of Nonparametric Statistics},\n- year = {2017},\n- volume = {29},\n- number = {2},\n- pages = {407-424}\n- }\n- </citation>\n- <citation type="bibtex">\n- @MANUAL{\n- iwtomics,\n- author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone},\n- title = {IWTomics: Interval-Wise Testing for Omics Data},\n- note = {R package version 0.99.12},\n- year = {2017}\n- }\n- </citation>\n- </citations>\n-\n-</tool>\n' |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/testandplot.R --- a/iwtomics/testandplot.R Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,99 +0,0 @@ -if (require("IWTomics",character.only = TRUE,quietly = FALSE)) { - args=commandArgs(TRUE) - - # get args names and values - args_values=strsplit(args,'=') - args_names=unlist(lapply(args_values,function(arg) arg[1])) - names(args_values)=args_names - args_values=lapply(args_values,function(arg) arg[2]) - # read filenames - adjustedpvaluematrix=args_values$adjustedpvaluematrix - iwtomicsrespdf=args_values$iwtomicsrespdf - iwtomicssumpdf=args_values$iwtomicssumpdf - regionids=args_values$regionids - featureids=args_values$featureids - rdatafile=args_values$rdatafile - iwtomicsrdata=args_values$iwtomicsrdata - iwtomicstests=args_values$iwtomicstests - iwtomicsselectedfeatures=args_values$iwtomicsselectedfeatures - # read parameters (from region1 on) - i_region1=which(args_names=='region1') - for(i in i_region1:length(args)){ - eval(parse(text=args[[i]])) - } - - # load RData - load(rdatafile) - # read regionids and featureids - regionids=as.character(read.delim(regionids,header=FALSE,sep='\t',stringsAsFactors=FALSE)) - featureids=as.character(read.delim(featureids,header=FALSE,sep='\t',stringsAsFactors=FALSE)) - # retrieve region1, region2 and features_subset ids and check they are in the RData - id_region1=regionids[region1] - id_region2=regionids[region2] - id_features_subset=featureids[features_subset] - if(length(setdiff(c(id_region1,id_region2),idRegions(regionsFeatures)))!=0){ - quit(save="no", status=10) - stop('Wrong region ids') - } - if(length(setdiff(id_features_subset,idFeatures(regionsFeatures)))!=0){ - quit(save="no", status=20) - stop('Wrong feature ids') - } - if(sum(duplicated(paste0(id_region1,id_region2)))){ - quit(save="no", status=30) - stop('Same test repeated multiple times.') - } - - # perform test - tryCatch({ - # fix repeated probs - if(statistics=='quantile'){ - # fix repeated probs - testprobs=sort(unique(testprobs)) - }else{ - testprobs=0.5 - } - regionsFeatures_test=IWTomicsTest(regionsFeatures,id_region1,id_region2,id_features_subset, - statistics=statistics,probs=testprobs,B=B) - # create adjustedvaluematrix output - for(test in seq_along(id_region1)){ - for(id_feature in id_features_subset){ - write(paste0('Test: ',id_region1[test],' vs ',id_region2[test],', on feature ',id_feature), - file=adjustedpvaluematrix,append=TRUE,sep='\t') - pval=regionsFeatures_test@test$result[[test]][[id_feature]]$adjusted_pval_matrix - row.names(pval)=paste('Scale',rev(seq_len(nrow(pval)))) - write.table(pval,file=adjustedpvaluematrix,append=TRUE,sep='\t',quote=FALSE,row.names=TRUE,col.names=FALSE) - write('',file=adjustedpvaluematrix,append=TRUE,sep='\t') - } - } - }, error = function(err) { - quit(save="no", status=40) #error testing - stop(err) - }) - - # plot test results - pdf(iwtomicsrespdf,width=5,height=7) - if(plottype=='boxplot'){ - # fix repeated probs - probs=sort(unique(probs)) - }else{ - probs=c(0.25,0.5,0.75) - } - plotTest(regionsFeatures_test,alpha=testalpha,type=plottype,probs=probs,average=average,size=size,ask=FALSE) - dev.off() - - # plot summary results - if(groupby!='none'){ - pdf(iwtomicssumpdf,width=15,height=10) - plotSummary(regionsFeatures_test,alpha=summaryalpha,only_significant=only_significant,groupby=groupby,ask=FALSE,append=TRUE) - dev.off() - } - - # create output - write.table(as.data.frame(t(paste(id_region1,'vs',id_region2))),file=iwtomicstests,quote=FALSE,sep='\t',row.names=FALSE,col.names=FALSE) - write.table(as.data.frame(t(idFeatures(regionsFeatures_test))),file=iwtomicsselectedfeatures,quote=FALSE,sep='\t',row.names=FALSE,col.names=FALSE) - save(regionsFeatures_test,file=iwtomicsrdata) -}else{ - quit(save="no", status=255) - stop("Missing IWTomics package") -} \ No newline at end of file |
b |
diff -r ed9594c25fad -r 81faa1567178 iwtomics/testandplot.xml --- a/iwtomics/testandplot.xml Wed May 31 11:06:00 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,239 +0,0 @@\n-<tool id="testandplot" name="IWTomics Test" version="@VERSION@.0">\n- <description>and Plot</description>\n- <macros>\n- <import>macros.xml</import>\n- </macros>\n- <expand macro="requirements" />\n- <stdio>\n- <exit_code range="-1" source="both" level="fatal" description="Missing IWTomics package. Please be sure to have it installed before using this tool." />\n- <exit_code range="10" source="both" level="fatal" description="Wrong region ids." />\n- <exit_code range="20" source="both" level="fatal" description="Wrong feature ids." />\n- <exit_code range="30" source="both" level="fatal" description="Same test repeated multiple times." />\n- <exit_code range="40" source="both" level="fatal" description="Testing error." />\n- <regex match="Error" source="both" level="fatal" description="An error has occurred. Please try again." />\n- </stdio>\n-\n- <command>\n-<![CDATA[\n- Rscript $__tool_directory__/testandplot.R adjustedpvaluematrix="${adjustedpvaluematrix}" iwtomicsrespdf="${iwtomicsrespdf}" iwtomicssumpdf="${iwtomicssumpdf}" iwtomicsrdata="${iwtomicsrdata}" iwtomicstests="${iwtomicstests}" iwtomicsselectedfeatures="${iwtomicsselectedfeatures}"\n- regionids="${regionids}"\n- featureids="${featureids}"\n- rdatafile="${rdata}"\n-\n- #set region1 = \'","\'.join( [ str( $r.region0 ) for $r in $regionssection.regions ] )\n- #set region2 = \'","\'.join( [ str( $r.region1 ) for $r in $regionssection.regions ] )\n- region1="c(${region1})"\n- region2="c(${region2})"\n-\n- features_subset="c(${featureslist})"\n-\n- statistics="\'${conditionalstatistics.statistics}\'"\n- #if $conditionalstatistics.statistics == "quantile":\n- #set probabilities = \'","\'.join( [ str( $p.qprob ) for $p in $conditionalstatistics.quantilesection.qprobabilities ] )\n- testprobs="c(${probabilities})"\n- #end if\n-\n- B="${permutations}"\n-\n- testalpha="${plotres.alpha}"\n- average="${plotres.average}"\n- size="${plotres.size}"\n- plottype="\'${plotres.conditionalplottype.plottype}\'"\n- #if $plotres.conditionalplottype.plottype == \'boxplot\':\n- #set probs = \'","\'.join( [ str( $p.prob ) for $p in $plotres.conditionalplottype.probabilitiessection.probabilities ] )\n- #if $probs != "":\n- probs="c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2},${probs})"\n- #else:\n- probs="c(${plotres.conditionalplottype.probabilitiessection.prob0},${plotres.conditionalplottype.probabilitiessection.prob1},${plotres.conditionalplottype.probabilitiessection.prob2})"\n- #end if\n- #end if\n-\n- groupby="\'${plotsum.conditionalgroupby.groupby}\'"\n- #if $plotsum.conditionalgroupby.groupby == "test":\n- summaryalpha="${plotsum.conditionalgroupby.testalphaplot}"\n- only_significant="${plotsum.conditionalgroupby.testonlysig}"\n- #elif $plotsum.conditionalgroupby.groupby == "feature":\n- summaryalpha="${plotsum.conditionalgroupby.featurealphaplot}"\n- only_significant="${plotsum.conditionalgroupby.featureonlysig}"\n- #end if\n-\n- >& /dev/null\n-]]>\n- <!--\n- to print the stack add the following line at the end of the command and enable the corresponding entry in output\n- 2> "${stackerr}"\n- -->\n- </command>\n-\n- <inputs>\n- <!-- RData -->\n- <param format="rdata" name="rdata" type="data" label="Select IWTomicsData object" help="File created by \'IWTomics Load Smooth and Plot\'." />\n- <!-- region IDs -->\n- <param format="tabular" name="regionids" type="data" label="Select region dataset IDs" help="File created by \'IWTomics Load Smooth and Plot\'." />\n- <!-- feature IDs -->\n- <param format="tabular" name="featureids" type="data" label="Select feature IDs" help="File created by \'IWTomics Load Smooth and Plot\'." />\n-\n- <!-- repeat region ids -->\n- <sectio'..b' </conditional>\n- </section>\n- </inputs>\n-\n- <outputs>\n- <!--<data format="txt" name="stackerr" label="iwtomics.testandplot.stackerr.txt" from_work_dir="iwtomics.testandplot.stackerr.txt" />-->\n- <data format="txt" name="adjustedpvaluematrix" label="${tool.name} on ${on_string}: Adjusted p-value Matrix" from_work_dir="iwtomics.testandplot.adjustedpvalue.matrix.txt" />\n- <data format="pdf" name="iwtomicsrespdf" label="${tool.name} on ${on_string}: Plotted Test Results" from_work_dir="iwtomics.testandplot.iwtomicstestresults.pdf" />\n- <data format="pdf" name="iwtomicssumpdf" label="${tool.name} on ${on_string}: Summary Plot" from_work_dir="iwtomics.testandplot.summaryplot.pdf" />\n- <data format="rdata" name="iwtomicsrdata" label="${tool.name} on ${on_string}: IWTomicsData Object with Test Results" from_work_dir="iwtomics.testandplot.RData" />\n- <data format="tabular" name="iwtomicstests" label="${tool.name} on ${on_string}: Test IDs" from_work_dir="iwtomics.testandplot.tests.txt" />\n- <data format="tabular" name="iwtomicsselectedfeatures" label="${tool.name} on ${on_string}: Feature IDs" from_work_dir="iwtomics.testandplot.selectedfeatures.txt" />\n- </outputs>\n-\n- <help>\n-This tool statistically evaluates differences in genomic features between groups of regions along the genome.\n-In particular, it implements the Interval-Wise Testing for omics data, an extended version of the Interval-Wise\n-Testing for functional data presented in Pini and Vantini (2017). It allows to perform multiple two sample permutation\n-tests between pairs of region datasets, on several features. It returns the adjusted p-value curves for every test\n-and all possible scales. Moreover, it creates a graphical representation of the Interval-Wise Testing results\n-and a summary plot (optional) with p-values at the maximum scale. The tool *IWTomics Plot with Threshold on Test Scale*\n-permits to select the scale to be used in the plots.\n-\n------\n-\n-**Input files**\n-\n-RData file with the IWTomicsData object, tabular files with region dataset IDs and feature IDs.\n-These files are created by the tool *IWTomics Load Smooth and Plot*.\n-\n------\n-\n-**Output**\n-\n-The tool returns:\n-\n-1. TXT file with an adjusted p-value matrix for every test performed. Each matrix contains a p-value curve (row) for every scale considered in the test;\n-2. PDF file with the plotted test results;\n-3. PDF file with the summary plot;\n-4. RData with the IWTomicsData object with the test results;\n-5. Test identifiers;\n-6. Feature identifiers.\n-\n-4-6 can be used as input of the tool *IWTomics Plot with Threshold on Test Scale*\n-\n------\n-\n-.. class:: infomark\n-\n-**Notes**\n-\n-This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA).\n-\n-It implements a simplified version of the function *IWTomicsTest*, *plotTest* and *plotSummary* for *IWTomicsData* objects.\n-The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_).\n-\n-.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf\n- </help>\n-\n- <citations>\n- <citation type="bibtex">\n- @ARTICLE{\n- iwt-functional-data,\n- author = {A Pini and S. Vantini},\n- title = {Interval-Wise Testing for functional data},\n- journal = {Journal of Nonparametric Statistics},\n- year = {2017},\n- volume = {29},\n- number = {2},\n- pages = {407-424}\n- }\n- </citation>\n- <citation type="bibtex">\n- @MANUAL{\n- iwtomics,\n- author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone},\n- title = {IWTomics: Interval-Wise Testing for Omics Data},\n- note = {R package version 0.99.12},\n- year = {2017}\n- }\n- </citation>\n- </citations>\n-\n-</tool>\n' |