changeset 15:23d0394b5908 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit c8d3adac445b4e08e2724e22d7201bfc38bbf40f"
author galaxyp
date Sun, 29 Aug 2021 07:30:21 +0000
parents 5a35e3a8d013
children fde8ba3a0766
files macros.xml quality_report.xml test-data/QC_imzml_shortreport.pdf test-data/pixels_test6.tabular test-data/preprocessing_results4.ibd test-data/preprocessing_results4.imzml test-data/preprocessing_results4.imzml.txt test-data/preprocessing_results4.pdf test-data/test1.pdf test-data/test2.pdf test-data/test3.pdf test-data/test4.pdf test-data/test5.pdf test-data/test6.pdf test-data/test6.rdata test-data/test7.pdf test-data/test7.rdata
diffstat 17 files changed, 245 insertions(+), 200 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Wed Dec 23 22:36:04 2020 +0000
+++ b/macros.xml	Sun Aug 29 07:30:21 2021 +0000
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@VERSION@">2.6.0</token>
+    <token name="@VERSION@">2.10.0</token>
 
     <xml name="requirements">
         <requirements>
--- a/quality_report.xml	Wed Dec 23 22:36:04 2020 +0000
+++ b/quality_report.xml	Sun Aug 29 07:30:21 2021 +0000
@@ -1,4 +1,4 @@
-<tool id="cardinal_quality_report" name="MSI Qualitycontrol" version="@VERSION@.1">
+<tool id="cardinal_quality_report" name="MSI Qualitycontrol" version="@VERSION@.0">
     <description>
         mass spectrometry imaging QC
     </description>
@@ -7,9 +7,9 @@
     </macros>
     <expand macro="requirements">
         <requirement type="package" version="2.3">r-gridextra</requirement>
-        <requirement type="package" version="3.3.2">r-ggplot2</requirement>
+        <requirement type="package" version="3.3.5">r-ggplot2</requirement>
         <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>
-        <requirement type="package" version="2.23_17">r-kernsmooth</requirement>
+        <requirement type="package" version="2.23_20">r-kernsmooth</requirement>
         <requirement type="package" version="1.1.1">r-scales</requirement>
         <requirement type="package" version="1.0.12">r-pheatmap</requirement>
     </expand>
@@ -359,24 +359,29 @@
     #end if
 
     #################### 4) m/z heatmaps #######################################
-    par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0)
-    if (length(inputcalibrants[,1]) != 0){
-        for (mass in 1:length(inputcalibrants[,1])){
-            par(oma=c(0,0,0,1))## margin for image legend
+   
+    #if $report_depth:
+       
+		par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0)
+		if (length(inputcalibrants[,1]) != 0){
+		for (mass in 1:length(inputcalibrants[,1])){
+			par(oma=c(0,0,0,1))## margin for image legend
 
-           tryCatch(
-                        {
-                        print(image(msidata, mz=inputcalibrants[,1][mass], plusminus=plusminusvalues[mass], 
-            main= paste0(inputcalibrants[,2][mass], ": ", round(inputcalibrants[,1][mass], digits = 2)," (±",$plusminus_ppm, " ppm)"),
-            contrast.enhance = "histogram", strip=FALSE, ylim= c(maximumy,minimumy)))
-                        },
-                        error=function(cond) {
-                        ## if there are not enough intensities in the mz range skip creating an image
-                        print(paste0("Not enough intensities > 0 for m/z ", inputcalibrants[,1][mass]))
-                        }
-                    )    
-        }
-    } else {print("4) The input peptide and calibrant m/z were not provided or outside the m/z range")}
+		   tryCatch(
+				{
+				print(image(msidata, mz=inputcalibrants[,1][mass], plusminus=plusminusvalues[mass], 
+			main= paste0(inputcalibrants[,2][mass], ": ", round(inputcalibrants[,1][mass], digits = 2)," (±",$plusminus_ppm, " ppm)"),
+			contrast.enhance = "histogram", strip=FALSE, ylim= c(maximumy,minimumy)))
+				},
+				error=function(cond) {
+				## if there are not enough intensities in the mz range skip creating an image
+				print(paste0("Not enough intensities > 0 for m/z ", inputcalibrants[,1][mass]))
+				}
+				)    
+		}
+		} else {print("4) The input peptide and calibrant m/z were not provided or outside the m/z range")}
+		
+    #end if
 
     #################### 5) Number of peaks per pixel - image ##################
 
