Mercurial > repos > galaxyp > msi_qualitycontrol
comparison msi_qualitycontrol.xml @ 11:30d0aabb1b46 draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
author | galaxyp |
---|---|
date | Thu, 21 Jun 2018 16:46:09 -0400 |
parents | 3eee933c27cf |
children | c43a7821c030 |
comparison
equal
deleted
inserted
replaced
10:3eee933c27cf | 11:30d0aabb1b46 |
---|---|
1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.10.0.2"> | 1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.10.0.3"> |
2 <description> | 2 <description> |
3 mass spectrometry imaging QC | 3 mass spectrometry imaging QC |
4 </description> | 4 </description> |
5 <requirements> | 5 <requirements> |
6 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement> | 6 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement> |
36 library(RColorBrewer) | 36 library(RColorBrewer) |
37 library(gridExtra) | 37 library(gridExtra) |
38 library(KernSmooth) | 38 library(KernSmooth) |
39 library(scales) | 39 library(scales) |
40 | 40 |
41 | |
41 #if $infile.ext == 'imzml' | 42 #if $infile.ext == 'imzml' |
42 msidata <- readImzML('infile', mass.accuracy=$accuracy, units.accuracy = "$units") | 43 #if str($processed_cond.processed_file) == "processed": |
44 msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units") | |
45 #else | |
46 msidata <- readImzML('infile') | |
47 #end if | |
43 #elif $infile.ext == 'analyze75' | 48 #elif $infile.ext == 'analyze75' |
44 msidata = readAnalyze('infile') | 49 msidata = readAnalyze('infile') |
45 #else | 50 #else |
46 load('infile.RData') | 51 load('infile.RData') |
47 #end if | 52 #end if |
114 peakpickinginfo=processinginfo@peakPicking | 119 peakpickinginfo=processinginfo@peakPicking |
115 } | 120 } |
116 | 121 |
117 ############## Read and filter tabular file with m/z ########################### | 122 ############## Read and filter tabular file with m/z ########################### |
118 | 123 |
119 ### reading peptide file: | |
120 | |
121 #if $peptide_file: | |
122 | |
123 input_list = read.delim("$peptide_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE) | |
124 if (ncol(input_list) == 1) | |
125 {input_list = cbind(input_list, input_list)} ## if there is just one column dublicate it to have a names column | |
126 | |
127 ### calculate how many input peptide m/z are valid: | |
128 | |
129 inputpeptides = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] | |
130 number_peptides_in = length(input_list[,1]) | |
131 number_peptides_valid = length(inputpeptides[,1]) | |
132 | |
133 #else | |
134 | |
135 inputpeptides = as.data.frame(matrix(, nrow = 0, ncol = 2)) | |
136 number_peptides_in = 0 | |
137 number_peptides_valid = 0 | |
138 | |
139 #end if | |
140 | |
141 colnames(inputpeptides) = c("m/z", "name") | |
142 | |
143 ### reading calibrant file: | 124 ### reading calibrant file: |
144 | 125 |
145 #if $calibrant_file: | 126 #if $calibrant_file: |
146 | 127 |
147 calibrant_list = read.delim("$calibrant_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE) | 128 calibrant_list = read.delim("$calibrant_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE) |
160 number_calibrants_in = 0 | 141 number_calibrants_in = 0 |
161 number_calibrants_valid = 0 | 142 number_calibrants_valid = 0 |
162 | 143 |
163 #end if | 144 #end if |
164 | 145 |
146 ## rename input dataframe and extract m/z | |
165 colnames(inputcalibrants) = c("m/z", "name") | 147 colnames(inputcalibrants) = c("m/z", "name") |
166 | 148 inputcalibrantmasses = inputcalibrants[,1] |
167 ### bind inputcalibrants and inputpeptides together, to make m/z heatmaps on both | 149 |
168 | |
169 inputs_all = rbind(inputcalibrants[,1:2], inputpeptides[,1:2]) | |
170 inputmasses = inputs_all[,1] | |
171 inputnames = inputs_all[,2] | |
172 | 150 |
173 ######################################## PDF ############################################# | 151 ######################################## PDF ############################################# |
174 ########################################################################################## | 152 ########################################################################################## |
175 ########################################################################################## | 153 ########################################################################################## |
176 | 154 |
195 "Range of x coordinates", | 173 "Range of x coordinates", |
196 "Range of y coordinates", | 174 "Range of y coordinates", |
197 "Range of intensities", | 175 "Range of intensities", |
198 "Median of intensities", | 176 "Median of intensities", |
199 "Intensities > 0", | 177 "Intensities > 0", |
200 "Number of zero TICs", | 178 "Number of empty spectra", |
201 "Median TIC", | 179 "Median TIC", |
202 "Median # peaks per spectrum", | 180 "Median # peaks per spectrum", |
203 "Normalization", | 181 "Normalization", |
204 "Smoothing", | 182 "Smoothing", |
205 "Baseline reduction", | 183 "Baseline reduction", |
206 "Peak picking", | 184 "Peak picking", |
207 "Centroided", | 185 "Centroided", |
208 paste0("# peptides in \n", "$peptide_file.display_name"), | 186 paste0("calibrants (#valid/#input) in \n", "$calibrant_file.display_name")) |
209 paste0("# calibrants in \n", "$calibrant_file.display_name")) | |
210 | 187 |
211 values = c(paste0(maxfeatures), | 188 values = c(paste0(maxfeatures), |
212 paste0(minmz, " - ", maxmz), | 189 paste0(minmz, " - ", maxmz), |
213 paste0(pixelcount), | 190 paste0(pixelcount), |
214 paste0(minimumx, " - ", maximumx), | 191 paste0(minimumx, " - ", maximumx), |
222 paste0(normalizationinfo), | 199 paste0(normalizationinfo), |
223 paste0(smoothinginfo), | 200 paste0(smoothinginfo), |
224 paste0(baselinereductioninfo), | 201 paste0(baselinereductioninfo), |
225 paste0(peakpickinginfo), | 202 paste0(peakpickinginfo), |
226 paste0(centroidedinfo), | 203 paste0(centroidedinfo), |
227 paste0(number_peptides_valid, " / " , number_peptides_in), | |
228 paste0(number_calibrants_valid, " / ", number_calibrants_in)) | 204 paste0(number_calibrants_valid, " / ", number_calibrants_in)) |
229 | 205 |
230 property_df = data.frame(properties, values) | 206 property_df = data.frame(properties, values) |
231 | 207 |
232 grid.table(property_df, rows= NULL) | 208 grid.table(property_df, rows= NULL) |
233 | 209 |
234 ####################### II) images in x-y grid ############################### | 210 ####################### II) x-y images ####################################### |
235 ############################################################################## | 211 ############################################################################## |
236 print("x-y images") | 212 print("x-y images") |
237 | 213 |
238 if (npeaks > 0){ | 214 if (npeaks > 0){ |
239 ## function for density plots | 215 ## function for density plots |
319 geom_tile() + coord_fixed()+ | 295 geom_tile() + coord_fixed()+ |
320 ggtitle("Pixel order") + theme_bw()+ | 296 ggtitle("Pixel order") + theme_bw()+ |
321 theme(plot.title = element_text(hjust = 0.5))+ | 297 theme(plot.title = element_text(hjust = 0.5))+ |
322 theme(text=element_text(family="ArialMT", face="bold", size=12))+ | 298 theme(text=element_text(family="ArialMT", face="bold", size=12))+ |
323 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange"), | 299 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange"), |
324 space = "Lab", na.value = "black", name = "Pixel number")) | 300 space = "Lab", na.value = "black", name = "Pixel\nnumber")) |
325 | 301 |
326 ################ 2) Number of calibrants per spectrum ###################### | 302 ################ 2) Number of calibrants per spectrum ###################### |
327 | 303 |
328 pixelmatrix = matrix(ncol=ncol(msidata), nrow=0) | 304 ## matrix with calibrants in columns and in rows if there is peak intensity in range or not |
329 inputcalibrantmasses = inputcalibrants[,1] | 305 pixelmatrix = matrix(ncol=ncol(msidata), nrow = 0) |
330 | 306 |
331 ### find m/z range (ppm) for each calibrant and extract intensity matrix for this range | 307 ## plot only possible when there is at least one valid calibrant |
308 if (length(inputcalibrantmasses) != 0){ | |
309 | |
310 ## calculate plusminus values in m/z for each calibrant | |
332 plusminusvalues = rep($plusminus_ppm/1000000, length(inputcalibrantmasses))*inputcalibrantmasses | 311 plusminusvalues = rep($plusminus_ppm/1000000, length(inputcalibrantmasses))*inputcalibrantmasses |
333 | 312 |
334 if (length(inputcalibrantmasses) != 0){ | 313 ## filter for m/z window of each calibrant and calculate if sum of peak intensities > 0 |
335 for (calibrantnr in 1:length(inputcalibrantmasses)){ | 314 for (mass in 1:length(inputcalibrantmasses)){ |
336 calibrantmz = inputcalibrantmasses[calibrantnr] | 315 |
337 calibrantfeaturemin = features(msidata, mz=calibrantmz-plusminusvalues[calibrantnr]) | 316 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],] |
338 calibrantfeaturemax = features(msidata, mz=calibrantmz+plusminusvalues[calibrantnr]) | 317 |
339 | 318 if (nrow(filtered_data) > 1 & sum(spectra(filtered_data)) > 0){ |
340 ## in case m/z range includes only 1 m/z: | 319 |
341 if (calibrantfeaturemin == calibrantfeaturemax){ | 320 ## intensity of all m/z > 0 |
342 calibrantintensity = spectra(msidata)[calibrantfeaturemin,] | 321 intensity_sum = colSums(spectra(filtered_data)) > 0 |
343 }else{ | 322 }else if(nrow(filtered_data) == 1 & sum(spectra(filtered_data)) > 0){ |
344 ## if m/z range includes more than 1 m/z take sum of intensities | 323 |
345 calibrantintensity = colSums(spectra(msidata)[calibrantfeaturemin:calibrantfeaturemax,]) | 324 ## intensity of only m/z > 0 |
346 } | 325 intensity_sum = spectra(filtered_data) > 0 |
347 ## for each pixel add sum of intensity in the given m/z range | 326 }else{ |
348 pixelmatrix = rbind(pixelmatrix, calibrantintensity) | 327 intensity_sum = rep(FALSE, ncol(filtered_data))} |
349 } | 328 |
350 | 329 ## for each pixel add sum of intensity in the given m/z range |
351 countvector= as.factor(colSums(pixelmatrix>0)) | 330 pixelmatrix = rbind(pixelmatrix, intensity_sum) |
352 countdf= cbind(coord(msidata)[,1:2], countvector) | 331 } |
332 | |
333 ## for each pixel count TRUE (each calibrant m/z range with intensity > 0 is TRUE) | |
334 countvector= as.factor(colSums(pixelmatrix)) | |
335 countdf= cbind(coord(msidata)[,1:2], countvector) ## add pixel coordinates to counts | |
353 mycolours = c("black","grey", "darkblue", "blue", "green" , "red", "yellow", "magenta", "olivedrab1", "lightseagreen") | 336 mycolours = c("black","grey", "darkblue", "blue", "green" , "red", "yellow", "magenta", "olivedrab1", "lightseagreen") |
354 | 337 |
355 print(ggplot(countdf, aes(x=x, y=y, fill=countvector))+ | 338 print(ggplot(countdf, aes(x=x, y=y, fill=countvector))+ |
356 geom_tile() + coord_fixed() + | 339 geom_tile() + coord_fixed() + |
357 ggtitle("Number of calibrants per pixel") + | 340 ggtitle(paste0("Number of calibrants per pixel (±",$plusminus_ppm, " ppm)")) + |
358 theme_bw() + | 341 theme_bw() + |
359 theme(plot.title = element_text(hjust = 0.5))+ | 342 theme(plot.title = element_text(hjust = 0.5))+ |
360 theme(text=element_text(family="ArialMT", face="bold", size=12))+ | 343 theme(text=element_text(family="ArialMT", face="bold", size=12))+ |
361 scale_fill_manual(values = mycolours[1:length(countvector)], | 344 scale_fill_manual(values = mycolours[1:length(countvector)], |
362 na.value = "black", name = "# calibrants")) | 345 na.value = "black", name = "# calibrants")) |
363 | 346 |
364 ## append list for optional spectrum values output | 347 ## append list for optional tabular output with spectrum values |
365 colnames(countdf)[3] = "Number of Calibrants" | 348 colnames(countdf)[3] = "Number of Calibrants" |
366 spectrum_list[[list_count]] = countdf | 349 spectrum_list[[list_count]] = countdf |
367 list_count = list_count+1 | 350 list_count = list_count+1 |
368 | 351 |
369 }else{print("2) The inputcalibrant m/z were not provided or outside the m/z range")} | 352 }else{print("2) The inputcalibrant m/z were not provided or outside the m/z range")} |
440 #end if | 423 #end if |
441 | 424 |
442 #################### 4) m/z heatmaps ####################################### | 425 #################### 4) m/z heatmaps ####################################### |
443 | 426 |
444 par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0) | 427 par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0) |
445 if (length(inputmasses) != 0){ | 428 if (length(inputcalibrants[,1]) != 0){ |
446 for (mass in 1:length(inputmasses)){ | 429 for (mass in 1:length(inputcalibrants[,1])){ |
447 image(msidata, mz=inputmasses[mass], plusminus=$plusminus_dalton, | 430 |
448 main= paste0(inputnames[mass], " (", round(inputmasses[mass], digits = 2)," ± ", $plusminus_dalton, " Da)"), | 431 |
432 image(msidata, mz=inputcalibrants[,1][mass], plusminus=plusminusvalues[mass], | |
433 main= paste0(inputcalibrants[,2][mass], ": ", round(inputcalibrants[,1][mass], digits = 2)," (±",$plusminus_ppm, " ppm)"), | |
449 contrast.enhance = "histogram", ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy)) | 434 contrast.enhance = "histogram", ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy)) |
450 } | 435 } |
451 } else {print("4) The input peptide and calibrant m/z were not provided or outside the m/z range")} | 436 } else {print("4) The input peptide and calibrant m/z were not provided or outside the m/z range")} |
452 | 437 |
453 #################### 5) Number of peaks per pixel - image ################## | 438 #################### 5) Number of peaks per pixel - image ################## |
463 theme(plot.title = element_text(hjust = 0.5))+ | 448 theme(plot.title = element_text(hjust = 0.5))+ |
464 theme(text=element_text(family="ArialMT", face="bold", size=12))+ | 449 theme(text=element_text(family="ArialMT", face="bold", size=12))+ |
465 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") | 450 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") |
466 ,space = "Lab", na.value = "black", name = "# peaks")) | 451 ,space = "Lab", na.value = "black", name = "# peaks")) |
467 | 452 |
468 ## append list for optional spectrum values output | 453 ## append list for optional tabular output with spectrum values |
469 colnames(peakscoordarray)[3] = "Number of Peaks" | 454 colnames(peakscoordarray)[3] = "Number of Peaks" |
470 spectrum_list[[list_count]] = peakscoordarray | 455 spectrum_list[[list_count]] = peakscoordarray |
471 list_count = list_count+1 | 456 list_count = list_count+1 |
472 | 457 |
473 ############################### 6) TIC image ############################### | 458 ############################### 6) TIC image ############################### |
482 theme(plot.title = element_text(hjust = 0.5))+ | 467 theme(plot.title = element_text(hjust = 0.5))+ |
483 theme(text=element_text(family="ArialMT", face="bold", size=12))+ | 468 theme(text=element_text(family="ArialMT", face="bold", size=12))+ |
484 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") | 469 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") |
485 ,space = "Lab", na.value = "black", name = "TIC")) | 470 ,space = "Lab", na.value = "black", name = "TIC")) |
486 | 471 |
487 ## append list for optional spectrum values output | 472 ## append list for optional tabular output with spectrum values |
488 colnames(TICcoordarray)[3] = "TIC per spectrum" | 473 colnames(TICcoordarray)[3] = "TIC per spectrum" |
489 spectrum_list[[list_count]] = TICcoordarray | 474 spectrum_list[[list_count]] = TICcoordarray |
490 list_count = list_count+1 | 475 list_count = list_count+1 |
491 | 476 |
492 ############################### 7) Most abundant m/z image ################# | 477 ############################### 7) Most abundant m/z image ################# |
510 highestmz_pixel = which(round(highestmz_matrix\$highestmzinDa, digits=0) == highestmz_peptides)[1] | 495 highestmz_pixel = which(round(highestmz_matrix\$highestmzinDa, digits=0) == highestmz_peptides)[1] |
511 | 496 |
512 secondhighestmz = names(sort(table(round(highestmz_matrix\$highestmzinDa, digits=0)), decreasing=TRUE)[2]) | 497 secondhighestmz = names(sort(table(round(highestmz_matrix\$highestmzinDa, digits=0)), decreasing=TRUE)[2]) |
513 secondhighestmz_pixel = which(round(highestmz_matrix\$highestmzinDa, digits=0) == secondhighestmz)[1] | 498 secondhighestmz_pixel = which(round(highestmz_matrix\$highestmzinDa, digits=0) == secondhighestmz)[1] |
514 | 499 |
515 print(head(sort(table(round(highestmz_matrix\$highestmzinDa, digits=0)), decreasing=TRUE))) | 500 ## append list for optional tabular output with spectrum values |
516 | |
517 ## append list for optional spectrum values output | |
518 colnames(highestmz_matrix)[3] = "Most abundant m/z" | 501 colnames(highestmz_matrix)[3] = "Most abundant m/z" |
519 spectrum_list[[list_count]] = highestmz_matrix | 502 spectrum_list[[list_count]] = highestmz_matrix |
520 | 503 |
521 ########################## 8) pca image for two components ################# | 504 ########################## 8) pca image for two components ################# |
522 | 505 |
592 labs(title="TIC per spectrum and sample", x="log(TIC per spectrum)", y = "Frequency = # spectra") + | 575 labs(title="TIC per spectrum and sample", x="log(TIC per spectrum)", y = "Frequency = # spectra") + |
593 guides(fill=guide_legend(ncol=5,byrow=TRUE))+ | 576 guides(fill=guide_legend(ncol=5,byrow=TRUE))+ |
594 geom_vline(xintercept = median(log(TICs[TICs>0])), size = 1, colour = "black",linetype = "dashed") | 577 geom_vline(xintercept = median(log(TICs[TICs>0])), size = 1, colour = "black",linetype = "dashed") |
595 print(hist_10)} | 578 print(hist_10)} |
596 | 579 |
597 ################################## IV) changes over m/z #################### | 580 ################################## IV) properties over m/z #################### |
598 ############################################################################ | 581 ############################################################################ |
599 print("changes over m/z") | 582 print("propverties over m/z") |
600 ########################## 11) Number of peaks per m/z ##################### | 583 |
584 ########################## 11) Histogram on m/z values ##################### | |
585 | |
586 par(mfrow = c(1, 1), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1)) | |
587 hist(mz(msidata), xlab = "m/z", main="Histogram of m/z values") | |
588 | |
589 ########################## 12) Number of peaks per m/z ##################### | |
601 | 590 |
602 peakspermz = rowSums(spectra(msidata)[] > 0 ) | 591 peakspermz = rowSums(spectra(msidata)[] > 0 ) |
603 | 592 |
604 par(mfrow = c(2,1), mar=c(5,6,4,4.5)) | 593 par(mfrow = c(2,1), mar=c(5,6,4,4.5)) |
605 ## 11a) scatterplot | 594 ## 12a) scatterplot |
606 plot_colorByDensity(mz(msidata),peakspermz, main= "Number of peaks per m/z", ylab ="") | 595 plot_colorByDensity(mz(msidata),peakspermz, main= "Number of peaks per m/z", ylab ="") |
607 title(xlab="m/z", line=2.5) | 596 title(xlab="m/z", line=2.5) |
608 title(ylab = "Number of peaks", line=4) | 597 title(ylab = "Number of peaks", line=4) |
609 axis(4, at=pretty(peakspermz),labels=as.character(round((pretty(peakspermz)/pixelcount*100), digits=1)), las=1) | 598 axis(4, at=pretty(peakspermz),labels=as.character(round((pretty(peakspermz)/pixelcount*100), digits=1)), las=1) |
610 mtext("Coverage of spectra [%]", 4, line=3, adj=1) | 599 mtext("Coverage of spectra [%]", 4, line=3, adj=1) |
611 | 600 |
612 ## 11b) histogram | 601 ## 12b) histogram |
613 hist(peakspermz, main="", las=1, ylab="", xlab="") | 602 hist(peakspermz, main="", las=1, ylab="", xlab="") |
614 title(ylab = "Frequency", line=4) | 603 title(ylab = "Frequency", line=4) |
615 title(main="Number of peaks per m/z", xlab = "Number of peaks per m/z", line=2) | 604 title(main="Number of peaks per m/z", xlab = "Number of peaks per m/z", line=2) |
616 abline(v=median(peakspermz), col="blue") | 605 abline(v=median(peakspermz), col="blue") |
617 | 606 |
618 ########################## 12) Sum of intensities per m/z ################## | 607 ########################## 13) Sum of intensities per m/z ################## |
619 | 608 |
620 ## Sum of all intensities for each m/z (like TIC, but for m/z instead of pixel) | 609 ## Sum of all intensities for each m/z (like TIC, but for m/z instead of pixel) |
621 mzTIC = rowSums(spectra(msidata)[]) ## calculate intensity sum for each m/z | 610 mzTIC = rowSums(spectra(msidata)[]) ## calculate intensity sum for each m/z |
622 | 611 |
623 par(mfrow = c(2,1), mar=c(5,6,4,2)) | 612 par(mfrow = c(2,1), mar=c(5,6,4,2)) |
624 ## 12a) scatterplot | 613 ## 13a) scatterplot |
625 plot_colorByDensity(mz(msidata),mzTIC, main= "Sum of intensities per m/z", ylab ="") | 614 plot_colorByDensity(mz(msidata),mzTIC, main= "Sum of intensities per m/z", ylab ="") |
626 title(xlab="m/z", line=2.5) | 615 title(xlab="m/z", line=2.5) |
627 title(ylab="Intensity sum", line=4) | 616 title(ylab="Intensity sum", line=4) |
628 | 617 |
629 ## 12b) histogram | 618 ## 13b) histogram |
630 hist(log(mzTIC), main="", xlab = "", las=1, ylab="") | 619 hist(log(mzTIC), main="", xlab = "", las=1, ylab="") |
631 title(main="Sum of intensities per m/z", line=2, ylab="") | 620 title(main="Sum of intensities per m/z", line=2, ylab="") |
632 title(xlab = "log (sum of intensities per m/z)") | 621 title(xlab = "log (sum of intensities per m/z)") |
633 title(ylab = "Frequency", line=4) | 622 title(ylab = "Frequency", line=4) |
634 abline(v=median(log(mzTIC[mzTIC>0])), col="blue") | 623 abline(v=median(log(mzTIC[mzTIC>0])), col="blue") |
635 | 624 |
636 ################################## V) general plots ######################## | 625 ################################## V) intensity plots ######################## |
637 ############################################################################ | 626 ############################################################################ |
638 print("general plots") | 627 print("intensity plots") |
639 ########################## 13) Intensity distribution ###################### | 628 ########################## 14) Intensity distribution ###################### |
640 | 629 |
641 par(mfrow = c(2,1), mar=c(5,6,4,2)) | 630 par(mfrow = c(2,1), mar=c(5,6,4,2)) |
642 | 631 |
643 ## 13a) Median intensity over spectra | 632 ## 14a) Median intensity over spectra |
644 medianint_spectra = apply(spectra(msidata), 2, median) | 633 medianint_spectra = apply(spectra(msidata), 2, median) |
645 plot(medianint_spectra, main="Median intensity per spectrum",las=1, xlab="Spectra index", ylab="") | 634 plot(medianint_spectra, main="Median intensity per spectrum",las=1, xlab="Spectra index", ylab="") |
646 title(ylab="Median spectrum intensity", line=4) | 635 title(ylab="Median spectrum intensity", line=4) |
647 abline(v=abline_vector, lty = 3) | 636 abline(v=abline_vector, lty = 3) |
648 | 637 |
649 ## 13b) histogram: | 638 ## 14b) histogram: |
650 hist(log2(spectra(msidata)[]), main="", xlab = "", ylab="", las=1) | 639 hist(log2(spectra(msidata)[]), main="", xlab = "", ylab="", las=1) |
651 title(main="Log2-transformed intensities", line=2) | 640 title(main="Log2-transformed intensities", line=2) |
652 title(xlab="log2 intensities") | 641 title(xlab="log2 intensities") |
653 title(ylab="Frequency", line=4) | 642 title(ylab="Frequency", line=4) |
654 abline(v=median(log2(spectra(msidata)[(spectra(msidata)>0)])), col="blue") | 643 abline(v=median(log2(spectra(msidata)[(spectra(msidata)>0)])), col="blue") |
655 | 644 |
656 ## 13c) histogram to show subsample contribution | 645 ## 14c) histogram to show subsample contribution |
657 ## only for previously combined samples | 646 ## only for previously combined samples |
658 if (!is.null(levels(msidata\$combined_sample))){ | 647 if (!is.null(levels(msidata\$combined_sample))){ |
659 | 648 |
660 df_13 = data.frame(matrix(,ncol=2, nrow=0)) | 649 df_13 = data.frame(matrix(,ncol=2, nrow=0)) |
661 for (subsample in levels(msidata\$combined_sample)){ | 650 for (subsample in levels(msidata\$combined_sample)){ |
675 theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = legend_size))+ | 664 theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = legend_size))+ |
676 guides(fill=guide_legend(ncol=5,byrow=TRUE))+ | 665 guides(fill=guide_legend(ncol=5,byrow=TRUE))+ |
677 geom_vline(xintercept = median(log2(spectra(msidata)[(spectra(msidata)>0)])), size = 1, colour = "black",linetype = "dashed") | 666 geom_vline(xintercept = median(log2(spectra(msidata)[(spectra(msidata)>0)])), size = 1, colour = "black",linetype = "dashed") |
678 print(hist_13) | 667 print(hist_13) |
679 | 668 |
680 ## 13d) boxplots to visualize in a different way the intensity distributions | 669 ## 14d) boxplots to visualize in a different way the intensity distributions |
681 par(mfrow = c(1,1), cex.axis=1.3, cex.lab=1.3, mar=c(13.1,4.1,5.1,2.1)) | 670 par(mfrow = c(1,1), cex.axis=1.3, cex.lab=1.3, mar=c(13.1,4.1,5.1,2.1)) |
682 | 671 |
683 mean_matrix = matrix(,ncol=0, nrow = nrow(msidata)) | 672 mean_matrix = matrix(,ncol=0, nrow = nrow(msidata)) |
684 for (subsample in levels(msidata\$combined_sample)){ | 673 for (subsample in levels(msidata\$combined_sample)){ |
685 mean_mz_sample = rowMeans(spectra(msidata)[,msidata\$combined_sample==subsample]) | 674 mean_mz_sample = rowMeans(spectra(msidata)[,msidata\$combined_sample==subsample]) |
687 | 676 |
688 boxplot(log2(mean_matrix), ylab = "log2 mean intensity per m/z", main="Mean intensities per m/z and sample", xaxt = "n") | 677 boxplot(log2(mean_matrix), ylab = "log2 mean intensity per m/z", main="Mean intensities per m/z and sample", xaxt = "n") |
689 (axis(1, at = c(1:number_combined), labels=levels(msidata\$combined_sample), cex.axis=cex_boxplot, las=2)) | 678 (axis(1, at = c(1:number_combined), labels=levels(msidata\$combined_sample), cex.axis=cex_boxplot, las=2)) |
690 } | 679 } |
691 | 680 |
692 ########################## 14) Histogram on m/z values ##################### | 681 ################################## VI) Mass spectra and m/z accuracy ######################## |
693 | 682 ############################################################################ |
694 par(mfrow = c(1, 1), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1)) | 683 print("Mass spectra and m/z accuracy") |
695 hist(mz(msidata), xlab = "m/z", main="Histogram of m/z values") | |
696 | 684 |
697 ############################ 15) Mass spectra ############################## | 685 ############################ 15) Mass spectra ############################## |
698 | 686 |
699 par(mfrow = c(2, 2)) | 687 par(mfrow = c(2, 2), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1)) |
700 pixels_for_plot = c(round(length(pixelnumber)/2, , digits=0), round(length(pixelnumber)/4, , digits=0), round(length(pixelnumber)/4*3, , digits=0)) | 688 pixels_for_plot = c(round(length(pixelnumber)/2, , digits=0), round(length(pixelnumber)/4, , digits=0), round(length(pixelnumber)/4*3, , digits=0)) |
701 plot(msidata, pixel = 1:length(pixelnumber), main= "Average spectrum") | 689 plot(msidata, pixel = 1:length(pixelnumber), main= "Average spectrum") |
702 plot(msidata, pixel = pixels_for_plot[1], main=paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[1],1:2]))) | 690 plot(msidata, pixel = pixels_for_plot[1], main=paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[1],1:2]))) |
703 plot(msidata, pixel = pixels_for_plot[2], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[2],1:2]))) | 691 plot(msidata, pixel = pixels_for_plot[2], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[2],1:2]))) |
704 plot(msidata, pixel = pixels_for_plot[3], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[3],1:2]))) | 692 plot(msidata, pixel = pixels_for_plot[3], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[3],1:2]))) |
721 maxmasspixel = features(msidata, mz=inputcalibrantmasses[mass]+3) | 709 maxmasspixel = features(msidata, mz=inputcalibrantmasses[mass]+3) |
722 | 710 |
723 ### find m/z with the highest mean intensity in m/z range (red line in plot 16) and calculate ppm difference for plot 17 | 711 ### find m/z with the highest mean intensity in m/z range (red line in plot 16) and calculate ppm difference for plot 17 |
724 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],] | 712 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],] |
725 if (nrow(filtered_data) > 0 & sum(spectra(filtered_data)) > 0){ | 713 if (nrow(filtered_data) > 0 & sum(spectra(filtered_data)) > 0){ |
726 maxmassrow = rowMeans(spectra(filtered_data)) | 714 maxmassrow = rowMeans(spectra(filtered_data)) ## for each m/z average intensity is calculated |
727 maxvalue = mz(filtered_data)[which.max(maxmassrow)] ### m/z with highestaverage intensity in m/z range | 715 maxvalue = mz(filtered_data)[which.max(maxmassrow)] ### m/z with highest average intensity in m/z range |
728 mzdifference = maxvalue - inputcalibrantmasses[mass] ### difference: theoretical value - closest m/z value | 716 mzdifference = maxvalue - inputcalibrantmasses[mass] ### difference: theoretical value - closest m/z value |
729 ppmdifference = mzdifference/inputcalibrantmasses[mass]*1000000 ### calculate ppm for accuracy measurement | 717 ppmdifference = mzdifference/inputcalibrantmasses[mass]*1000000 ### calculate ppm for accuracy measurement |
730 }else{ | 718 }else{ |
731 ppmdifference = NA | 719 ppmdifference = NA |
732 maxvalue = NA} | 720 maxvalue = NA} |
733 differencevector[mass] = round(ppmdifference, digits=2) | 721 differencevector[mass] = round(ppmdifference, digits=2) |
734 | 722 |
735 ### find m/z closest to inputcalibrant and calculate ppm difference for plot 18 | 723 ### find m/z closest to inputcalibrant and calculate ppm difference for plot 18 |
736 mznumber = features(msidata, mz = inputcalibrantmasses[mass]) ### gives closest featurenumber which is closest to given m/z | 724 mznumber = features(msidata, mz = inputcalibrantmasses[mass]) ### gives featurenumber which is closest to given m/z |
737 mzvalue = mz(msidata)[mznumber] ### gives the closest m/z | 725 mzvalue = mz(msidata)[mznumber] ### gives closest m/z |
738 mzdifference2 = mzvalue - inputcalibrantmasses[mass] | 726 mzdifference2 = mzvalue - inputcalibrantmasses[mass] |
739 ppmdifference2 = mzdifference2/inputcalibrantmasses[mass]*1000000 | 727 ppmdifference2 = mzdifference2/inputcalibrantmasses[mass]*1000000 |
740 differencevector2[mass] = round(ppmdifference2, digits=2) | 728 differencevector2[mass] = round(ppmdifference2, digits=2) |
741 | 729 |
742 par(mfrow = c(2, 2), oma=c(0,0,2,0)) | 730 par(mfrow = c(2, 2), oma=c(0,0,2,0)) |
765 if (!is.null(levels(msidata\$combined_sample))){ | 753 if (!is.null(levels(msidata\$combined_sample))){ |
766 if (number_combined < 10){ | 754 if (number_combined < 10){ |
767 key_zoomed = TRUE | 755 key_zoomed = TRUE |
768 }else{key_zoomed = FALSE} | 756 }else{key_zoomed = FALSE} |
769 par(mfrow = c(1, 1)) | 757 par(mfrow = c(1, 1)) |
770 plot(msidata[minmasspixel:maxmasspixel,], pixel=1:ncol(msidata),main="average spectrum per sample", | 758 plot(msidata[minmasspixel:maxmasspixel,], pixel=1:ncol(msidata),main="Average spectrum per sample", |
771 pixel.groups=msidata\$combined_sample, key=key_zoomed, col=hue_pal()(number_combined),superpose=TRUE) | 759 pixel.groups=msidata\$combined_sample, key=key_zoomed, col=hue_pal()(number_combined),superpose=TRUE) |
772 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="black", lty=c(3,1,3)) | 760 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="black", lty=c(3,1,3)) |
773 count=count+1 | 761 count=count+1 |
774 } | 762 } |
775 } | 763 } |
872 ]]></configfile> | 860 ]]></configfile> |
873 </configfiles> | 861 </configfiles> |
874 <inputs> | 862 <inputs> |
875 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" | 863 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" |
876 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> | 864 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> |
877 <param name="accuracy" type="float" value="50" label="Only for processed imzML files: enter mass accuracy to which the m/z values will be binned" help="This should be set to the native accuracy of the mass spectrometer, if known"/> | 865 <conditional name="processed_cond"> |
878 <param name="units" display="radio" type="select" label="Only for processed imzML files: unit of the mass accuracy" help="either m/z or ppm"> | 866 <param name="processed_file" type="select" label="Is the input file a processed imzML file "> |
879 <option value="mz" >mz</option> | 867 <option value="no_processed" selected="True">not a processed imzML</option> |
880 <option value="ppm" selected="True" >ppm</option> | 868 <option value="processed">processed imzML</option> |
881 </param> | 869 </param> |
870 <when value="no_processed"/> | |
871 <when value="processed"> | |
872 <param name="accuracy" type="float" value="50" label="Mass accuracy to which the m/z values will be binned" help="This should be set to the native accuracy of the mass spectrometer, if known"/> | |
873 <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm"> | |
874 <option value="mz" >mz</option> | |
875 <option value="ppm" selected="True" >ppm</option> | |
876 </param> | |
877 </when> | |
878 </conditional> | |
882 <param name="filename" type="text" value="" optional="true" label="Title" help="will appear as header in the quality report, if nothing given input dataset name is used"/> | 879 <param name="filename" type="text" value="" optional="true" label="Title" help="will appear as header in the quality report, if nothing given input dataset name is used"/> |
883 <param name="calibrant_file" type="data" optional="true" format="tabular" | 880 <param name="calibrant_file" type="data" optional="true" format="tabular" |
884 label="File with internal calibrants" help="first column: m/z, second column: name (optional), tabular file"/> | 881 label="File with internal calibrants" help="first column: m/z, second column: name (optional), tabular file"/> |
885 <param name="peptide_file" type="data" optional="true" format="tabular" label="File with m/z of interest" | 882 <param name="plusminus_ppm" value="50" type="float" label="ppm range" help="Will be added in both directions to input calibrant m/z"/> |
886 help="first column: m/z, second column: name (optional), tabular file"/> | |
887 <param name="plusminus_dalton" value="0.25" type="float" label="M/z range for m/z heatmaps (x-y grid)" help="Will be added in both directions to input calibrants and peptide m/z"/> | |
888 <param name="plusminus_ppm" value="50" type="float" label="Ppm range for accuracy and number of calibrants plots" help="Will be added in both directions to input calibrant m/z"/> | |
889 <repeat name="calibrantratio" title="Plot fold change of two m/z" min="0" max="10"> | 883 <repeat name="calibrantratio" title="Plot fold change of two m/z" min="0" max="10"> |
890 <param name="mass1" value="1111" type="float" label="M/z 1" help="First m/z"/> | 884 <param name="mass1" value="1111" type="float" label="M/z 1" help="First m/z"/> |
891 <param name="mass2" value="2222" type="float" label="M/z 2" help="Second m/z"/> | 885 <param name="mass2" value="2222" type="float" label="M/z 2" help="Second m/z"/> |
892 <param name="distance" value="0.25" type="float" label="M/z range" help="Plusminus m/z window added to input m/z. In both m/z ranges the maximum intensity is used to calculate the fold change"/> | 886 <param name="distance" value="0.25" type="float" label="M/z range" help="Plusminus m/z window added to input m/z. In both m/z ranges the maximum intensity is used to calculate the fold change"/> |
893 <param name="filenameratioplot" type="text" optional="true" label="Title" help="Optional title for fold change plot."/> | 887 <param name="filenameratioplot" type="text" optional="true" label="Title" help="Optional title for fold change plot."/> |
894 </repeat> | 888 </repeat> |
895 <param name="pixel_output" type="boolean" display="radio" label="Tabular with spectra information" help="Values for each spectrum (pixel) in x-y grid images"/> | 889 <param name="pixel_output" type="boolean" display="radio" label="Tabular output with spectra information"/> |
896 </inputs> | 890 </inputs> |
897 <outputs> | 891 <outputs> |
898 <data format="pdf" name="plots" from_work_dir="qualitycontrol.pdf" label = "$infile.display_name QC_report"/> | 892 <data format="pdf" name="plots" from_work_dir="qualitycontrol.pdf" label = "$infile.display_name QC_report"/> |
899 <data format="tabular" name="pixel_tabular_output" label="$infile.display_name spectra information"> | 893 <data format="tabular" name="pixel_tabular_output" label="$infile.display_name spectra information"> |
900 <filter>pixel_output</filter> | 894 <filter>pixel_output</filter> |
904 <test expect_num_outputs="2"> | 898 <test expect_num_outputs="2"> |
905 <param name="infile" value="" ftype="imzml"> | 899 <param name="infile" value="" ftype="imzml"> |
906 <composite_data value="Example_Processed.imzML"/> | 900 <composite_data value="Example_Processed.imzML"/> |
907 <composite_data value="Example_Processed.ibd"/> | 901 <composite_data value="Example_Processed.ibd"/> |
908 </param> | 902 </param> |
909 <param name="accuracy" value="200"/> | 903 <conditional name="processed_cond"> |
910 <param name="units" value="ppm"/> | 904 <param name="processed_file" value="processed"/> |
911 <param name="peptide_file" value="inputpeptides.txt"/> | 905 <param name="accuracy" value="200"/> |
906 <param name="units" value="ppm"/> | |
907 </conditional> | |
912 <param name="calibrant_file" value="inputcalibrantfile1.txt"/> | 908 <param name="calibrant_file" value="inputcalibrantfile1.txt"/> |
913 <param name="plusminus_dalton" value="0.25"/> | |
914 <param name="plusminus_ppm" value="100"/> | 909 <param name="plusminus_ppm" value="100"/> |
915 <param name="filename" value="Testfile_imzml"/> | 910 <param name="filename" value="Testfile_imzml"/> |
916 <repeat name="calibrantratio"> | 911 <repeat name="calibrantratio"> |
917 <param name="mass1" value="328.9"/> | 912 <param name="mass1" value="328.9"/> |
918 <param name="mass2" value="398.8"/> | 913 <param name="mass2" value="398.8"/> |
927 <param name="infile" value="" ftype="analyze75"> | 922 <param name="infile" value="" ftype="analyze75"> |
928 <composite_data value="Analyze75.hdr"/> | 923 <composite_data value="Analyze75.hdr"/> |
929 <composite_data value="Analyze75.img"/> | 924 <composite_data value="Analyze75.img"/> |
930 <composite_data value="Analyze75.t2m"/> | 925 <composite_data value="Analyze75.t2m"/> |
931 </param> | 926 </param> |
932 <param name="peptide_file" value="inputpeptides.txt"/> | |
933 <param name="calibrant_file" value="inputcalibrantfile2.txt"/> | 927 <param name="calibrant_file" value="inputcalibrantfile2.txt"/> |
934 <param name="plusminus_dalton" value="0.5"/> | |
935 <param name="filename" value="Testfile_analyze75"/> | 928 <param name="filename" value="Testfile_analyze75"/> |
936 <output name="plots" file="QC_analyze75.pdf" compare="sim_size" delta="20000"/> | 929 <output name="plots" file="QC_analyze75.pdf" compare="sim_size" delta="20000"/> |
937 </test> | 930 </test> |
938 <test expect_num_outputs="2"> | 931 <test expect_num_outputs="2"> |
939 <param name="infile" value="123_combined.RData" ftype="rdata"/> | 932 <param name="infile" value="123_combined.RData" ftype="rdata"/> |
940 <param name="plusminus_dalton" value="0.2"/> | |
941 <param name="filename" value="Testfile_rdata"/> | 933 <param name="filename" value="Testfile_rdata"/> |
942 <param name="pixel_output" value="True"/> | 934 <param name="pixel_output" value="True"/> |
943 <output name="pixel_tabular_output" file="spectra_info_123_combi.txt"/> | 935 <output name="pixel_tabular_output" file="spectra_info_123_combi.txt"/> |
944 <output name="plots" file="QC_rdata.pdf" compare="sim_size" delta="20000"/> | 936 <output name="plots" file="QC_rdata.pdf" compare="sim_size" delta="20000"/> |
945 </test> | 937 </test> |
946 <test expect_num_outputs="1"> | 938 <test expect_num_outputs="1"> |
947 <param name="infile" value="empty_spectra.rdata" ftype="rdata"/> | 939 <param name="infile" value="empty_spectra.rdata" ftype="rdata"/> |
948 <param name="peptide_file" value="inputpeptides.txt"/> | |
949 <param name="calibrant_file" value="inputcalibrantfile2.txt"/> | 940 <param name="calibrant_file" value="inputcalibrantfile2.txt"/> |
950 <param name="plusminus_dalton" value="0.1"/> | |
951 <param name="filename" value="Testfile_rdata"/> | 941 <param name="filename" value="Testfile_rdata"/> |
952 <output name="plots" file="QC_empty_spectra.pdf" compare="sim_size" delta="20000"/> | 942 <output name="plots" file="QC_empty_spectra.pdf" compare="sim_size" delta="20000"/> |
953 </test> | 943 </test> |
954 </tests> | 944 </tests> |
955 <help> | 945 <help> |
956 <![CDATA[ | 946 <![CDATA[ |
957 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_ | 947 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_ |
958 | 948 |
959 This tool uses some Cardinal functions to create a quality control report with descriptive plots for mass spectrometry imaging data. | 949 This tool uses Cardinal to read files and create a quality control report with descriptive plots for mass spectrometry imaging data. |
960 | 950 |
961 Input data: 3 types of input data can be used: | 951 Input data: 3 types of input data can be used: |
962 | 952 |
963 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ | 953 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ |
964 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) | 954 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) |
965 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) | 955 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) |
966 | 956 |
967 Options: | 957 Options: |
968 | 958 |
969 - internal calibrants are used for m/z heatmaps (x-y grid), heatmap of number of calibrants per spectrum (x-y grid), zoomed in mass spectra, m/z accuracy | 959 - internal calibrants are used for m/z heatmaps (x-y grid), heatmap of number of calibrants per spectrum (x-y grid), zoomed in mass spectra, m/z accuracy |
970 - m/z of interest are used to generate m/z heatmaps (x-y grid) | |
971 - optional fold change plot: draws a heatmap (x-y grid) for the fold change of two m/z (log2(intensity ratio)) | 960 - optional fold change plot: draws a heatmap (x-y grid) for the fold change of two m/z (log2(intensity ratio)) |
972 | 961 |
973 Output: | 962 Output: |
974 | 963 |
975 - quality control report as pdf with key numbers and descriptive plots describing the mass spectrometry imaging data | 964 - quality control report as pdf with key numbers and descriptive plots describing the mass spectrometry imaging data |
976 - optional spectra information as tabular file with numbers of calibrants (needs input calibrant file), numbers of peaks, TIC and most abundant m/z in each spectrum | 965 - optional spectra information as tabular file with numbers of calibrants (needs valid calibrants), numbers of peaks, TIC and most abundant m/z in each spectrum |
977 | 966 |
978 Tip: | 967 Tip: |
979 | 968 |
980 - For additional m/z heatmaps use the MSI ion images tool and to plot more mass spectra use the MSI massspectra tool. | 969 - For additional m/z heatmaps use the MSI ion images tool and to plot more mass spectra use the MSI mass spectra tool. |
970 | |
971 ---------------------------------------------------------------------------------------------------------------------------------------------------- | |
972 | |
973 Overview of the QC report plots: | |
974 | |
975 - (comb): this plots will only be drawn if several files were combined into one file with the msi_combine tool | |
976 - (cal): this plots will only be drawn if a tabular file with at least one valid calibrant m/z is provided | |
977 - (FC): this plots will only be drawn if the optional fold change image is selected | |
978 - Vertical lines in histograms represent median values. In density scatter plots the colour changes from blue to green, yellow and red the more points are overlayed. | |
979 | |
980 - Overview of file properties: Numbers and ranges for m/z features and pixels are given. Median and range across all intensity values are provided. Intensities > 0 gives the percentage of m/z-pixel pairs with an intensity above zero. The number of empty spectra (TIC = 0), the median number of peaks (intensities > 0) per spectra as well as the median TIC (total ion chromatogram) are given. The processing status of the file is provided as well as the number of valid calibrants from the provided tabular file.> 0 (Intensities > 0). | |
981 | |
982 x-y images (pixel/spectra information): | |
983 | |
984 - (comb) Spatial orientation of combined data: All pixels of a combined file have the same colour. | |
985 - Pixel order: Shows the order of the pixels in the provided file. Depending on the instrument this can represent the acquisition order. | |
986 - (cal) Number of calibrants per pixel: In every spectrum the calibrant m/z window (calibrant m/z plusminus 'ppm range') is searched for peaks (intensity > 0). Calibrants are considered present in a spectrum when they have at least one peak in their m/z window. | |
987 - (FC) Control of fold change plot: For both input m/z a zoomed in average spectrum is drawn with the input m/z as blue dashed line, the m/z range as blue dotted lines and the maximum intensity in the m/z window with a red line. | |
988 - (FC) Fold change image: For each spectrum the intensities of the two optimal m/z features (red lines in control plots) are divided and log2 transformed to obtain the fold change, which is then plotted as a heatmap. | |
989 - (cal) Intensity heatmaps for the m/z value that is closest to the calibrant m/z. The intensities are averaged within the calibrant m/z window (ppm range). | |
990 - Number of peaks per spectrum: For each spectrum the number of m/z values with intensity > 0 is calculated and plotted as heatmap. | |
991 - Total ion chromatogram: For each spectrum all intensities are summed up to obtain the TIC which is plotted as heatmap. | |
992 - Most abundant m/z in each spectrum: For each spectrum the m/z value with the highest intensity is plotted. | |
993 - PCA for two components: Result of a principal component analysis (PCA) for two components is given. The loading plot depicts the contribution of each m/z value and the x-y image represents the differences between the pixels. | |
994 | |
995 Properties over spectra/pixels: | |
996 | |
997 - Number of peaks per spectrum: Scatter plot and histogram showing the number of intensities > 0 for each spectrum. Dotted lines in the scatter plot separate spectra of combined samples. | |
998 - (comb) Number of peaks per spectrum and sample: Same histogram as in plot before but with colours to show the contribution of each combined sample. | |
999 - TIC per spectrum: Scatter plot and histogram showing the sum of all intensities per spectrum (TIC). Dotted lines in the scatter plot separate spectra of combined samples. | |
1000 - (comb) TIC per spectrum and sample: Same histogram as in plot before but with colours to show the contribution of each combined sample. | |
1001 | |
1002 Properties over m/z features: | |
1003 | |
1004 - Histogram of m/z values: Histogram of all m/z values (complete m/z axis) | |
1005 - Number of peaks per m/z: Scatter plot and histogram giving the number of intensities > 0 for each m/z. | |
1006 - Sum of intensities per m/z: Scatter plot and histogram of the sum of all intensities per m/z. | |
1007 | |
1008 Intensity plots: | |
1009 | |
1010 - Median intensity per spectrum: Scatter plot in which each point represents the median intensity for one spectrum. Dotted lines in the scatter plot separate spectra of combined samples. | |
1011 - Log2-transformed intensities: Histogram of log2-transformed intensities. | |
1012 - (comb) log2-transformed intensities per sample: Same histogram as before but with colours to show the contribution of each combined sample. | |
1013 - (comb) Mean intensities per m/z and sample: For all pixels of a sample the mean intensity for each m/z is calculated and shown as boxplot. | |
1014 | |
1015 Mass spectra and m/z accuracy: | |
1016 | |
1017 - Mass spectra over the full m/z range: First plot shows the average intensities over all spectra. The other three mass spectra are from single pixels (spectra). | |
1018 - (cal) For each calibrant four zoomed in mass spectrum are drawn: The first shows the average intensities over all spectra and the other three are single mass spectra. The theoretical calibrant m/z (taken from the input file) is represented by the dashed blue line. The dotted blue lines show the given ppm range. The green line is the m/z value that is closest to the theoretical calibrant and the red line is the m/z with the highest average intensity in the m/z window. | |
1019 - (comb) Average spectrum per sample: For each calibrant a zoomed in mass spectrum is plotted this time with the average intensities for each combined sample separately. | |
1020 - (cal) Difference m/z with max. average intensity vs. theor. calibrant m/z: The difference in ppm between the m/z with the highest average intensity and the theoretical m/z are plotted for each calibrant. This corresponds to the difference between the dashed blue line and the red line in the zoomed in mass spectra. | |
1021 - (cal) Difference closest measured m/z vs. theor. calibrant m/z: The difference in ppm between the closest m/z value and the theoretical m/z values are plotted for each calibrant. This corresponds to the difference between the dashed blue line and the green line in the zoomed in mass spectra. | |
1022 - (cal) Difference m/z with max. average intensity vs. theor. m/z (per spectrum): For each spectrum the ppm difference between the m/z with the highest average intensity and the theoretical m/z are plotted. The calibrants have different plotting colours. Dashed lines separate spectra of combined samples. | |
1023 | |
981 | 1024 |
982 ]]> | 1025 ]]> |
983 </help> | 1026 </help> |
984 <citations> | 1027 <citations> |
985 <citation type="doi">10.1093/bioinformatics/btv146</citation> | 1028 <citation type="doi">10.1093/bioinformatics/btv146</citation> |