changeset 13:c5aa9fca18c6 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 39bd480e8813fa7a96b640150365577a69885d17-dirty"
author galaxyp
date Sun, 29 Nov 2020 23:41:23 +0000
parents 10566783d718
children 1693b2126f30
files spectra_plots.xml test-data/Heatmaps_LM8_file16.pdf test-data/Heatmaps_analyze75.pdf test-data/Heatmaps_imzml.pdf test-data/Heatmaps_processed.pdf test-data/Heatmaps_rdata.pdf test-data/centroids_proc.pdf test-data/preprocessing_results1.ibd test-data/preprocessing_results1.imzml test-data/preprocessing_results1.imzml.txt test-data/preprocessing_results1.pdf test-data/preprocessing_results2.ibd test-data/preprocessing_results2.imzml test-data/preprocessing_results2.imzml.txt test-data/preprocessing_results2.pdf test-data/preprocessing_results3.ibd test-data/preprocessing_results3.imzml test-data/preprocessing_results3.imzml.txt test-data/preprocessing_results3.pdf
diffstat 19 files changed, 232 insertions(+), 156 deletions(-) [+]
line wrap: on
line diff
--- a/spectra_plots.xml	Tue Nov 03 23:11:11 2020 +0000
+++ b/spectra_plots.xml	Sun Nov 29 23:41:23 2020 +0000
@@ -1,4 +1,4 @@
-<tool id="cardinal_spectra_plots" name="MSI plot spectra" version="@VERSION@.1">
+<tool id="cardinal_spectra_plots" name="MSI plot spectra" version="@VERSION@.2">
     <description>
         mass spectrometry imaging mass spectra plots
     </description>
@@ -66,23 +66,20 @@
         ## read and extract x,y, optional annotation information
         spectra_tabular = read.delim("$pixel_conditional.pixel_file", header = $pixel_conditional.tabular_pixel_header, stringsAsFactors = FALSE)
 
-        #if $pixel_conditional.column_pixel_annotation:
+        #if str($pixel_conditional.single_or_overlaid.plot_type) == 'overlaid_plots':
 
-                spectra_input = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y, $pixel_conditional.column_pixel_annotation)]
+                spectra_input = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y, $pixel_conditional.single_or_overlaid.column_pixel_annotation)]
                 colnames(spectra_input) = c("x", "y", "annotation")
+                spectra_input\$annotation = as.character(spectra_input\$annotation)
 
-                input_pixels = paste(spectra_input[,1], spectra_input[,2], sep="_")
-                dataset_pixels = paste(coord(msidata)\$x, coord(msidata)\$y, sep="_")
-                pixelsofinterest = dataset_pixels %in% input_pixels
-                msidata = msidata[,pixelsofinterest]
+                msidata_coordinates = data.frame(coord(msidata)\$x, coord(msidata)\$y)
+                colnames(msidata_coordinates) = c("x", "y")
+                merged_annotation = merge(msidata_coordinates, spectra_input, by=c("x", "y"))
+                merged_annotation[is.na(merged_annotation)] = "NA"
 
-                ## merge with coordinate information of msidata
-                msidata_coordinates = data.frame(coord(msidata)\$x, coord(msidata)\$y, c(1:ncol(msidata)))
-                colnames(msidata_coordinates) = c("x", "y", "pixel_index")
-                merged_annotation = merge(msidata_coordinates, spectra_input, by=c("x", "y"), all.x=TRUE)
-                merged_annotation[is.na(merged_annotation)] = "NA"
-                merged_annotation = merged_annotation[order(merged_annotation\$pixel_index),]
-                msidata\$annotation = factor(merged_annotation[,4], levels = unique(as.character(merged_annotation[,4]))) ## keep the right order
+                merged_annotation = merged_annotation[order(merged_annotation\$annotation),]
+                msidata\$annotation = factor(merged_annotation\$annotation)
+
 
                     ## overview plot over annotated samples
                     number_combined = length(levels(msidata\$annotation))
@@ -100,7 +97,21 @@
                         legend_size = 6
                     }
 