@@ -419,72 +424,75 @@
 
     ############################### 6b) median int image ###############################
 
-    median_int = pixelApply(msidata, median, na.rm=TRUE)
+    #if $report_depth:
+    
+		median_int = pixelApply(msidata, median, na.rm=TRUE)
 
-    median_coordarray=data.frame(coord(msidata)\$x, coord(msidata)\$y, median_int)
-    colnames(median_coordarray) = c("x", "y", "median_int")
-    print(ggplot(median_coordarray, aes(x=x, y=y, fill=median_int))+
-     geom_tile() + coord_fixed() +
-     ggtitle("Median intensity per spectrum")+
-     theme_bw() +
-     theme(plot.title = element_text(hjust = 0.5))+
-     theme(text=element_text(family="ArialMT", face="bold", size=12))+
-     scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") 
-                            ,space = "Lab", na.value = "black", name = "median\nintensity"))
+		median_coordarray=data.frame(coord(msidata)\$x, coord(msidata)\$y, median_int)
+		colnames(median_coordarray) = c("x", "y", "median_int")
+		print(ggplot(median_coordarray, aes(x=x, y=y, fill=median_int))+
+		 geom_tile() + coord_fixed() +
+		 ggtitle("Median intensity per spectrum")+
+		 theme_bw() +
+		 theme(plot.title = element_text(hjust = 0.5))+
+		 theme(text=element_text(family="ArialMT", face="bold", size=12))+
+		 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") 
+		                        ,space = "Lab", na.value = "black", name = "median\nintensity"))
 
-    ## remove median_coordarray to clean up RAM space
-        rm(median_coordarray)
-        gc()
+		## remove median_coordarray to clean up RAM space
+		    rm(median_coordarray)
+		    gc()
 
-    ############################### 6c) max int image ###############################
-
-    max_int = pixelApply(msidata, max, na.rm=TRUE)
+		############################### 6c) max int image ###############################
+		
+		max_int = pixelApply(msidata, max, na.rm=TRUE)
 
-    max_coordarray=data.frame(coord(msidata)\$x, coord(msidata)\$y, max_int)
-    colnames(max_coordarray) = c("x", "y", "max_int")
-    print(ggplot(max_coordarray, aes(x=x, y=y, fill=max_int))+
-     geom_tile() + coord_fixed() +
-     ggtitle("Maximum intensity per spectrum")+
-     theme_bw() +
-     theme(plot.title = element_text(hjust = 0.5))+
-     theme(text=element_text(family="ArialMT", face="bold", size=12))+
-     scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") 
-                            ,space = "Lab", na.value = "black", name = "max\nintensity"))
+		max_coordarray=data.frame(coord(msidata)\$x, coord(msidata)\$y, max_int)
+		colnames(max_coordarray) = c("x", "y", "max_int")
+		print(ggplot(max_coordarray, aes(x=x, y=y, fill=max_int))+
+		 geom_tile() + coord_fixed() +
+		 ggtitle("Maximum intensity per spectrum")+
+		 theme_bw() +
+		 theme(plot.title = element_text(hjust = 0.5))+
+		 theme(text=element_text(family="ArialMT", face="bold", size=12))+
+		 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") 
+		                        ,space = "Lab", na.value = "black", name = "max\nintensity"))
 
-    ## remove median_coordarray to clean up RAM space
-        rm(max_coordarray)
-        gc()
+		## remove median_coordarray to clean up RAM space
+		    rm(max_coordarray)
+		    gc()
+
+		############################### 7) Most abundant m/z image #################
+
+		## for each spectrum find the row (m/z) with the highest intensity
+		highestmz = pixelApply(msidata, which.max)
 
-    ############################### 7) Most abundant m/z image #################
-
-    ## for each spectrum find the row (m/z) with the highest intensity
-    highestmz = pixelApply(msidata, which.max)
+		## in case for some spectra max returns integer(0), highestmz is a list and integer(0) have to be replaced with NA and unlisted
+		if (class(highestmz) == "list"){
+		    ##find zero-length values
+		    zero_entry <- !(sapply(highestmz, length))
+		    ### replace these values with NA
+		    highestmz[zero_entry] <- NA
+		    ### unlist list to get a vector
+		    highestmz = unlist(highestmz)}
 
