changeset 7:19d8eee15959 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5feaf3d0e0da8cef1241fecc1f4d6f81324594e6
author galaxyp
date Wed, 22 Aug 2018 13:41:16 -0400
parents f4aafc565aa3
children c6564ddf0744
files msi_combine.xml test-data/112_auto_combined_QC.pdf test-data/123_combined_QC.pdf test-data/12_combined_QC.pdf test-data/annotations_file1.tabular
diffstat 5 files changed, 25 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/msi_combine.xml	Tue Jul 24 04:52:39 2018 -0400
+++ b/msi_combine.xml	Wed Aug 22 13:41:16 2018 -0400
@@ -1,10 +1,10 @@
-<tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.4">
+<tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.5">
     <description>
         combine several mass spectrometry imaging datasets into one
     </description>
     <requirements>
         <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement>
-        <requirement type="package" version="2.2.1">r-ggplot2</requirement>
+        <requirement type="package" version="3.0.0">r-ggplot2</requirement>
     </requirements>
     <command detect_errors="exit_code">
     <![CDATA[
@@ -91,6 +91,13 @@
     ## read annotation tabular, set first two columns as x and y, merge with coordinates dataframe and order according to pixelorder in msidata
     input_annotation = read.delim("annotation_file_${i}.tabular", header = TRUE, 
         stringsAsFactors = FALSE)
+
+    if (class(input_annotation[,1]) == "character"){
+        annotation_coordinates = matrix(unlist(strsplit(as.character(input_annotation[,1]), "\\,")), ncol=2, byrow=TRUE)
+        annotation_coordinates2 = cbind(as.numeric(substring(annotation_coordinates[,1], 5, last = 1000000L)), as.numeric(substring(annotation_coordinates[,2], 5, last = 1000000L)))
+        input_annotation = cbind(annotation_coordinates2, input_annotation[,-1])
+    }
+
     colnames(input_annotation)[1:2] = c("x", "y")
     msidata_coordinates = cbind(coord(msidata_$i)[,1:2], 1:ncol(msidata_$i))
     colnames(msidata_coordinates)[3] = "pixel_index"
@@ -132,7 +139,7 @@
         #set escaped_element_identifier = re.sub('[^\w\-\s\[/]]', '_', str($infile.element_identifier)) ## use name of inputfile from Galaxy
         if (sum(spectra(msidata_$i)[],na.rm=TRUE)>0) ## use only valid files
         {
-            if (is.null(levels(msidata_$i\$combined_sample))) ### if the file was not combined before use input file name, otherwise keep combined_sample name which was assigned before
+            if (is.null(levels(msidata_$i\$combined_sample)))
             {
             names_vector = append(names_vector, rep(paste($i+1, "$escaped_element_identifier", sep="_"),ncol(msidata_$i)))
             msidata_$i\$combined_sample = as.factor(names_vector)
@@ -402,8 +409,8 @@
             </when>
         </conditional>
         <param name="annotation_files" type="data" multiple="true" format="tabular"
-            label="Pixel annotations as tabular files"
-            help="Tabular files should have the same order as input files"/>
+            label="Pixel annotations as tabular files, same number and order of files as input files"
+            help="Coordinates in column 1 in format x = 1, y = 1 or first column x values, second column y values. Up to 5 columns with pixel annotations"/>
         <conditional name="combine_conditional">
             <param name="combine_method" type="select" label="Select the way you want to combine multiple files" help="More detailed help can be found in the help section at the bottom">
                 <option value="automatic_combine" selected="True" >automatic combination</option>
@@ -441,7 +448,7 @@
             <output name="matrixasoutput" file="123_combined_matrix.tabular"/>
             <output name="annotation_output" file="123_annotation_output.tabular"/>
             <output name="msidata_combined" file="123_combined.RData" compare="sim_size" />
-            <output name="combining_qc" file="123_combined_QC.pdf" compare="sim_size" delta="20000"/>
+            <output name="combining_qc" file="123_combined_QC.pdf" compare="sim_size" delta="2000"/>
         </test>
         <test expect_num_outputs="4">
             <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/>
@@ -451,7 +458,7 @@
             <output name="matrixasoutput" file="12_combined_matrix.tabular"/>
             <output name="annotation_output" file="12_annotation_output.tabular"/>
             <output name="msidata_combined" file="12_combined.RData" compare="sim_size" />
-            <output name="combining_qc" file="12_combined_QC.pdf" compare="sim_size" delta="20000"/>
+            <output name="combining_qc" file="12_combined_QC.pdf" compare="sim_size" delta="2000"/>
         </test>
         <test expect_num_outputs="3">
             <param name="infiles" value="msidata_1.RData,123_combined.RData" ftype="rdata"/>
@@ -460,7 +467,7 @@
             <param name="output_matrix" value="False"/>
             <output name="annotation_output" file="112_annotation_output.tabular"/>
             <output name="msidata_combined" file="112_auto_combined.RData" compare="sim_size" />
-            <output name="combining_qc" file="112_auto_combined_QC.pdf" compare="sim_size" delta="20000"/>
+            <output name="combining_qc" file="112_auto_combined_QC.pdf" compare="sim_size" delta="2000"/>
         </test>
     </tests>
     <help>
Binary file test-data/112_auto_combined_QC.pdf has changed
Binary file test-data/123_combined_QC.pdf has changed
Binary file test-data/12_combined_QC.pdf has changed
--- a/test-data/annotations_file1.tabular	Tue Jul 24 04:52:39 2018 -0400
+++ b/test-data/annotations_file1.tabular	Wed Aug 22 13:41:16 2018 -0400
@@ -1,10 +1,10 @@
-X	Y	file_name	column_name
-1	1	file_one	col1
-1	2	file_one	col1
-1	3	file_one	col1
-2	1	file_one	col2
-2	2	file_one	col2
-2	3	file_one	col2
-3	1	file_one	col3
-3	2	file_one	col3
-3	3	file_one	col3
+pixels	file_name	column_name
+x = 1,y = 1	file_one	col1
+x = 1,y = 2	file_one	col1
+x = 1,y = 3	file_one	col1
+X = 2,y = 1	file_one	col2
+X = 2,y = 2	file_one	col2
+X = 2,y = 3	file_one	col2
+X = 3,y = 1	file_one	col3
+X = 3,y = 2	file_one	col3
+X = 3,y = 3	file_one	col3