-                    position_df = data.frame(coord(msidata)\$x, coord(msidata)\$y, as.factor(msidata\$annotation))
+                    ## colours selection:
+
+                    #if str($pixel_conditional.single_or_overlaid.colour_conditional.colour_type) == "manual_colour"
+                        #set $color_string = ','.join(['"%s"' % $color.annotation_color for $color in $pixel_conditional.single_or_overlaid.colour_conditional.colours])
+                        colourvector = c($color_string)
+
+                    #elif str($pixel_conditional.single_or_overlaid.colour_conditional.colour_type) == "colourpalette"
+
+                    number_levels = (length(levels(msidata\$annotation)))
+
+        	    colourvector = noquote($pixel_conditional.single_or_overlaid.colour_conditional.palettes)(number_levels)
+
+                    #end if
+
+                    position_df = merged_annotation
                     colnames(position_df) = c("x", "y", "sample_name")
 
                     combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
@@ -111,15 +122,18 @@
                            theme(plot.title = element_text(hjust = 0.5))+
                            theme(text=element_text(family="ArialMT", face="bold", size=12))+
                            theme(legend.position="bottom",legend.direction="vertical")+
-                           theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = 6))+
-                           guides(fill=guide_legend(ncol=4,byrow=TRUE))
+                           theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = 10))+
+                           guides(fill=guide_legend(ncol=4,byrow=TRUE))+
+                           scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector)
 
-                   coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass")
-                   coord_labels\$file_number = 1:length(levels(position_df\$sample_name))
+
+                       coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass")
+                       coord_labels\$file_number = 1:length(unique(position_df\$sample_name))
 
                     for(file_count in 1:nrow(coord_labels))
-                    {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
-                    y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
+                    	{combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
+                    	y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))
+                    }
 
                     print(combine_plot)
 
@@ -130,7 +144,7 @@
 
                 #if $fullmz:
                 ## plot single tabular mz, average per annotation
-                    print(plot(msidata, run="infile", pixel.groups=msidata\$annotation, key=key_legend, col=hue_pal()(length(levels(msidata\$annotation))),superpose=TRUE, strip=FALSE, grid=$grid_variable), main="Average spectrum per group")
+                    print(plot(msidata, run="infile", pixel.groups=msidata\$annotation, key=key_legend,superpose=TRUE, strip=FALSE, grid=$grid_variable, col = colourvector), main="Average spectrum per group")
                 #end if
 
                     pixeldf = data.frame(table(msidata\$annotation))
@@ -165,9 +179,10 @@
                     )   
 
                         ## plot single tabular mz, average per annotation, manual zoom
-                        print(plot(msidata[minmasspixel:maxmasspixel,], run="infile", strip=FALSE,
+
+                        print(plot(msidata[minmasspixel:maxmasspixel,], run="infile", strip=FALSE, col = colourvector,
                         xlim= c($token.xlimmin,$token.xlimmax),pixel.groups=msidata\$annotation, grid = $grid_variable,
-                        key=key_legend,col=hue_pal()(length(levels(msidata\$annotation))), superpose=TRUE, main="Average spectrum per group"))
+                        key=key_legend, superpose=TRUE, main="Average spectrum per group"))
                     #end for
 
                 #elif str($mz_range.mz_range_options) == "tabular_mz":
@@ -186,17 +201,18 @@
 
                             ## plot single tabular mz, average per annotation, tabular zoom
                             print(plot(msidata[minmasspixel:maxmasspixel,], run="infile", strip=FALSE, main="Average spectrum per group",
-                            xlim= c(xlimmin,xlimmax),pixel.groups=msidata\$annotation, grid = $grid_variable,
-                            key=key_legend,col=hue_pal()(length(levels(msidata\$annotation))), superpose=TRUE))
+                            xlim= c(xlimmin,xlimmax),pixel.groups=msidata\$annotation, grid = $grid_variable, col = colourvector,
+                            key=key_legend, superpose=TRUE))
+
                         }
                     }
 
                 #end if
+        #elif str($pixel_conditional.single_or_overlaid.plot_type) == 'separate_plots':
 
-        #elif str($pixel_conditional.column_pixel_annotation)== "None":
 