-    ## in case for some spectra max returns integer(0), highestmz is a list and integer(0) have to be replaced with NA and unlisted
-    if (class(highestmz) == "list"){
-        ##find zero-length values
-        zero_entry <- !(sapply(highestmz, length))
-        ### replace these values with NA
-        highestmz[zero_entry] <- NA
-        ### unlist list to get a vector
-        highestmz = unlist(highestmz)}
-
-    highestmz_matrix = data.frame(coord(msidata)\$x, coord(msidata)\$y,mz(msidata)[highestmz])
-    colnames(highestmz_matrix) = c("x", "y", "highestmzinDa")
+		highestmz_matrix = data.frame(coord(msidata)\$x, coord(msidata)\$y,mz(msidata)[highestmz])
+		colnames(highestmz_matrix) = c("x", "y", "highestmzinDa")
 
-    print(ggplot(highestmz_matrix, aes(x=x, y=y, fill=highestmzinDa))+
-    geom_tile() + coord_fixed() +
-    ggtitle("Most abundant m/z in each spectrum")+
-    theme_bw() +
-    theme(plot.title = element_text(hjust = 0.5))+
-    scale_fill_gradientn(colours = c("blue", "purple" , "red","orange"), space = "Lab", na.value = "black", name = "m/z", 
-      limits=c(min(highestmz_matrix\$highestmzinDa), max(highestmz_matrix\$highestmzinDa)))+
-    theme(text=element_text(family="ArialMT", face="bold", size=12)))
+		print(ggplot(highestmz_matrix, aes(x=x, y=y, fill=highestmzinDa))+
+		geom_tile() + coord_fixed() +
+		ggtitle("Most abundant m/z in each spectrum")+
+		theme_bw() +
+		theme(plot.title = element_text(hjust = 0.5))+
+		scale_fill_gradientn(colours = c("blue", "purple" , "red","orange"), space = "Lab", na.value = "black", name = "m/z", 
+		  limits=c(min(highestmz_matrix\$highestmzinDa), max(highestmz_matrix\$highestmzinDa)))+
+		theme(text=element_text(family="ArialMT", face="bold", size=12)))
 
-    ## remove highestmz_matrix to clean up RAM space
-        rm(highestmz_matrix)
-        gc()
+		## remove highestmz_matrix to clean up RAM space
+		    rm(highestmz_matrix)
+		    gc()
 
+    #end if
 
     ########################## 8) optional pca image for two components #################
 
@@ -513,38 +521,44 @@
 
     ########################## 9) number of peaks per spectrum #################
     ## 9a) scatterplot
+    
+    #if $report_depth:
 
-    plot_colorByDensity(pixels(msidata), peaksperpixel, ylab = "", xlab = "", main="Number of peaks per spectrum")
-    title(xlab="Spectra index", line=3)
-    title(ylab="Number of peaks", line=4)
+		plot_colorByDensity(pixels(msidata), peaksperpixel, ylab = "", xlab = "", main="Number of peaks per spectrum")
+		title(xlab="Spectra index", line=3)
+		title(ylab="Number of peaks", line=4)
 
-    if (!is.null(unique(msidata\$annotation))){
-        abline(v=abline_vector, lty = 3)}
-
-    ## 9b) histogram
+		if (!is.null(unique(msidata\$annotation))){
+		    abline(v=abline_vector, lty = 3)}
+		
+		## 9b) histogram
+		
 
-    hist(peaksperpixel, main="", las=1, xlab = "Number of peaks per spectrum", ylab="") 
-    title(main="Number of peaks per spectrum", line=2)
-    title(ylab="Frequency = # spectra", line=4)
-    abline(v=median(peaksperpixel), col="blue")
+
+		hist(peaksperpixel, main="", las=1, xlab = "Number of peaks per spectrum", ylab="") 
+		title(main="Number of peaks per spectrum", line=2)
+		title(ylab="Frequency = # spectra", line=4)
+		abline(v=median(peaksperpixel), col="blue")
 
