Repository 'iwtomics_loadandplot'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/iwtomics_loadandplot

Changeset 0:0027f3287b34 (2017-08-04)
Next changeset 1:ee7dd07a530e (2017-10-06)
Commit message:
planemo upload for repository https://github.com/fabio-cumbo/IWTomics4Galaxy commit 90c984bb9f803e1531fe4cb670e876809d48d205
added:
loadandplot.R
loadandplot.xml
macros.xml
plotwithscale.R
test-data/input/Controls_regions.bed
test-data/input/Elements1_regions.bed
test-data/input/Elements2_regions.bed
test-data/input/Elements3_regions.bed
test-data/input/Feature1.bed
test-data/input/Feature2.bed
test-data/input/features.header.bed.txt
test-data/input/regions.header.txt
test-data/output_loadandplot/iwtomics.loadandplot.RData
test-data/output_loadandplot/iwtomics.loadandplot.features.txt
test-data/output_loadandplot/iwtomics.loadandplot.pdf
test-data/output_loadandplot/iwtomics.loadandplot.regions.txt
test-data/output_plotwithscale/iwtomics.plotwithscale.adjustedpvalue.txt
test-data/output_plotwithscale/iwtomics.plotwithscale.iwtomicstestresults.pdf
test-data/output_plotwithscale/iwtomics.plotwithscale.summaryplot.pdf
test-data/output_testandplot/iwtomics.testandplot.RData
test-data/output_testandplot/iwtomics.testandplot.adjustedpvalue.matrix.txt
test-data/output_testandplot/iwtomics.testandplot.iwtomicstestresults.pdf
test-data/output_testandplot/iwtomics.testandplot.selectedfeatures.txt
test-data/output_testandplot/iwtomics.testandplot.summaryplot.pdf
test-data/output_testandplot/iwtomics.testandplot.tests.txt
testandplot.R
b
diff -r 000000000000 -r 0027f3287b34 loadandplot.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loadandplot.R Fri Aug 04 17:50:39 2017 -0400
[
@@ -0,0 +1,144 @@
+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
+  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)))) {
+        write("IWTomics message: Not all region files are present in the first column of header file for regions.", stderr())
+        quit(save="no", status=11)
+      }
+      id_regions=regionsheader[regionsfilenames,1]
+      name_regions=regionsheader[regionsfilenames,2]
+    }, error = function(err) {
+      write("IWTomics message: An error has occurred reading the header file for regions. Please try again.", stderr())
+      quit(save="no", status=10) #error on header file
+    })
+  }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)))) {
+        write("IWTomics message: Not all feature files are present in the first column of header file for features.", stderr())
+        quit(save="no", status=21)
+      }
+      id_features=featuresheader[featuresfilenames,1]
+      name_features=featuresheader[featuresfilenames,2]
+    }, error = function(err) {
+      write("IWTomics message: An error has occurred reading the header file for features. Please try again.", stderr())
+      quit(save="no", status=20) #error on header file
+    })
+  }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)){
+      write("IWTomics message: Not enough columns in input file.", stderr())
+      quit(save="no", status=31) # error, not enough columns in input file
+    }else if(grepl('duplicated regions',err$message)){
+      write("IWTomics message: Duplicated regions in region file.", stderr())
+      quit(save="no", status=32) # error, duplicated regions in region file
+    }else if(grepl('duplicated windows',err$message)){
+      write("IWTomics message: Duplicated windows in feature file.", stderr())
+      quit(save="no", status=33) # error, duplicated windows in feature file
+    }else if(grepl('overlapping windows',err$message)){
+      write("IWTomics message: Overlapping windows in feature file.", stderr())
+      quit(save="no", status=34) # error, overlapping windows in feature file
+    }else if(grepl('not all regions in datasets',err$message)){
+      write("IWTomics message: Windows in feature files do not cover all regions in region files.", stderr())
+      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)){
+      write("IWTomics message: All windows in a feature file must have the same size.", stderr())
+      quit(save="no", status=36) # error, all windows in a feature files must have the same size
+    }
+    #error loading data
+    write("IWTomics message: An error has occurred reading the data. Please try again.", stderr())
+    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) {
+      write("IWTomics message: An error has occurred smoothing the data. Please try again.", stderr())
+      quit(save="no", status=40) #error on smoothing
+    })
+  }
+  
+  # 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{
+  write("IWTomics message: Missing IWTomics package. Please be sure to have it installed before using this tool.", stderr())
+  quit(save="no", status=255)
+}
\ No newline at end of file
b
diff -r 000000000000 -r 0027f3287b34 loadandplot.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loadandplot.xml Fri Aug 04 17:50:39 2017 -0400
[
b'@@ -0,0 +1,237 @@\n+<tool id="iwtomics_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+\n+  <command detect_errors="exit_code">\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 = $regionsheader\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 = $featuresheader\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+        bandwidth=\'${conditionaltype.locpolybandwidth}\'\n+        degree=\'${conditionaltype.locpolydegree}\'\n+        alignment="\'${conditionaltype.conditionalscale.alignment}\'"\n+      #elif $conditionaltype.smoothing == \'kernel\':\n+        bandwidth=\'${conditionaltype.kernelbandwidth}\'\n+        alignment="\'${conditionaltype.conditionalscale.alignment}\'"\n+      #elif $conditionaltype.smoothing == \'splines\':\n+        degree=\'${conditionaltype.splinesdegree}\'\n+        dist_knots=\'${conditionaltype.splinesdistknots}\'\n+        alignment="\'${conditionaltype.conditionalscale.alignment}\'"\n+      #end if\n+\n+      #if $conditionaltype.smoothing != \'no\':\n+        #if $conditionaltype.conditionalscale.alignment == \'scale\':\n+          scale=\'${conditionaltype.conditionalscale.scalegrid}\'\n+          fill_gaps=\'TRUE\'\n+        #else\n+          fill_gaps=\'${conditionaltype.conditionalscale.fillgaps}\'\n+        #end if\n+      #end if\n+\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+  </command>\n+\n+  <inputs>\n+    <!-- regions -->\n+    <param format="tabular" name="regions" type="data" label="Select region files" multiple="true" help="" />\n+    <param format="tabular" name="regionsheader" type="data" label="Insert header file for regions (optional)" optional="true" help="Tabular file. Column 1: names of the region files; Column 2: unique identifiers of the region datasets (spaces and special characters are not allowed); Column 3: name of the region datasets to be used in the output." />\n+\n+    <!-- features -->\n+    <param format="tabular" nam'..b'put/Elements1_regions.bed,input/Elements2_regions.bed,input/Elements3_regions.bed" ftype="bed" />\n+      <param name="regionsheader" value="input/regions.header.txt" ftype="tabular" />\n+      <param name="features" value="input/Feature1.bed,input/Feature2.bed" ftype="bed" />\n+      <param name="featuresheader" value="input/features.header.bed.txt" ftype="tabular" />\n+      <param name="zerobased" value="TRUE" />\n+      <param name="smoothing" value="kernel" />\n+      <param name="alignment" value="center" />\n+      <param name="kernelbandwidth" value="5" />\n+      <param name="fillgaps" value="TRUE" />\n+      <param name="average" value="TRUE" />\n+      <param name="size" value="TRUE" />\n+      <param name="plottype" value="boxplot" />\n+      <param name="prob0" value="0.25" />\n+      <param name="prob1" value="0.5" />\n+      <param name="prob2" value="0.75" />\n+      <output name="outrdata" file="output_loadandplot/iwtomics.loadandplot.RData" compare="sim_size" />\n+      <output name="outregions" file="output_loadandplot/iwtomics.loadandplot.regions.txt" />\n+      <output name="outfeatures" file="output_loadandplot/iwtomics.loadandplot.features.txt" />\n+      <output name="outpdf" file="output_loadandplot/iwtomics.loadandplot.pdf" compare="sim_size" />\n+    </test>\n+  </tests>\n+\n+  <help><![CDATA[\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 - fabio.cumbo@iasi.cnr.it) and Marzia A. Cremona (The Pennsylvania State University, USA - mac78@psu.edu).\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+\n+Example data can be found at:\n+\n+1. Simulated_data_\n+2. ETn_data_\n+\n+.. _Simulated_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-example\n+.. _ETn_data: https://usegalaxy.org/u/fabio-cumbo/h/iwtomics-etn-example\n+  ]]></help>\n+\n+  <expand macro="citations" />\n+\n+</tool>\n'
b
diff -r 000000000000 -r 0027f3287b34 macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,105 @@
+<macros>
+    <token name="@VERSION@">1.0.0</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@VERSION@">bioconductor-iwtomics</requirement>
+        </requirements>
+    </xml>
+    
+    <xml name="alignment-s">
+        <conditional name="conditionalscale">
+            <param name="alignment" type="select" label="Region alignment" help="">
+                <option value="center">Center - Alignment on the central position</option>
+                <option value="left">Left - Alignment on the starting position</option>
+                <option value="right">Right - Alignment on the ending position</option>
+                <option value="scale">Scale - Scaling all regions to the same length</option>
+            </param>
+            <when value="center">
+                <!-- fill gaps -->
+                <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
+            </when>
+            <when value="left">
+                <!-- fill gaps -->
+                <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
+            </when>
+            <when value="right">
+                <!-- fill gaps -->
+                <param name="fillgaps" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Use smoothing to fill gaps (NA measurements)" help="" />
+            </when>
+            <when value="scale">
+                <param name="scalegrid" type="integer" value="0" min="0" label="Number of grid points" help="Number of equally-spaced grid points over which the smoothed curves are evaluated." />
+            </when>
+        </conditional>
+    </xml>
+
+    <xml name="alignment">
+        <param name="alignment" type="select" label="Region alignment" help="">
+            <option value="center">Center - Alignment on the central position</option>
+            <option value="left">Left - Alignment on the starting position</option>
+            <option value="right">Right - Alignment on the ending position</option>
+        </param>
+    </xml>
+
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1080/10485252.2017.1306627</citation>
+            <citation type="bibtex">
+                @MANUAL{
+                        iwtomics,
+                        author = {Cremona, M.A. and Pini, A. and Chiaromonte, F. and Vantini, S.},
+                        title = {IWTomics: Interval-Wise Testing for Omics Data},
+                        note = {R package version 1.0.0},
+                        year = {2017}
+                }
+            </citation>
+        </citations>
+    </xml>
+
+    <xml name="plot-params">
+        <!-- average -->
+        <param name="average" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot the mean curves" />
+        <!-- average -->
+        <param name="size" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="True" label="Plot sample size in each position" />
+        <!-- conditional plot type -->
+        <conditional name="conditionalplottype">
+            <!-- plot type -->
+            <param name="plottype" type="select" label="Plot type">
+            <option value="boxplot">Pointwise quantile curves (boxplot)</option>
+            <option value="curves">Curves (aligned)</option>
+            </param>
+            <!-- conditional choice: plottype=boxplot -->
+            <when value="boxplot">
+            <section name="probabilitiessection" title="Probabilities" expanded="True" help="Probabilities corresponding to the quantile curves to be drawn.">
+                <param name="prob0" size="3" type="float" value="0.25" min="0.0" max="1.0" label="Probability" />
+                <param name="prob1" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
+                <param name="prob2" size="3" type="float" value="0.75" min="0.0" max="1.0" label="Probability" />
+                <repeat name="probabilities" title="Probabilities">
+                <param name="prob" size="3" type="float" value="0.5" min="0.0" max="1.0" label="Probability" />
+                </repeat>
+            </section>
+            </when>
+        </conditional>
+    </xml>
+
+    <xml name="plot-sum">
+        <section name="plotsum" title="Summary plot" expanded="True">
+            <!-- conditional group by -->
+            <conditional name="conditionalgroupby">
+                <!-- group by -->
+                <param name="groupby" type="select" label="Group by" help="How tests should be grouped.">
+                <option value="none">No plot</option>
+                <option value="test">Group by test</option>
+                <option value="feature">Group by feature</option>
+                </param>
+                <when value="test">
+                <param name="testalphaplot" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />
+                <param name="testonlysig" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Plot only significant tests" />
+                </when>
+                <when value="feature">
+                <param name="featurealphaplot" size="3" type="float" value="0.05" min="0.0" max="1.0" label="Level of the test (alpha)" />
+                <param name="featureonlysig" type="boolean" truevalue="TRUE" falsevalue="FALSE" label="Plot only significant tests" />
+                </when>
+            </conditional>
+        </section>
+    </xml>
+</macros>
b
diff -r 000000000000 -r 0027f3287b34 plotwithscale.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plotwithscale.R Fri Aug 04 17:50:39 2017 -0400
[
@@ -0,0 +1,117 @@
+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))){
+    write("Wrong test ids.", stderr())
+    quit(save="no", status=10)
+  }
+  if(sum(featureids!=idFeatures(regionsFeatures_test))){
+    write("Wrong feature ids.", stderr())
+    quit(save="no", status=20)
+  }
+  # retrieve test and features_subset ids
+  id_features_subset=featureids[feature_subset]
+  if(sum(duplicated(paste0(test_subset,id_features_subset)))){
+    write("Two scale thresholds selected for the same test and feature.", stderr())
+    quit(save="no", status=30)
+  }
+  # 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]){
+      write("Scale threshold too high.", stderr())
+      quit(save="no", status=40)
+    }
+    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)) {
+        write("Group by 'test' but selected features with different resolution.", stderr())
+        quit(save="no", status=50) #error: groupby 'test' but selected features with different resolution.
+      }
+      write("Summary plot error. Please try again.", stderr())
+      quit(save="no", status=60) #error 
+    })
+  }
+  
+}else{
+  write("Missing IWTomics package. Please be sure to have it installed before using this tool.", stderr())
+  quit(save="no", status=255)
+}
\ No newline at end of file
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/Controls_regions.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/Controls_regions.bed Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,35 @@
+chr1 91399892 91499892
+chr1 116447079 116547079
+chr2 231381109 231481109
+chr3 47386633 47486633
+chr3 99195712 99295712
+chr3 116765114 116865114
+chr3 134345017 134445017
+chr4 68064019 68164019
+chr4 137465811 137565811
+chr4 173293016 173393016
+chr5 59044110 59144110
+chr5 94592763 94692763
+chr5 108436006 108536006
+chr5 110836898 110936898
+chr5 146661073 146761073
+chr6 99727306 99827306
+chr7 88291325 88391325
+chr7 120999784 121099784
+chr8 126860366 126960366
+chr8 127636547 127736547
+chr11 41362564 41462564
+chr11 101741527 101841527
+chr12 15210277 15310277
+chr13 91106037 91206037
+chr13 91518822 91618822
+chr13 98959030 99059030
+chr15 39087176 39187176
+chr17 58542142 58642142
+chr18 12199823 12299823
+chr20 8173704 8273704
+chr21 16255112 16355112
+chr21 45089115 45189115
+chrX 23898983 23998983
+chrX 37029585 37129585
+chrX 103593349 103693349
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/Elements1_regions.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/Elements1_regions.bed Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,25 @@
+chr2 49960150 50060150
+chr2 55912445 56012445
+chr3 140326750 140426750
+chr4 41772201 41872201
+chr4 70629719 70729719
+chr4 109340735 109440735
+chr5 15025389 15125389
+chr5 43028888 43128888
+chr5 58231354 58331354
+chr5 91277761 91377761
+chr5 119464508 119564508
+chr6 85309170 85409170
+chr6 85762072 85862072
+chr6 134621363 134721363
+chr6 147470164 147570164
+chr7 77195798 77295798
+chr7 77880914 77980914
+chr7 114805399 114905399
+chr10 46350885 46450885
+chr10 67833078 67933078
+chr12 27722692 27822692
+chr12 95518506 95618506
+chr12 117863466 117963466
+chr14 100464166 100564166
+chrX 29266748 29366748
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/Elements2_regions.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/Elements2_regions.bed Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,20 @@
+chr1 65942901 66042901
+chr1 117128102 117228102
+chr1 190338169 190438169
+chr2 227365478 227465478
+chr6 50856764 50956764
+chr6 135703067 135803067
+chr7 38228726 38328726
+chr7 51115898 51215898
+chr7 150325760 150425760
+chr8 25475691 25575691
+chr9 73374609 73474609
+chr11 55092625 55192625
+chr11 86581661 86681661
+chr12 12795284 12895284
+chr12 48151882 48251882
+chr12 83109951 83209951
+chr15 31430278 31530278
+chr15 65610815 65710815
+chr17 40766223 40866223
+chr20 17245048 17345048
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/Elements3_regions.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/Elements3_regions.bed Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,28 @@
+chr1 49721616 49821616
+chr1 95059425 95159425
+chr1 207236313 207336313
+chr2 73790843 73890843
+chr3 134465321 134565321
+chr4 43433669 43533669
+chr4 122032777 122132777
+chr5 12701747 12801747
+chr5 58501529 58601529
+chr5 152853250 152953250
+chr6 136085023 136185023
+chr6 147019529 147119529
+chr7 14192964 14292964
+chr7 125519883 125619883
+chr8 77652872 77752872
+chr8 108375665 108475665
+chr9 2984971 3084971
+chr10 978822 1078822
+chr11 18395046 18495046
+chr12 47273592 47373592
+chr12 60095778 60195778
+chr12 84854096 84954096
+chr12 95157539 95257539
+chr14 23982000 24082000
+chr16 1875335 1975335
+chr16 66789863 66889863
+chr18 64644131 64744131
+chr21 15966609 16066609
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/Feature1.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/Feature1.bed Fri Aug 04 17:50:39 2017 -0400
b
b'@@ -0,0 +1,5400 @@\n+chr1\t91399892\t91401892\t0.914729028492568\n+chr1\t91401892\t91403892\t1.03788669317729\n+chr1\t91403892\t91405892\t1.15695078809331\n+chr1\t91405892\t91407892\t1.05433971377051\n+chr1\t91407892\t91409892\t1.05827244724317\n+chr1\t91409892\t91411892\t1.00216117481117\n+chr1\t91411892\t91413892\t0.873489001753337\n+chr1\t91413892\t91415892\t0.873100412116323\n+chr1\t91415892\t91417892\t0.928712683217515\n+chr1\t91417892\t91419892\t0.94132562114723\n+chr1\t91419892\t91421892\t1.06739894033636\n+chr1\t91421892\t91423892\t0.909275169317382\n+chr1\t91423892\t91425892\t1.10093887463398\n+chr1\t91425892\t91427892\t1.05342912580018\n+chr1\t91427892\t91429892\t0.970074712768588\n+chr1\t91429892\t91431892\t0.742552329847752\n+chr1\t91431892\t91433892\t1.09649292566553\n+chr1\t91433892\t91435892\t0.902578291528885\n+chr1\t91435892\t91437892\t0.821718064516058\n+chr1\t91437892\t91439892\t0.909063175846949\n+chr1\t91439892\t91441892\t1.12598647717153\n+chr1\t91441892\t91443892\t0.962991989888592\n+chr1\t91443892\t91445892\t0.886361985680751\n+chr1\t91445892\t91447892\t1.19735794895968\n+chr1\t91447892\t91449892\t1.1058589065373\n+chr1\t91449892\t91451892\t1.11830938343819\n+chr1\t91451892\t91453892\t0.891849450289035\n+chr1\t91453892\t91455892\t0.921613352575372\n+chr1\t91455892\t91457892\t0.961394603438276\n+chr1\t91457892\t91459892\t0.942120540462845\n+chr1\t91459892\t91461892\t1.04179227745858\n+chr1\t91461892\t91463892\t0.846036296260439\n+chr1\t91463892\t91465892\t0.903782108017989\n+chr1\t91465892\t91467892\t0.926324469715607\n+chr1\t91467892\t91469892\t1.01617788108211\n+chr1\t91469892\t91471892\t1.01871994841433\n+chr1\t91471892\t91473892\t0.86346600407464\n+chr1\t91473892\t91475892\t0.911534382002842\n+chr1\t91475892\t91477892\t0.909397860657818\n+chr1\t91477892\t91479892\t0.882437981483481\n+chr1\t91479892\t91481892\t1.20022730271379\n+chr1\t91481892\t91483892\t1.02286707465404\n+chr1\t91483892\t91485892\t1.00824959158441\n+chr1\t91485892\t91487892\t1.13387236604912\n+chr1\t91487892\t91489892\t0.917808428397605\n+chr1\t91489892\t91491892\t1.00980153326694\n+chr1\t91491892\t91493892\t1.0780078042687\n+chr1\t91493892\t91495892\t1.05789211157318\n+chr1\t91495892\t91497892\t0.983519376160091\n+chr1\t91497892\t91499892\t1.06301499098899\n+chr1\t116447079\t116449079\t0.909510507890661\n+chr1\t116449079\t116451079\t1.04923486926106\n+chr1\t116451079\t116453079\t0.972429435962863\n+chr1\t116453079\t116455079\t0.94348509718749\n+chr1\t116455079\t116457079\t0.877213727110183\n+chr1\t116457079\t116459079\t1.07609955711144\n+chr1\t116459079\t116461079\t1.05964706503259\n+chr1\t116461079\t116463079\t1.08048074104999\n+chr1\t116463079\t116465079\t1.10397643608295\n+chr1\t116465079\t116467079\t0.879172377236955\n+chr1\t116467079\t116469079\t0.952455624542298\n+chr1\t116469079\t116471079\t0.872450868701435\n+chr1\t116471079\t116473079\t0.734632500870684\n+chr1\t116473079\t116475079\t0.975852194327443\n+chr1\t116475079\t116477079\t1.15968481779916\n+chr1\t116477079\t116479079\t1.03479249038231\n+chr1\t116479079\t116481079\t0.958716780567544\n+chr1\t116481079\t116483079\t1.00882150410174\n+chr1\t116483079\t116485079\t0.894048456447358\n+chr1\t116485079\t116487079\t0.862250242465922\n+chr1\t116487079\t116489079\t1.08563273479841\n+chr1\t116489079\t116491079\t1.03570610668607\n+chr1\t116491079\t116493079\t1.282637134762\n+chr1\t116493079\t116495079\t1.05344881721884\n+chr1\t116495079\t116497079\t0.958843714832433\n+chr1\t116497079\t116499079\t0.907730747212707\n+chr1\t116499079\t116501079\t0.964823764805327\n+chr1\t116501079\t116503079\t0.972508803669119\n+chr1\t116503079\t116505079\t0.964761127498888\n+chr1\t116505079\t116507079\t1.21022463445566\n+chr1\t116507079\t116509079\t0.870817357520223\n+chr1\t116509079\t116511079\t0.970216007864307\n+chr1\t116511079\t116513079\t1.09860269791989\n+chr1\t116513079\t116515079\t1.01985884672516\n+chr1\t116515079\t116517079\t1.04151199469522\n+chr1\t116517079\t116519079\t1.10542491108645\n+chr1\t116519079\t116521079\t1.06697958402493\n+chr1\t116521079\t116523079\t0.972137682316022\n+chr1\t116523079\t116525079\t0.900068042346903\n+chr1\t116525079\t116527079\t1.00945179072767\n+chr1\t116527079\t116529079\t0.910760202377398\n+chr1\t116529079\t116531079\t0.960315923931081\n+chr1\t116531079\t116533079\t1.05558603806716\n+chr1\t116533079\t116535079\t0.92038544115'..b'1\t64656131\t0.97369678388939\n+chr18\t64656131\t64658131\t0.910087798040937\n+chr18\t64658131\t64660131\t0.946468289624316\n+chr18\t64660131\t64662131\t1.05842665628809\n+chr18\t64662131\t64664131\t0.927667349376235\n+chr18\t64664131\t64666131\t1.18742333150313\n+chr18\t64666131\t64668131\t1.22205250380213\n+chr18\t64668131\t64670131\t0.880563425486305\n+chr18\t64670131\t64672131\t0.914485239144026\n+chr18\t64672131\t64674131\t1.01034737175594\n+chr18\t64674131\t64676131\t1.62264521151304\n+chr18\t64676131\t64678131\t1.48296645852995\n+chr18\t64678131\t64680131\t1.28681962535927\n+chr18\t64680131\t64682131\t1.53492939742228\n+chr18\t64682131\t64684131\t1.58844790171606\n+chr18\t64684131\t64686131\t1.49033262314301\n+chr18\t64686131\t64688131\t1.31424965988202\n+chr18\t64688131\t64690131\t1.45337032575317\n+chr18\t64690131\t64692131\t1.35217898213701\n+chr18\t64692131\t64694131\t1.77532370910719\n+chr18\t64694131\t64696131\t1.60398303218395\n+chr18\t64696131\t64698131\t1.69307164801575\n+chr18\t64698131\t64700131\t1.54229556388787\n+chr18\t64700131\t64702131\t1.68106575665579\n+chr18\t64702131\t64704131\t1.48714225361666\n+chr18\t64704131\t64706131\t1.55224087444918\n+chr18\t64706131\t64708131\t1.3662045024589\n+chr18\t64708131\t64710131\t1.57624355139023\n+chr18\t64710131\t64712131\t1.44378437443185\n+chr18\t64712131\t64714131\t1.37811537520723\n+chr18\t64714131\t64716131\t1.06551636789331\n+chr18\t64716131\t64718131\t1.04029846172777\n+chr18\t64718131\t64720131\t1.1012560789095\n+chr18\t64720131\t64722131\t1.16248797408295\n+chr18\t64722131\t64724131\t1.10209650363972\n+chr18\t64724131\t64726131\t1.12702540883185\n+chr18\t64726131\t64728131\t1.06158233209566\n+chr18\t64728131\t64730131\t1.24500209867534\n+chr18\t64730131\t64732131\t0.834309455846338\n+chr18\t64732131\t64734131\t0.757289730474966\n+chr18\t64734131\t64736131\t1.10451816307643\n+chr18\t64736131\t64738131\t0.92262846294503\n+chr18\t64738131\t64740131\t0.804253155660302\n+chr18\t64740131\t64742131\t1.00162039935745\n+chr18\t64742131\t64744131\t0.956034285823398\n+chr21\t15966609\t15968609\t1.12440801594939\n+chr21\t15968609\t15970609\t0.958928874609379\n+chr21\t15970609\t15972609\t0.980859325447667\n+chr21\t15972609\t15974609\t0.985836855465142\n+chr21\t15974609\t15976609\t0.924304227149342\n+chr21\t15976609\t15978609\t0.981319441090073\n+chr21\t15978609\t15980609\t0.949853799394529\n+chr21\t15980609\t15982609\t0.858050928062694\n+chr21\t15982609\t15984609\t0.836178837413462\n+chr21\t15984609\t15986609\t1.20633196613812\n+chr21\t15986609\t15988609\t0.969230627046025\n+chr21\t15988609\t15990609\t1.06120061342825\n+chr21\t15990609\t15992609\t0.88573302960608\n+chr21\t15992609\t15994609\t0.987056692659576\n+chr21\t15994609\t15996609\t1.05266019775439\n+chr21\t15996609\t15998609\t1.29745136461899\n+chr21\t15998609\t16000609\t1.3631797211261\n+chr21\t16000609\t16002609\t1.58553521861437\n+chr21\t16002609\t16004609\t1.47800659441217\n+chr21\t16004609\t16006609\t1.75042011315262\n+chr21\t16006609\t16008609\t1.39329136735319\n+chr21\t16008609\t16010609\t1.57255744319984\n+chr21\t16010609\t16012609\t1.20929102513908\n+chr21\t16012609\t16014609\t1.53853232166312\n+chr21\t16014609\t16016609\t1.64985481461386\n+chr21\t16016609\t16018609\t1.59575749789367\n+chr21\t16018609\t16020609\t1.42205668994404\n+chr21\t16020609\t16022609\t1.66053802113289\n+chr21\t16022609\t16024609\t1.70386086339594\n+chr21\t16024609\t16026609\t1.73541878893467\n+chr21\t16026609\t16028609\t1.39682491364686\n+chr21\t16028609\t16030609\t1.43336589770868\n+chr21\t16030609\t16032609\t1.63386317242737\n+chr21\t16032609\t16034609\t1.53233925104548\n+chr21\t16034609\t16036609\t1.53952241603109\n+chr21\t16036609\t16038609\t1.28074961173938\n+chr21\t16038609\t16040609\t1.27922409248079\n+chr21\t16040609\t16042609\t0.962647373836482\n+chr21\t16042609\t16044609\t0.950807449539781\n+chr21\t16044609\t16046609\t1.19549845149275\n+chr21\t16046609\t16048609\t1.03462200267827\n+chr21\t16048609\t16050609\t0.952643344080609\n+chr21\t16050609\t16052609\t1.20946321219477\n+chr21\t16052609\t16054609\t0.965927027586426\n+chr21\t16054609\t16056609\t0.976116334675594\n+chr21\t16056609\t16058609\t1.07756004404963\n+chr21\t16058609\t16060609\t0.987244607153093\n+chr21\t16060609\t16062609\t1.04620355385428\n+chr21\t16062609\t16064609\t1.02761240862396\n+chr21\t16064609\t16066609\t0.870263755617609\n'
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/Feature2.bed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/Feature2.bed Fri Aug 04 17:50:39 2017 -0400
b
b'@@ -0,0 +1,5400 @@\n+chr1\t91399892\t91401892\t4.52457845989749\n+chr1\t91401892\t91403892\t4.69885317507985\n+chr1\t91403892\t91405892\t3.62988338998133\n+chr1\t91405892\t91407892\t4.45623107548837\n+chr1\t91407892\t91409892\t4.59364249841659\n+chr1\t91409892\t91411892\t5.70905494693032\n+chr1\t91411892\t91413892\t2.42812136492091\n+chr1\t91413892\t91415892\t3.21325702299381\n+chr1\t91415892\t91417892\t5.83146415223743\n+chr1\t91417892\t91419892\t4.145234941891\n+chr1\t91419892\t91421892\t5.61198015818556\n+chr1\t91421892\t91423892\t3.64586797215646\n+chr1\t91423892\t91425892\t6.20636700257446\n+chr1\t91425892\t91427892\t6.24535453369189\n+chr1\t91427892\t91429892\t5.45642255152577\n+chr1\t91429892\t91431892\t2.25812560771762\n+chr1\t91431892\t91433892\t4.85449016203815\n+chr1\t91433892\t91435892\t3.90115956418853\n+chr1\t91435892\t91437892\t4.73358990127742\n+chr1\t91437892\t91439892\t5.10493877711061\n+chr1\t91439892\t91441892\t6.26626452775677\n+chr1\t91441892\t91443892\t4.50874633533701\n+chr1\t91443892\t91445892\t5.70230938739608\n+chr1\t91445892\t91447892\t5.94455591845681\n+chr1\t91447892\t91449892\t4.52518856675072\n+chr1\t91449892\t91451892\t4.63848705114735\n+chr1\t91451892\t91453892\t4.34603429138827\n+chr1\t91453892\t91455892\t3.03830118655551\n+chr1\t91455892\t91457892\t6.03275619780653\n+chr1\t91457892\t91459892\t5.68223277080844\n+chr1\t91459892\t91461892\t5.50525041823675\n+chr1\t91461892\t91463892\t4.5213830572052\n+chr1\t91463892\t91465892\t5.50133572404842\n+chr1\t91465892\t91467892\t4.91055078504098\n+chr1\t91467892\t91469892\t4.05752990001426\n+chr1\t91469892\t91471892\t5.10897499920239\n+chr1\t91471892\t91473892\t5.43128593940068\n+chr1\t91473892\t91475892\t4.86148316107809\n+chr1\t91475892\t91477892\t4.48947054967865\n+chr1\t91477892\t91479892\t4.04898383490831\n+chr1\t91479892\t91481892\t5.68808370629557\n+chr1\t91481892\t91483892\t3.38402935045047\n+chr1\t91483892\t91485892\t4.55469509198871\n+chr1\t91485892\t91487892\t5.54674749210028\n+chr1\t91487892\t91489892\t6.80643757003305\n+chr1\t91489892\t91491892\t4.36576921982342\n+chr1\t91491892\t91493892\t4.78762392440088\n+chr1\t91493892\t91495892\t4.7968645329394\n+chr1\t91495892\t91497892\t5.2766452300238\n+chr1\t91497892\t91499892\t4.11389723526811\n+chr1\t116447079\t116449079\t3.50479481019937\n+chr1\t116449079\t116451079\t5.80805807123363\n+chr1\t116451079\t116453079\t4.84431415016648\n+chr1\t116453079\t116455079\t3.05704665156576\n+chr1\t116455079\t116457079\t4.08848780835827\n+chr1\t116457079\t116459079\t5.09637693701485\n+chr1\t116459079\t116461079\t5.69818646616106\n+chr1\t116461079\t116463079\t4.19878801898032\n+chr1\t116463079\t116465079\t4.5516661398769\n+chr1\t116465079\t116467079\t4.2453176706507\n+chr1\t116467079\t116469079\t4.67523653585105\n+chr1\t116469079\t116471079\t3.95251471557774\n+chr1\t116471079\t116473079\t4.96923766290807\n+chr1\t116473079\t116475079\t4.96920479716357\n+chr1\t116475079\t116477079\t5.02676539089313\n+chr1\t116477079\t116479079\t5.00052315566\n+chr1\t116479079\t116481079\t4.16809348391652\n+chr1\t116481079\t116483079\t4.59306360967521\n+chr1\t116483079\t116485079\t3.53563628215594\n+chr1\t116485079\t116487079\t4.50469161954188\n+chr1\t116487079\t116489079\t5.56857122702899\n+chr1\t116489079\t116491079\t4.58351619746089\n+chr1\t116491079\t116493079\t4.25823600023412\n+chr1\t116493079\t116495079\t5.90593508834324\n+chr1\t116495079\t116497079\t4.75083460476364\n+chr1\t116497079\t116499079\t2.771628447275\n+chr1\t116499079\t116501079\t3.55096260651244\n+chr1\t116501079\t116503079\t6.17656545119289\n+chr1\t116503079\t116505079\t4.36022614599567\n+chr1\t116505079\t116507079\t3.07947070495695\n+chr1\t116507079\t116509079\t6.00325415448973\n+chr1\t116509079\t116511079\t4.75152529713703\n+chr1\t116511079\t116513079\t4.63430887067622\n+chr1\t116513079\t116515079\t6.20396270678022\n+chr1\t116515079\t116517079\t4.10708349972204\n+chr1\t116517079\t116519079\t6.37204838467736\n+chr1\t116519079\t116521079\t4.20892327541064\n+chr1\t116521079\t116523079\t5.26217726205883\n+chr1\t116523079\t116525079\t4.98426282331262\n+chr1\t116525079\t116527079\t4.54088329611304\n+chr1\t116527079\t116529079\t6.19908300654713\n+chr1\t116529079\t116531079\t4.13307018130982\n+chr1\t116531079\t116533079\t4.81616315789755\n+chr1\t116533079\t116535079\t4.45075212625821\n+chr1\t116535079\t116537079\t5.3278384644649\n+chr1\t11'..b'1\t3.7169759268732\n+chr18\t64654131\t64656131\t5.25442380932218\n+chr18\t64656131\t64658131\t7.45772820471094\n+chr18\t64658131\t64660131\t5.48095406750538\n+chr18\t64660131\t64662131\t3.62733589187025\n+chr18\t64662131\t64664131\t4.55331693366933\n+chr18\t64664131\t64666131\t6.8774312824165\n+chr18\t64666131\t64668131\t5.2001203442027\n+chr18\t64668131\t64670131\t4.95990659880495\n+chr18\t64670131\t64672131\t4.02077893319017\n+chr18\t64672131\t64674131\t4.05668535153819\n+chr18\t64674131\t64676131\t4.23509896158418\n+chr18\t64676131\t64678131\t4.23418796991892\n+chr18\t64678131\t64680131\t5.45699681002164\n+chr18\t64680131\t64682131\t5.19535591598228\n+chr18\t64682131\t64684131\t6.0555950876448\n+chr18\t64684131\t64686131\t3.54284284855037\n+chr18\t64686131\t64688131\t5.0657204197487\n+chr18\t64688131\t64690131\t4.61156619971275\n+chr18\t64690131\t64692131\t4.66622025797826\n+chr18\t64692131\t64694131\t5.34521271919367\n+chr18\t64694131\t64696131\t9.87597953863361\n+chr18\t64696131\t64698131\t7.05091406041253\n+chr18\t64698131\t64700131\t8.00182216055189\n+chr18\t64700131\t64702131\t7.91390780851007\n+chr18\t64702131\t64704131\t6.60478767008177\n+chr18\t64704131\t64706131\t8.42205253797048\n+chr18\t64706131\t64708131\t8.4092636416611\n+chr18\t64708131\t64710131\t7.33893411142367\n+chr18\t64710131\t64712131\t6.44977234209029\n+chr18\t64712131\t64714131\t6.14212509408095\n+chr18\t64714131\t64716131\t7.33470365201403\n+chr18\t64716131\t64718131\t6.14466300830508\n+chr18\t64718131\t64720131\t6.28759018496124\n+chr18\t64720131\t64722131\t6.13121264285508\n+chr18\t64722131\t64724131\t6.25464222302313\n+chr18\t64724131\t64726131\t6.22857474092805\n+chr18\t64726131\t64728131\t6.7164061474755\n+chr18\t64728131\t64730131\t7.71694797882967\n+chr18\t64730131\t64732131\t6.47134532938063\n+chr18\t64732131\t64734131\t5.44078856911433\n+chr18\t64734131\t64736131\t6.72171185147245\n+chr18\t64736131\t64738131\t7.45623695140267\n+chr18\t64738131\t64740131\t6.66053173863693\n+chr18\t64740131\t64742131\t7.26582262622926\n+chr18\t64742131\t64744131\t7.26639325298473\n+chr21\t15966609\t15968609\t3.61661096782077\n+chr21\t15968609\t15970609\t4.73386208722406\n+chr21\t15970609\t15972609\t5.8015549021153\n+chr21\t15972609\t15974609\t4.96167153907388\n+chr21\t15974609\t15976609\t3.95102647749112\n+chr21\t15976609\t15978609\t3.97020922833049\n+chr21\t15978609\t15980609\t5.33786080501161\n+chr21\t15980609\t15982609\t4.36434578068312\n+chr21\t15982609\t15984609\t5.80198476623914\n+chr21\t15984609\t15986609\t5.35739211903602\n+chr21\t15986609\t15988609\t6.08746983525949\n+chr21\t15988609\t15990609\t4.34773396054126\n+chr21\t15990609\t15992609\t5.13949591522979\n+chr21\t15992609\t15994609\t3.73402272260864\n+chr21\t15994609\t15996609\t5.39450798275315\n+chr21\t15996609\t15998609\t5.55466043086729\n+chr21\t15998609\t16000609\t5.28998031818056\n+chr21\t16000609\t16002609\t6.19329925730006\n+chr21\t16002609\t16004609\t2.67150074437477\n+chr21\t16004609\t16006609\t5.16423939358034\n+chr21\t16006609\t16008609\t4.69609507505699\n+chr21\t16008609\t16010609\t5.44942073640721\n+chr21\t16010609\t16012609\t6.03847400860453\n+chr21\t16012609\t16014609\t5.97649168698122\n+chr21\t16014609\t16016609\t5.36013704359642\n+chr21\t16016609\t16018609\t7.92817462773764\n+chr21\t16018609\t16020609\t7.69377454814871\n+chr21\t16020609\t16022609\t8.80647396276848\n+chr21\t16022609\t16024609\t8.52452119781362\n+chr21\t16024609\t16026609\t7.89462789559928\n+chr21\t16026609\t16028609\t6.13805198380259\n+chr21\t16028609\t16030609\t4.64531272265593\n+chr21\t16030609\t16032609\t6.29826676008479\n+chr21\t16032609\t16034609\t7.79487866360525\n+chr21\t16034609\t16036609\t7.31994055340419\n+chr21\t16036609\t16038609\t8.8004479775322\n+chr21\t16038609\t16040609\t8.25854856063076\n+chr21\t16040609\t16042609\t5.04576860851306\n+chr21\t16042609\t16044609\t7.30730130969012\n+chr21\t16044609\t16046609\t7.83870783306589\n+chr21\t16046609\t16048609\t7.63074529828173\n+chr21\t16048609\t16050609\t6.43100021814285\n+chr21\t16050609\t16052609\t7.27551387601485\n+chr21\t16052609\t16054609\t6.26545170591659\n+chr21\t16054609\t16056609\t7.12562466213381\n+chr21\t16056609\t16058609\t6.26895239202312\n+chr21\t16058609\t16060609\t7.3992370168724\n+chr21\t16060609\t16062609\t7.97487587946482\n+chr21\t16062609\t16064609\t6.76355670816454\n+chr21\t16064609\t16066609\t6.11742019669001\n'
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/features.header.bed.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/features.header.bed.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,2 @@
+Feature1.bed ftr1 Feature 1
+Feature2.bed ftr2 Feature 2
\ No newline at end of file
b
diff -r 000000000000 -r 0027f3287b34 test-data/input/regions.header.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input/regions.header.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,4 @@
+Elements1_regions.bed elem1 Elements 1
+Elements2_regions.bed elem2 Elements 2
+Elements3_regions.bed elem3 Elements 3
+Controls_regions.bed control Controls
\ No newline at end of file
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_loadandplot/iwtomics.loadandplot.RData
b
Binary file test-data/output_loadandplot/iwtomics.loadandplot.RData has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_loadandplot/iwtomics.loadandplot.features.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_loadandplot/iwtomics.loadandplot.features.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,1 @@
+ftr1 ftr2
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_loadandplot/iwtomics.loadandplot.pdf
b
Binary file test-data/output_loadandplot/iwtomics.loadandplot.pdf has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_loadandplot/iwtomics.loadandplot.regions.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_loadandplot/iwtomics.loadandplot.regions.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,1 @@
+control elem1 elem2 elem3
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_plotwithscale/iwtomics.plotwithscale.adjustedpvalue.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_plotwithscale/iwtomics.plotwithscale.adjustedpvalue.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,18 @@
+Test: elem1 vs control, on feature ftr1
+Scale 10 0.337 0.492 0.718 0.884 0.954 0.966 0.966 0.966 0.966 0.979 0.979 0.979 0.979 0.966 0.948 0.886 0.817 0.813 0.839 0.889 0.947 0.983 0.97 0.97 0.935 0.777 0.554 0.362 0.457 0.681 0.84 0.904 0.904 0.904 0.904 0.904 0.884 0.884 0.889 0.884 0.852 0.752 0.691 0.802 0.905 0.995 0.995 0.937 0.817 0.688
+
+Test: elem1 vs control, on feature ftr2
+Scale 20 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
+
+Test: elem2 vs control, on feature ftr1
+Scale 50 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
+
+Test: elem2 vs control, on feature ftr2
+Scale 20 0.989 0.937 0.845 0.759 0.644 0.545 0.545 0.583 0.739 0.802 0.805 0.801 0.801 0.819 0.801 0.696 0.598 0.561 0.653 0.733 0.829 0.899 0.918 0.918 0.918 0.918 0.926 0.926 0.926 0.926 0.965 0.926 0.922 0.922 0.922 0.98 0.922 0.922 0.922 0.922 0.922 0.922 0.922 0.929 0.922 0.922 0.922 0.922 0.922 0.922
+
+Test: elem3 vs control, on feature ftr1
+Scale 50 0.756 0.756 0.644 0.644 0.662 0.823 0.943 1 0.986 0.927 0.806 0.488 0.117 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.186 0.698 0.885 0.732 0.602 0.474 0.381 0.381 0.455 0.607 0.822 0.822 0.689
+
+Test: elem3 vs control, on feature ftr2
+Scale 20 0.914 0.914 0.914 0.917 0.925 0.949 0.925 0.925 0.925 0.925 0.941 0.941 0.925 0.925 0.925 0.925 0.925 0.925 0.907 0.9 0.9 0.9 0.792 0.181 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
+
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_plotwithscale/iwtomics.plotwithscale.iwtomicstestresults.pdf
b
Binary file test-data/output_plotwithscale/iwtomics.plotwithscale.iwtomicstestresults.pdf has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_plotwithscale/iwtomics.plotwithscale.summaryplot.pdf
b
Binary file test-data/output_plotwithscale/iwtomics.plotwithscale.summaryplot.pdf has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_testandplot/iwtomics.testandplot.RData
b
Binary file test-data/output_testandplot/iwtomics.testandplot.RData has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_testandplot/iwtomics.testandplot.adjustedpvalue.matrix.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_testandplot/iwtomics.testandplot.adjustedpvalue.matrix.txt Fri Aug 04 17:50:39 2017 -0400
b
b'@@ -0,0 +1,312 @@\n+Test: elem1 vs control, on feature ftr1\n+Scale 50\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.808\t0.808\t0.808\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 49\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.808\t0.808\t0.808\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 48\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.808\t0.808\t0.808\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 47\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.808\t0.808\t0.808\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 46\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.808\t0.808\t0.808\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 45\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.808\t0.808\t0.808\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 44\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.804\t0.804\t0.804\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 43\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.793\t0.793\t0.793\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 42\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.775\t0.775\t0.787\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 41\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.759\t0.759\t0.787\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 40\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.758\t0.758\t0.787\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 39\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.758\t0.758\t0.787\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.884\t0.867\t0.867\t0.867\t0.867\t0.905\t0.995\t0.995\t0.937\t0.867\t0.827\n+Scale 38\t0.706\t0.806\t0.903\t0.945\t0.954\t0.966\t0.966\t0.966\t0.966\t0.979\t0.979\t0.979\t0.979\t0.966\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.954\t0.983\t0.97\t0.97\t0.954\t0.943\t0.863\t0.758\t0.758\t0.787\t0.855\t0.904\t0.904\t0.904\t0.904\t0.904\t0.884\t0.884\t0.889\t0.'..b'0.001\t0.001\t0.001\t0.001\n+Scale 13\t0.852\t0.852\t0.852\t0.882\t0.923\t0.949\t0.923\t0.923\t0.923\t0.923\t0.941\t0.941\t0.923\t0.923\t0.923\t0.923\t0.923\t0.92\t0.871\t0.841\t0.841\t0.835\t0.654\t0.092\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 12\t0.837\t0.837\t0.837\t0.863\t0.898\t0.949\t0.915\t0.915\t0.915\t0.915\t0.941\t0.941\t0.915\t0.915\t0.915\t0.915\t0.915\t0.893\t0.853\t0.832\t0.832\t0.819\t0.603\t0.078\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 11\t0.81\t0.81\t0.82\t0.853\t0.883\t0.949\t0.89\t0.89\t0.89\t0.89\t0.941\t0.941\t0.89\t0.89\t0.89\t0.89\t0.895\t0.878\t0.842\t0.818\t0.813\t0.774\t0.562\t0.07\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 10\t0.778\t0.778\t0.802\t0.838\t0.883\t0.949\t0.883\t0.883\t0.883\t0.883\t0.941\t0.941\t0.883\t0.88\t0.88\t0.88\t0.895\t0.878\t0.839\t0.798\t0.756\t0.732\t0.528\t0.064\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 9\t0.743\t0.743\t0.763\t0.827\t0.883\t0.949\t0.883\t0.883\t0.883\t0.883\t0.941\t0.941\t0.883\t0.88\t0.88\t0.88\t0.895\t0.878\t0.805\t0.737\t0.708\t0.708\t0.517\t0.051\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 8\t0.724\t0.724\t0.724\t0.782\t0.866\t0.949\t0.875\t0.875\t0.875\t0.88\t0.941\t0.941\t0.88\t0.88\t0.88\t0.88\t0.895\t0.858\t0.75\t0.697\t0.697\t0.697\t0.499\t0.038\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 7\t0.71\t0.71\t0.71\t0.731\t0.826\t0.949\t0.861\t0.861\t0.861\t0.88\t0.941\t0.941\t0.863\t0.863\t0.863\t0.863\t0.895\t0.801\t0.695\t0.685\t0.685\t0.685\t0.436\t0.029\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 6\t0.681\t0.671\t0.671\t0.695\t0.78\t0.949\t0.823\t0.823\t0.823\t0.88\t0.941\t0.941\t0.859\t0.82\t0.82\t0.824\t0.895\t0.74\t0.667\t0.667\t0.667\t0.632\t0.349\t0.023\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 5\t0.681\t0.622\t0.63\t0.669\t0.759\t0.949\t0.822\t0.767\t0.813\t0.88\t0.941\t0.941\t0.859\t0.801\t0.756\t0.824\t0.895\t0.74\t0.653\t0.634\t0.608\t0.545\t0.306\t0.015\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 4\t0.681\t0.622\t0.588\t0.655\t0.759\t0.949\t0.822\t0.734\t0.787\t0.88\t0.941\t0.941\t0.859\t0.773\t0.738\t0.824\t0.895\t0.74\t0.638\t0.569\t0.564\t0.545\t0.278\t0.009\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 3\t0.681\t0.622\t0.588\t0.599\t0.759\t0.949\t0.822\t0.726\t0.706\t0.88\t0.941\t0.941\t0.859\t0.672\t0.738\t0.824\t0.895\t0.74\t0.567\t0.512\t0.564\t0.545\t0.234\t0.006\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 2\t0.681\t0.622\t0.5\t0.5\t0.717\t0.949\t0.822\t0.578\t0.586\t0.784\t0.941\t0.941\t0.759\t0.534\t0.611\t0.824\t0.895\t0.662\t0.45\t0.47\t0.564\t0.545\t0.158\t0.002\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+Scale 1\t0.681\t0.553\t0.434\t0.417\t0.582\t0.949\t0.66\t0.476\t0.513\t0.664\t0.889\t0.868\t0.592\t0.461\t0.487\t0.708\t0.895\t0.512\t0.342\t0.402\t0.564\t0.494\t0.074\t0.002\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\t0.001\n+\n'
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_testandplot/iwtomics.testandplot.iwtomicstestresults.pdf
b
Binary file test-data/output_testandplot/iwtomics.testandplot.iwtomicstestresults.pdf has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_testandplot/iwtomics.testandplot.selectedfeatures.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_testandplot/iwtomics.testandplot.selectedfeatures.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,1 @@
+ftr1 ftr2
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_testandplot/iwtomics.testandplot.summaryplot.pdf
b
Binary file test-data/output_testandplot/iwtomics.testandplot.summaryplot.pdf has changed
b
diff -r 000000000000 -r 0027f3287b34 test-data/output_testandplot/iwtomics.testandplot.tests.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/output_testandplot/iwtomics.testandplot.tests.txt Fri Aug 04 17:50:39 2017 -0400
b
@@ -0,0 +1,1 @@
+elem1 vs control elem2 vs control elem3 vs control
b
diff -r 000000000000 -r 0027f3287b34 testandplot.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testandplot.R Fri Aug 04 17:50:39 2017 -0400
[
@@ -0,0 +1,99 @@
+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){
+    write("Wrong region ids.", stderr())
+    quit(save="no", status=10)
+  }
+  if(length(setdiff(id_features_subset,idFeatures(regionsFeatures)))!=0){
+    write("Wrong feature ids.", stderr())
+    quit(save="no", status=20)
+  }
+  if(sum(duplicated(paste0(id_region1,id_region2)))){
+    write("Same test repeated multiple times.", stderr())
+    quit(save="no", status=30)
+  }
+  
+  # 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) {
+    write("Testing error.", stderr())
+    quit(save="no", status=40) #error testing
+  })
+  
+  # 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{
+  write("Missing IWTomics package. Please be sure to have it installed before using this tool.", stderr())
+  quit(save="no", status=255)
+}
\ No newline at end of file