-                spectra_tabular = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y)]
-                colnames(spectra_tabular) = c("x", "y")
+            spectra_tabular = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y)]
+            colnames(spectra_tabular) = c("x", "y")
 
             dataset_pixels = data.frame(coord(msidata)\$x, coord(msidata)\$y)
             colnames(dataset_pixels) = c("x", "y")
@@ -261,7 +277,17 @@
                 }
 
                     ## print single tabular mz; manual zoom
-                    print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c($token.xlimmin,$token.xlimmax), col="black"))
+
+                    tryCatch(
+                        {
+                        print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c($token.xlimmin,$token.xlimmax), col="black"))
+                        }
+                        ,
+                        error=function(cond) {
+                        ## if there are no intensities > 0 in the chosen plotting window, write a warning
+                        text(0.5,0.5,labels = c(paste("No peaks in the spectrum with the coordinates x =", x_coord, ", y =", y_coord, sep=" ")))
+                        }
+                   )
 
                 #end for
 
@@ -456,17 +482,53 @@
         <expand macro="reading_msidata"/>
         <expand macro="pdf_filename"/>
         <conditional name="pixel_conditional">
-            <param name="pixel_type" type="select" label="Choose spectra (pixel) and/or add spectra annotations">
-                <option value="all_pixel" selected="True" >All spectra</option>
-                <option value="tabular_pixel">Single spectra</option>
+            <param name="pixel_type" type="select" label="Choose spectra">
+                <option value="all_pixel" selected="True" >Plot mean spectra based on all spectra</option>
+                <option value="tabular_pixel">Plot single spectra (separate or overlaid)</option>
             </param>
             <when value="tabular_pixel">
                 <param name="pixel_file" type="data" format="tabular" label="Load tabular file with pixel coordinates"
                 help="Two or three columns: x values, y values, optionally annotations"/>
                 <param name="column_pixel_x" data_ref="pixel_file" label="Column with x values" type="data_column"/>
                 <param name="column_pixel_y" data_ref="pixel_file" label="Column with y values" type="data_column"/>
-                <param name="column_pixel_annotation" data_ref="pixel_file" optional="True" label="Column with annotations" type="data_column"/>
                 <param name="tabular_pixel_header" type="boolean" label="Tabular files contain a header line" truevalue="TRUE" falsevalue="FALSE"/>
+                <conditional name="single_or_overlaid">
+		    <param name="plot_type" type="select" label="Separate plot per spectrum or overlaid plot with average spectra per annotation group">
+		        <option value="separate_plots" selected="True" >Separate spectra plots</option>
+		        <option value="overlaid_plots">Overlaid spectra plots</option>
+		    </param>
+		    <when value="separate_plots"/>
+		    <when value="overlaid_plots">
+		    <param name="column_pixel_annotation" data_ref="pixel_file" label="Select column with annotations" type="data_column"/>
+		    <conditional name="colour_conditional">
+		        <param name="colour_type" type="select" label="Choose a colour scheme">
+			    <option value="colourpalette" selected="True" >Colour palette</option>
+			    <option value="manual_colour">Manual selection</option>
+			</param>
+			<when value="manual_colour">
+			   <repeat name="colours" title="Colours for the plots" min="1" max="50">
+			   <param name="annotation_color" type="color" label="Colours" value="#ff00ff" help="Numbers of colours should be the same as number of components">
+			   <sanitizer>
+			       <valid initial="string.letters,string.digits">
+			       <add value="#" />
+			       </valid>
+			   </sanitizer>
+			   </param>
+			   </repeat>
+			</when>
+			<when value="colourpalette">
+			    <param name="palettes" type="select" display="radio" label="Select a colourpalette">
+			        <option value="hue_pal()" selected="True">hue</option>
+			        <option value="rainbow">rainbow</option>
+				<option value="heat.colors">heat colors</option>
+				<option value="terrain.colors">terrain colors</option>
+				<option value="topo.colors">topo colors</option>
+				<option value="cm.colors">cm colors</option>
+			    </param>
+			</when>
+		    </conditional>
+                    </when>
+                </conditional>
             </when>
             <when value="all_pixel">
             </when>