-    ## 9c) additional histogram to show contribution of annotation groups
+		## 9c) additional histogram to show contribution of annotation groups
 
-    if (!is.null(unique(msidata\$annotation))){
+		if (!is.null(unique(msidata\$annotation))){
 
-        df_9 = data.frame(peaksperpixel, msidata\$annotation)
-        colnames(df_9) = c("Npeaks", "annotation")
- 
-        hist_9 = ggplot(df_9, aes(x=Npeaks, fill=annotation)) +
-        geom_histogram()+ theme_bw()+
-        theme(text=element_text(family="ArialMT", face="bold", size=12))+
-        theme(plot.title = element_text(hjust = 0.5))+
-        theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = 8))+
-        theme(legend.position="bottom",legend.direction="vertical")+
-        labs(title="Number of peaks per spectrum and annotation group", x="Number of peaks per spectrum", y = "Frequency = # spectra") +
-        guides(fill=guide_legend(ncol=5,byrow=TRUE))+
-        geom_vline(xintercept = median(peaksperpixel), size = 1, colour = "black",linetype = "dashed")
-        print(hist_9)}
+		    df_9 = data.frame(peaksperpixel, msidata\$annotation)
+		    colnames(df_9) = c("Npeaks", "annotation")
+	 
+		    hist_9 = ggplot(df_9, aes(x=Npeaks, fill=annotation)) +
+		    geom_histogram()+ theme_bw()+
+		    theme(text=element_text(family="ArialMT", face="bold", size=12))+
+		    theme(plot.title = element_text(hjust = 0.5))+
+		    theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = 8))+
+		    theme(legend.position="bottom",legend.direction="vertical")+
+		    labs(title="Number of peaks per spectrum and annotation group", x="Number of peaks per spectrum", y = "Frequency = # spectra") +
+		    guides(fill=guide_legend(ncol=5,byrow=TRUE))+
+		    geom_vline(xintercept = median(peaksperpixel), size = 1, colour = "black",linetype = "dashed")
+		    print(hist_9)}
+        
+    #end if
 
     ########################## 10) TIC per spectrum ###########################
 
@@ -596,61 +610,64 @@
 
     ########################## 12) Number of peaks per m/z #####################
 
-    peakspermz = rowSums(spectra(msidata) > 0, na.rm=TRUE)
+    #if $report_depth:
+        
+		peakspermz = rowSums(spectra(msidata) > 0, na.rm=TRUE)
 
-    par(mfrow = c(2,1), mar=c(5,6,4,4.5))
-    ## 12a) scatterplot
-    plot_colorByDensity(mz(msidata),peakspermz, main= "Number of peaks per m/z", ylab ="")
-    title(xlab="m/z", line=2.5)
-    title(ylab = "Number of peaks", line=4)
-    axis(4, at=pretty(peakspermz),labels=as.character(round((pretty(peakspermz)/pixelcount*100), digits=1)), las=1)
-    mtext("Coverage of spectra [%]", 4, line=3, adj=1)
+		par(mfrow = c(2,1), mar=c(5,6,4,4.5))
+		## 12a) scatterplot
+		plot_colorByDensity(mz(msidata),peakspermz, main= "Number of peaks per m/z", ylab ="")
+		title(xlab="m/z", line=2.5)
+		title(ylab = "Number of peaks", line=4)
+		axis(4, at=pretty(peakspermz),labels=as.character(round((pretty(peakspermz)/pixelcount*100), digits=1)), las=1)
+		mtext("Coverage of spectra [%]", 4, line=3, adj=1)
 
-    ## 12b) histogram
-    hist(peakspermz, main="", las=1, ylab="", xlab="")
-    title(ylab = "Frequency", line=4)
-    title(main="Number of peaks per m/z", xlab = "Number of peaks per m/z", line=2)
-    abline(v=median(peakspermz), col="blue") 
+		## 12b) histogram
+		hist(peakspermz, main="", las=1, ylab="", xlab="")
+		title(ylab = "Frequency", line=4)
+		title(main="Number of peaks per m/z", xlab = "Number of peaks per m/z", line=2)
+		abline(v=median(peakspermz), col="blue") 
 
-    ########################## 13) Sum of intensities per m/z ##################
+		########################## 13) Sum of intensities per m/z ##################
 
