diff quality_report.xml @ 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 ecaebe7c7b54
children d426a9107a6c
line wrap: on
line diff
--- 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[