@@ -554,19 +616,33 @@
                 <param name="pixel_file" value="annotations.tabular"/>
                 <param name="column_pixel_x" value="1"/>
                 <param name="column_pixel_y" value="2"/>
-                <param name="column_pixel_annotation" value="4"/>
                 <param name="tabular_pixel_header" value="TRUE"/>
+
+                <conditional name="single_or_overlaid">
+                    <param name="plot_type" value="overlaid_plots"/>
+                    <param name="column_pixel_annotation" value="4"/>
+                    <param name="colour_type" value="manual_colour"/>
+                    <repeat name="colours">
+                        <param name="annotation_color" value="#0000FF"/>
+		    </repeat>
+		    <repeat name="colours">
+			<param name="annotation_color" value="#00C957"/>
+		    </repeat>
+		    <repeat name="colours">
+			<param name="annotation_color" value="#B0171F"/>
+		    </repeat>
+                </conditional>
             </conditional>
-                <param name="fullmz" value="FALSE"/>
-                <conditional name="mz_range">
-                    <param name="mz_range_options" value="manual_mz"/>
-                    <repeat name="zoomed_sample">
-                        <param name="xlimmin" value="1250"/>
-                        <param name="xlimmax" value="1270"/>
-                    </repeat>
-                </conditional>
-                <param name="grid_variable" value="FALSE"/>
-            <output name="plots" file="Plot_analyze75_allpixels.pdf" compare="sim_size"/>
+		<param name="fullmz" value="FALSE"/>
+		<conditional name="mz_range">
+		    <param name="mz_range_options" value="manual_mz"/>
+		    <repeat name="zoomed_sample">
+		        <param name="xlimmin" value="1250"/>
+		        <param name="xlimmax" value="1270"/>
+		    </repeat>
+		</conditional>
+		<param name="grid_variable" value="FALSE"/>
+	    <output name="plots" file="Plot_analyze75_allpixels.pdf" compare="sim_size"/>
         </test>
         <test>
             <param name="infile" value="3_files_combined.RData" ftype="rdata"/>
Binary file test-data/Heatmaps_LM8_file16.pdf has changed
Binary file test-data/Heatmaps_analyze75.pdf has changed
Binary file test-data/Heatmaps_imzml.pdf has changed
Binary file test-data/Heatmaps_processed.pdf has changed
Binary file test-data/Heatmaps_rdata.pdf has changed
Binary file test-data/centroids_proc.pdf has changed
Binary file test-data/preprocessing_results1.ibd has changed
--- a/test-data/preprocessing_results1.imzml	Tue Nov 03 23:11:11 2020 +0000
+++ b/test-data/preprocessing_results1.imzml	Sun Nov 29 23:41:23 2020 +0000
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="07177fdd-3760-4df6-8fe2-53d28b280ae8" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="749fe32c8243da06001cf4643c5ce4f1ef5a98a8" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="22bd3147-231d-4076-b6bd-67c1fa7c6ef3" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="831eba0fc850529d1351bcbb1baf779fe0773e1b" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -86,15 +86,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="36" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="48" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -115,15 +115,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="56" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="80" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -144,15 +144,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="76" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="112" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -173,15 +173,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="96" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="144" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -202,15 +202,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="116" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="176" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -231,15 +231,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="136" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="208" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -260,15 +260,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="156" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="240" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -289,15 +289,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="176" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="272" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -318,15 +318,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="196" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="304" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
--- a/test-data/preprocessing_results1.imzml.txt	Tue Nov 03 23:11:11 2020 +0000
+++ b/test-data/preprocessing_results1.imzml.txt	Sun Nov 29 23:41:23 2020 +0000
@@ -1,4 +1,4 @@
 imzML file:
 total 24