-    ## Sum of all intensities for each m/z (like TIC, but for m/z instead of pixel)
-    mzTIC = featureApply(msidata, sum, na.rm=TRUE) ## calculate intensity sum for each m/z
+		## Sum of all intensities for each m/z (like TIC, but for m/z instead of pixel)
+		mzTIC = featureApply(msidata, sum, na.rm=TRUE) ## calculate intensity sum for each m/z
 
-    par(mfrow = c(2,1), mar=c(5,6,4,2))
-    ## 13a) scatterplot
-    plot_colorByDensity(mz(msidata),mzTIC,  main= "Sum of intensities per m/z", ylab ="")
-    title(xlab="m/z", line=2.5)
-    title(ylab="Intensity sum", line=4)
+		par(mfrow = c(2,1), mar=c(5,6,4,2))
+		## 13a) scatterplot
+		plot_colorByDensity(mz(msidata),mzTIC,  main= "Sum of intensities per m/z", ylab ="")
+		title(xlab="m/z", line=2.5)
+		title(ylab="Intensity sum", line=4)
 
-    ## 13b) histogram
-    hist(mzTIC, main="", xlab = "", las=1, ylab="")
-    title(main="Sum of intensities per m/z", line=2, ylab="")
-    title(xlab = "sum of intensities per m/z")
-    title(ylab = "Frequency", line=4)
-    abline(v=median(mzTIC[mzTIC>0]), col="blue")
+		## 13b) histogram
+		hist(mzTIC, main="", xlab = "", las=1, ylab="")
+		title(main="Sum of intensities per m/z", line=2, ylab="")
+		title(xlab = "sum of intensities per m/z")
+		title(ylab = "Frequency", line=4)
+		abline(v=median(mzTIC[mzTIC>0]), col="blue")
 
-    ################################## V) intensity plots ########################
-    ############################################################################
-    print("intensity plots")
-    ########################## 14) Intensity distribution ######################
+		################################## V) intensity plots ########################
+		############################################################################
+		print("intensity plots")
+		########################## 14) Intensity distribution ######################
 
-    par(mfrow = c(2,1), mar=c(5,6,4,2))
+		par(mfrow = c(2,1), mar=c(5,6,4,2))
 
-    ## 14a) Median intensity over spectra
-    medianint_spectra = pixelApply(msidata, median, na.rm=TRUE)
-    plot(medianint_spectra, main="Median intensity per spectrum",las=1, xlab="Spectra index", ylab="")
-    title(ylab="Median spectrum intensity", line=4)
-    if (!is.null(unique(msidata\$annotation))){
-        abline(v=abline_vector, lty = 3)}
+		## 14a) Median intensity over spectra
+		medianint_spectra = pixelApply(msidata, median, na.rm=TRUE)
+		plot(medianint_spectra, main="Median intensity per spectrum",las=1, xlab="Spectra index", ylab="")
+		title(ylab="Median spectrum intensity", line=4)
+		if (!is.null(unique(msidata\$annotation))){
+		    abline(v=abline_vector, lty = 3)}
 
-    ## 14b) histogram: 
-    hist(int_matrix, main="", xlab = "", ylab="", las=1)
-    title(main="Intensity histogram", line=2)
-    title(xlab="intensities")
-    title(ylab="Frequency", line=4)
-    abline(v=median(int_matrix)[(as.matrix(spectra(msidata))>0)], col="blue")
+		## 14b) histogram: 
+		hist(int_matrix, main="", xlab = "", ylab="", las=1)
+		title(main="Intensity histogram", line=2)
+		title(xlab="intensities")
+		title(ylab="Frequency", line=4)
+		abline(v=median(int_matrix)[(as.matrix(spectra(msidata))>0)], col="blue")
 
+    #end if
 
     ## 14c) histogram to show contribution of annotation groups
 
@@ -719,36 +736,40 @@
 
     ############################ 15) Mass spectra ##############################
 
+    
     ## replace any NA with 0, otherwise plot function will not work at all
     msidata_no_NA = msidata
+    
+    #if $report_depth:
 
