# HG changeset patch # User fabio # Date 1496243190 14400 # Node ID 81faa1567178a2f4e13c3831392ab6c499385338 # Parent ed9594c25fad87450da195b83687880697ce8774 Deleted selected files diff -r ed9594c25fad -r 81faa1567178 iwtomics/.Rapp.history 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 @@ -1,3 +0,0 @@ -require(IWTomics) -require(pheatmap) -install.packages(pheatmap) diff -r ed9594c25fad -r 81faa1567178 iwtomics/._.DS_Store Binary file iwtomics/._.DS_Store has changed diff -r ed9594c25fad -r 81faa1567178 iwtomics/._ETn_example Binary file iwtomics/._ETn_example has changed diff -r ed9594c25fad -r 81faa1567178 iwtomics/._example Binary file iwtomics/._example has changed diff -r ed9594c25fad -r 81faa1567178 iwtomics/._loadandplot.R Binary file iwtomics/._loadandplot.R has changed diff -r ed9594c25fad -r 81faa1567178 iwtomics/._plotwithscale.R Binary file iwtomics/._plotwithscale.R has changed diff -r ed9594c25fad -r 81faa1567178 iwtomics/._testandplot.R Binary file iwtomics/._testandplot.R has changed 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 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 @@ -1,325 +0,0 @@ - - Smooth and Plot - - macros.xml - - - - - - - - - - - - - - - - - - - - -& /dev/null -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - -
-
-
-
-
- - - - - - - - - - -This tool imports a collection of genomic region datasets, and associates to each region -multiple genomic feature measurements. It allows to align the regions in multiple ways -(center, left, right or scale alignment), to smooth the feature curves (possibly filling gaps in the -measurements) and to create a graphical representation of the feature measurements in each -region datasets (aligned curves or pointwise quantile curves). - ------ - -**Region datasets** - -Each region dataset can be provided as a BED or Tabular file with tab delimited columns chr -start end (extra columns present in the input file are ignored). Regions can be of different -length:: - - chr2 49960150 50060150 - chr2 55912445 56012445 - ... - ------ - -**Feature measurements** - -Feature measurements corresponding to all the regions can be provided as a BED or Tabular -file with tab delimited columns chr start end value:: - - chr2 49960150 49962150 0.9426 - chr2 49962150 49964150 0.7816 - ... - -Each feature must be measured in windows of a fixed size inside all the regions (missing -values must be indicated as NA). Another way to import feature measurements is from a -Tabular file with the first three columns chr start end corresponding to the different genomic -regions, followed on the same row by all the measurements in fixed-size windows:: - - chr2 49960150 50060150 0.9426 0.7816 0.8921 ... ... 1.2063 - chr2 55912445 56012445 0.8719 0.9975 1.1619 ... ... 0.9601 - ... - ------ - -**Output** - -The tool returns: - -1. RData with the IWTomicsData object, that stores the aligned genomic region datasets, and their associated feature measurements; -2. Region dataset identifiers; -3. Feature identifiers; -4. PDF file with the plotted data. - -1-3 can be used as input of the tool *IWTomics Test and Plot* - ------ - -.. class:: infomark - -**Notes** - -This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA). - -It implements a simplified version of the methods *smooth* and *plot* for *IWTomicsData* objects. -The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_). - -.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf - - - - - @ARTICLE{ - iwt-functional-data, - author = {Pini, Alessia and Vantini, Simone}, - title = {Interval-Wise Testing for functional data}, - journal = {Journal of Nonparametric Statistics}, - year = {2017}, - volume = {29}, - number = {2}, - pages = {407-424} - } - - - @MANUAL{ - iwtomics, - author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone}, - title = {IWTomics: Interval-Wise Testing for Omics Data}, - note = {R package version 0.99.12}, - year = {2017} - } - - - -
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 @@ -1,9 +0,0 @@ - - 1.0.0 - - - R - bioconductor-iwtomics - - - \ No newline at end of file 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]] - on Test Scale - - macros.xml - - - - - - - - - - - - - - -& /dev/null -]]> - - - - - - ... - - - - - - - - - - -
- - - - - -
- - -
- - - - - - - - - - - - - - - -
- - - - - - -
-
-
-
- - -
- - - - - - - - - - - - - - - - - -
-
- - - - - - - - - -This tool allows to select the scale for the Interval-Wise Testing results. In particular, it returns the p-value curves -for the different tests performed at the selected scale, and it creates a graphical representation of the -Interval-Wise Testing results and a summary plot (optional) at the selected scale. - ------ - -**Input files** - -RData file with the IWTomicsData object with test results, tabular files with test IDs and feature IDs. -These files are created by the tool *IWTomics Test and Plot*. - ------ - -**Output** - -The tool returns: - -1. TXT file with an adjusted p-value curve for every test performed at the selected scale; -2. PDF file with the plotted test results; -3. PDF file with the summary plot. - ------ - -.. class:: infomark - -**Notes** - -This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA). - -It implements a simplified version of the function *IWTomicsTest*, *plotTest* and *plotSummary* for *IWTomicsData* objects. -The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_). - -.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf - - - - - @ARTICLE{ - iwt-functional-data, - author = {A Pini and S. Vantini}, - title = {Interval-Wise Testing for functional data}, - journal = {Journal of Nonparametric Statistics}, - year = {2017}, - volume = {29}, - number = {2}, - pages = {407-424} - } - - - @MANUAL{ - iwtomics, - author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone}, - title = {IWTomics: Interval-Wise Testing for Omics Data}, - note = {R package version 0.99.12}, - year = {2017} - } - - - - 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 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 @@ -1,239 +0,0 @@ - - and Plot - - macros.xml - - - - - - - - - - - - -& /dev/null -]]> - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - -
- - - -
-
-
- - - - - -
- - - - - - - - - - - - - - - -
- - - - - - -
-
-
-
- - -
- - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - -This tool statistically evaluates differences in genomic features between groups of regions along the genome. -In particular, it implements the Interval-Wise Testing for omics data, an extended version of the Interval-Wise -Testing for functional data presented in Pini and Vantini (2017). It allows to perform multiple two sample permutation -tests between pairs of region datasets, on several features. It returns the adjusted p-value curves for every test -and all possible scales. Moreover, it creates a graphical representation of the Interval-Wise Testing results -and a summary plot (optional) with p-values at the maximum scale. The tool *IWTomics Plot with Threshold on Test Scale* -permits to select the scale to be used in the plots. - ------ - -**Input files** - -RData file with the IWTomicsData object, tabular files with region dataset IDs and feature IDs. -These files are created by the tool *IWTomics Load Smooth and Plot*. - ------ - -**Output** - -The tool returns: - -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; -2. PDF file with the plotted test results; -3. PDF file with the summary plot; -4. RData with the IWTomicsData object with the test results; -5. Test identifiers; -6. Feature identifiers. - -4-6 can be used as input of the tool *IWTomics Plot with Threshold on Test Scale* - ------ - -.. class:: infomark - -**Notes** - -This Galaxy tool has been developed by Fabio Cumbo (Third University of Rome, Italy) and Marzia A. Cremona (The Pennsylvania State University, USA). - -It implements a simplified version of the function *IWTomicsTest*, *plotTest* and *plotSummary* for *IWTomicsData* objects. -The complete version can be found in the *R/Bioconductor* package *IWTomics* (see vignette_). - -.. _vignette: https://bioconductor.org/packages/release/bioc/vignettes/IWTomics/inst/doc/IWTomics.pdf - - - - - @ARTICLE{ - iwt-functional-data, - author = {A Pini and S. Vantini}, - title = {Interval-Wise Testing for functional data}, - journal = {Journal of Nonparametric Statistics}, - year = {2017}, - volume = {29}, - number = {2}, - pages = {407-424} - } - - - @MANUAL{ - iwtomics, - author = {Cremona, Marzia A and Pini, Alessia and Chiaromonte, Francesca and Vantini, Simone}, - title = {IWTomics: Interval-Wise Testing for Omics Data}, - note = {R package version 0.99.12}, - year = {2017} - } - - - -