--rw-rw-r-- 1 meli meli   216 Oct  5 19:57 ibd
--rw-rw-r-- 1 meli meli 18090 Oct  5 19:57 imzml
+-rw-rw-r-- 1 meli meli   336 Nov 29 01:14 ibd
+-rw-rw-r-- 1 meli meli 18092 Nov 29 01:14 imzml
Binary file test-data/preprocessing_results1.pdf has changed
Binary file test-data/preprocessing_results2.ibd has changed
--- a/test-data/preprocessing_results2.imzml	Tue Nov 03 23:11:11 2020 +0000
+++ b/test-data/preprocessing_results2.imzml	Sun Nov 29 23:41:23 2020 +0000
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="503079b4-538a-4be6-b70d-e52542c66482" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="a597fe6a0184ef339105b3a932f58726a9af549b" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="ebbd9c5a-19a7-4db5-91e0-858065743606" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="471a838ffd01331ad8e6d23a59004e05745bf39c" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
--- a/test-data/preprocessing_results2.imzml.txt	Tue Nov 03 23:11:11 2020 +0000
+++ b/test-data/preprocessing_results2.imzml.txt	Sun Nov 29 23:41:23 2020 +0000
@@ -1,4 +1,4 @@
 imzML file:
 total 64
--rw-rw-r-- 1 meli meli 37404 Oct  5 19:57 ibd
--rw-rw-r-- 1 meli meli 22796 Oct  5 19:57 imzml
+-rw-rw-r-- 1 meli meli 37404 Nov 29 18:03 ibd
+-rw-rw-r-- 1 meli meli 22796 Nov 29 18:03 imzml
Binary file test-data/preprocessing_results2.pdf has changed
Binary file test-data/preprocessing_results3.ibd has changed
--- a/test-data/preprocessing_results3.imzml	Tue Nov 03 23:11:11 2020 +0000
+++ b/test-data/preprocessing_results3.imzml	Sun Nov 29 23:41:23 2020 +0000
@@ -9,9 +9,9 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="be549a7e-87af-4413-9b4c-27221f55ee9a" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="4ee7ca6fb3f60e1adbe196068f86bc3209bace58" />
-			<cvParam cvRef="IMS" accession="IMS:1000031" name="processed" value="" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="476b127d-a8e1-4595-aae9-e9245db50d28" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="8a36ea2658fcfc8cfa9ae4d0dd73cd7ed2f5b96f" />
+			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
 	<referenceableParamGroupList count="4">
@@ -86,15 +86,15 @@
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
 						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="64" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="80" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="16" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="64" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="160" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -114,16 +114,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="144" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="164" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="5" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="20" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="304" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -143,16 +143,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="184" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="18" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="72" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="256" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="18" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="72" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="448" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -172,16 +172,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="328" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="21" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="84" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="412" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="21" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="84" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="592" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -201,16 +201,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="496" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="4" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="512" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="4" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="736" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -230,16 +230,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="528" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="18" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="72" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="600" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="18" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="72" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="880" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -259,16 +259,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="672" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="17" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="68" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="740" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="17" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="68" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="1024" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -288,16 +288,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="808" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="840" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="8" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="32" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="1168" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
@@ -317,16 +317,16 @@
 				<binaryDataArrayList count="2">
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="mzArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="872" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="11" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="44" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="16" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 					<binaryDataArray encodedLength="0">
 						<referenceableParamGroupRef ref="intensityArray" />
-						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="916" />
-						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="11" />
-						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="44" />
+						<cvParam cvRef="IMS" accession="IMS:1000102" name="external offset" value="1312" />
+						<cvParam cvRef="IMS" accession="IMS:1000103" name="external array length" value="36" />
+						<cvParam cvRef="IMS" accession="IMS:1000104" name="external encoded length" value="144" />
 						<binary />
 					</binaryDataArray>
 				</binaryDataArrayList>
--- a/test-data/preprocessing_results3.imzml.txt	Tue Nov 03 23:11:11 2020 +0000
+++ b/test-data/preprocessing_results3.imzml.txt	Sun Nov 29 23:41:23 2020 +0000
@@ -1,4 +1,4 @@
 imzML file:
 total 24
--rw-rw-r-- 1 meli meli   960 Oct  5 19:58 ibd
--rw-rw-r-- 1 meli meli 18112 Oct  5 19:58 imzml
+-rw-rw-r-- 1 meli meli  1456 Nov 29 18:04 ibd
+-rw-rw-r-- 1 meli meli 18133 Nov 29 18:04 imzml
Binary file test-data/preprocessing_results3.pdf has changed