-    ## find three equal m/z ranges for the average mass spectra plots: 
-    third_mz_range = round(nrow(msidata_no_NA)/3,0)
+		## find three equal m/z ranges for the average mass spectra plots: 
+		third_mz_range = round(nrow(msidata_no_NA)/3,0)
 
-    par(cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
-    print(plot(msidata_no_NA, run="infile", layout=c(2,2), strip=FALSE, main= "Average spectrum", col="black"))
-    print(plot(msidata_no_NA[1:third_mz_range,], layout=FALSE, run="infile", strip=FALSE, main="Zoomed average spectrum", col="black"))
-    print(plot(msidata_no_NA[third_mz_range:(2*third_mz_range),], layout=FALSE, run="infile", strip=FALSE, main="Zoomed average spectrum", col="black"))
-    print(plot(msidata_no_NA[(2*third_mz_range):nrow(msidata_no_NA),], layout=FALSE, run="infile", strip=FALSE, main="Zoomed average spectrum", col="black"))
+		par(cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
+		print(plot(msidata_no_NA, run="infile", layout=c(2,2), strip=FALSE, main= "Average spectrum", col="black"))
+		print(plot(msidata_no_NA[1:third_mz_range,], layout=FALSE, run="infile", strip=FALSE, main="Zoomed average spectrum", col="black"))
+		print(plot(msidata_no_NA[third_mz_range:(2*third_mz_range),], layout=FALSE, run="infile", strip=FALSE, main="Zoomed average spectrum", col="black"))
+		print(plot(msidata_no_NA[(2*third_mz_range):nrow(msidata_no_NA),], layout=FALSE, run="infile", strip=FALSE, main="Zoomed average spectrum", col="black"))
 
-    ## plot one average mass spectrum for each pixel annotation group
+		## plot one average mass spectrum for each pixel annotation group
 
-    if (!is.null(unique(msidata\$annotation))){
-        ## print legend only for less than 10 samples
-        if (length(unique(msidata\$annotation)) < 10){
-            key_legend = TRUE
-        }else{key_legend = FALSE}
-        par(mfrow = c(1,1), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
-        print(plot(msidata, run="infile", pixel.groups=msidata\$annotation, key=key_legend, col=hue_pal()(length(unique(msidata\$annotation))),superpose=TRUE, main="Average mass spectra for annotation groups"))
-    }
+		if (!is.null(unique(msidata\$annotation))){
+		    ## print legend only for less than 10 samples
+		    if (length(unique(msidata\$annotation)) < 10){
+		        key_legend = TRUE
+		    }else{key_legend = FALSE}
+		    par(mfrow = c(1,1), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
+		    print(plot(msidata, run="infile", pixel.groups=msidata\$annotation, key=key_legend, col=hue_pal()(length(unique(msidata\$annotation))),superpose=TRUE, main="Average mass spectra for annotation groups"))
+		}
 
-    ## plot 4 random mass spectra
-    ## find four random, not empty pixel to plot their spectra in the following plots:
-    pixel_vector = sample(which(TICs != 0),4)
+		## plot 4 random mass spectra
+		## find four random, not empty pixel to plot their spectra in the following plots:
+		pixel_vector = sample(which(TICs != 0),4)
 
-    par(mfrow = c(2, 2), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
-    print(plot(msidata_no_NA, pixel = pixel_vector, col="black"))
+		par(mfrow = c(2, 2), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
+		print(plot(msidata_no_NA, pixel = pixel_vector, col="black"))
 
+    #end if
 
     ################### 16) Zoomed in mass spectra for calibrants ##############
 
@@ -848,6 +869,8 @@
 
     ######### 17) ppm difference input calibrant m/z and m/z with max intensity in given m/z range#########
 
+    #if $report_depth:
+    
         par(mfrow = c(1,1))
         ### plot the ppm difference calculated above: theor. m/z value to highest m/z value: 
 
@@ -885,6 +908,8 @@
         theme(axis.text.x = element_text(angle = 90, hjust = 1, size=14))
 
         print(diff_plot2)
+        
+    #end if
 
         #################### 19) ppm difference over pixels #####################
 
@@ -934,6 +959,7 @@
 
             ### make x-y-images for mz accuracy
 
+    #if $report_depth:
             ppm_dataframe = data.frame(coord(msidata)\$x, coord(msidata)\$y, ppm_df)
             colnames(ppm_dataframe) = c("x", "y", "ppm_df")
 
@@ -950,6 +976,7 @@
                  theme(text=element_text(family="ArialMT", face="bold", size=12))+
                  scale_fill_gradient2(low = "navy", mid = "grey", high = "red", midpoint = 0 ,space = "Lab", na.value = "black", name = "ppm\nerror"))}
 
+    #end if
 
     }else{print("plot 16+17+18+19) The inputcalibrant m/z were not provided or outside the m/z range")}
 }else{
@@ -976,6 +1003,7 @@
         <expand macro="reading_2_column_mz_tabular" optional="true"/>
         <param name="plusminus_ppm" value="200" type="float" label="ppm range" help="Will be added in both directions to input calibrant m/z"/>
         <param name="do_pca" type="boolean" label="PCA with 2 components"/>
+        <param name="report_depth" type="boolean" label="Generate full QC report" truevalue="TRUE" falsevalue="FALSE" checked="True" help="No: does not generate all plots but only the most informatives"/>
         <repeat name="calibrantratio" title="Plot fold change of two m/z" min="0" max="10">
             <param name="mass1" value="1111" type="float" label="M/z 1" help="First m/z"/>
             <param name="mass2" value="2222" type="float" label="M/z 2" help="Second m/z"/>
@@ -1021,7 +1049,6 @@
             </repeat>
             <output name="QC_report" file="QC_imzml.pdf" compare="sim_size"/>
         </test>
-
         <test>
             <expand macro="infile_analyze75"/>
             <conditional name="tabular_annotation">
@@ -1031,7 +1058,6 @@
             <param name="do_pca" value="True"/>
             <output name="QC_report" file="QC_analyze75.pdf" compare="sim_size"/>
         </test>
-
         <test>
             <param name="infile" value="3_files_combined.RData" ftype="rdata"/>
             <conditional name="tabular_annotation">
@@ -1062,6 +1088,25 @@
             <param name="do_pca" value="False"/>
             <output name="QC_report" file="QC_empty_spectra.pdf" compare="sim_size"/>
         </test>
+        <test>
+            <param name="infile" value="" ftype="imzml">
+                <composite_data value="Example_Processed.imzML"/>
+                <composite_data value="Example_Processed.ibd"/>
+            </param>
+            <conditional name="processed_cond">
+                <param name="processed_file" value="processed"/>
+                <param name="accuracy" value="200"/>
+                <param name="units" value="ppm"/>
+            </conditional>
+            <conditional name="tabular_annotation">
+                <param name="load_annotation" value="no_annotation"/>
+            </conditional>
+            <param name="calibrant_file" value="inputcalibrantfile1.tabular" ftype="tabular"/>
+            <param name="mz_column" value="1"/>
+            <param name="name_column" value="1"/>
+            <param name="report_depth" value="False"/>
+            <output name="QC_report" file="QC_imzml_shortreport.pdf" compare="sim_size"/>
+        </test>  
     </tests>
     <help>
         <![CDATA[
Binary file test-data/QC_imzml_shortreport.pdf has changed
--- a/test-data/pixels_test6.tabular	Wed Dec 23 22:36:04 2020 +0000
+++ b/test-data/pixels_test6.tabular	Sun Aug 29 07:30:21 2021 +0000
@@ -1,25 +1,25 @@
-pixel names	x	y	predicted condition
-xy_1_1	1	1	A
-xy_2_1	2	1	A
-xy_3_1	3	1	B
-xy_4_1	4	1	C
-xy_1_2	1	2	C
-xy_2_2	2	2	C
-xy_3_2	3	2	A
-xy_4_2	4	2	A
-xy_1_3	1	3	A
-xy_2_3	2	3	B
-xy_3_3	3	3	C
-xy_4_3	4	3	A
-xy_10_1	10	1	C
-xy_11_1	11	1	C
-xy_12_1	12	1	C
-xy_13_1	13	1	B
-xy_10_2	10	2	C
-xy_11_2	11	2	B
-xy_12_2	12	2	C
-xy_13_2	13	2	C
-xy_10_3	10	3	C
-xy_11_3	11	3	C
-xy_12_3	12	3	B
-xy_13_3	13	3	C
+pixel names	x	y	predicted condition	A	B	C
+xy_1_1	1	1	A	0.434439526064797	0.195646317191818	0.369914156743386
+xy_2_1	2	1	A	0.38219998209377	0.242372158141275	0.375427859764956
+xy_3_1	3	1	B	0.312531499299517	0.385612104162858	0.301856396537625
+xy_4_1	4	1	C	0.393153488582866	0.191107087820634	0.4157394235965
+xy_1_2	1	2	C	0.366986470447772	0.216121568441093	0.416891961111135
+xy_2_2	2	2	C	0.381682206547616	0.213188918797062	0.405128874655322
+xy_3_2	3	2	A	0.376695037169723	0.260689491088564	0.362615471741713
+xy_4_2	4	2	A	0.42305935188829	0.174038449100755	0.402902199010954
+xy_1_3	1	3	A	0.382420991383021	0.249364697048677	0.368214311568302
+xy_2_3	2	3	B	0.272145998315727	0.446525938567718	0.281328063116555
+xy_3_3	3	3	C	0.36296987427851	0.255631013944556	0.381399111776934
+xy_4_3	4	3	A	0.444812272103175	0.132274264153212	0.422913463743613
+xy_10_1	10	1	C	0.376216993893763	0.227584528606788	0.39619847749945
+xy_11_1	11	1	C	0.358430578177403	0.236120068794936	0.405449353027661
+xy_12_1	12	1	C	0.359751662628136	0.218620985552221	0.421627351819643
+xy_13_1	13	1	B	0.101486342705225	0.813997511218961	0.0845161460758142
+xy_10_2	10	2	C	0.354612526523361	0.272635192773437	0.372752280703202
+xy_11_2	11	2	B	0.291635599769993	0.444466545540823	0.263897854689184
+xy_12_2	12	2	C	0.36763798979782	0.203911653614431	0.428450356587749
+xy_13_2	13	2	C	0.344608135177236	0.304026642707691	0.351365222115073
+xy_10_3	10	3	C	0.37046458150651	0.205561286708086	0.423974131785404
+xy_11_3	11	3	C	0.358113833435286	0.262878459144526	0.379007707420187
+xy_12_3	12	3	B	0.180921926305915	0.66902588624642	0.150052187447665
+xy_13_3	13	3	C	0.378266307042675	0.20859472985319	0.413138963104135
Binary file test-data/preprocessing_results4.ibd has changed
--- a/test-data/preprocessing_results4.imzml	Wed Dec 23 22:36:04 2020 +0000
+++ b/test-data/preprocessing_results4.imzml	Sun Aug 29 07:30:21 2021 +0000
@@ -9,8 +9,8 @@
 		<fileContent>
 			<cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" />
 			<cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" />
-			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="48842eaf-40e5-4a3f-831c-2d7a3b7e04b9" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="2010ba5b7d44695d891cfe3b6674a5699fa610c0" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="04431b64-9f3d-44b4-9e63-81b9e4924aec" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="38a4fadd32374bdf0e4b2bb7d976f6067d542a29" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -42,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="2.6.0">
+		<software id="Cardinal" version="2.10.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
--- a/test-data/preprocessing_results4.imzml.txt	Wed Dec 23 22:36:04 2020 +0000
+++ b/test-data/preprocessing_results4.imzml.txt	Sun Aug 29 07:30:21 2021 +0000
@@ -1,4 +1,4 @@
 imzML file:
 total 84
--rw-rw-r-- 1 meli meli 62696 Oct  5 19:58 ibd
--rw-rw-r-- 1 meli meli 18199 Oct  5 19:58 imzml
+-rw-rw-r-- 1 meli meli 62696 Aug 28 16:41 ibd
+-rw-rw-r-- 1 meli meli 18200 Aug 28 16:41 imzml
Binary file test-data/preprocessing_results4.pdf has changed
Binary file test-data/test1.pdf has changed
Binary file test-data/test2.pdf has changed
Binary file test-data/test3.pdf has changed
Binary file test-data/test4.pdf has changed
Binary file test-data/test5.pdf has changed
Binary file test-data/test6.pdf has changed
Binary file test-data/test6.rdata has changed
Binary file test-data/test7.pdf has changed
Binary file test-data/test7.rdata has changed