Mercurial > repos > galaxyp > msi_qualitycontrol
comparison msi_qualitycontrol.xml @ 4:fef8bd551236 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
author | galaxyp |
---|---|
date | Thu, 01 Mar 2018 08:25:48 -0500 |
parents | f6aa0cff777c |
children | ac786240ef07 |
comparison
equal
deleted
inserted
replaced
3:f6aa0cff777c | 4:fef8bd551236 |
---|---|
1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.7.0.2"> | 1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.7.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.7.0">bioconductor-cardinal</requirement> | 6 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement> |
32 library(ggplot2) | 32 library(ggplot2) |
33 library(RColorBrewer) | 33 library(RColorBrewer) |
34 library(gridExtra) | 34 library(gridExtra) |
35 library(KernSmooth) | 35 library(KernSmooth) |
36 | 36 |
37 ## Read MALDI Imagind dataset | 37 ## Read MALDI Imaging dataset |
38 | 38 |
39 #if $infile.ext == 'imzml' | 39 #if $infile.ext == 'imzml' |
40 msidata <- readMSIData('infile.imzML') | 40 msidata = readMSIData('infile.imzML') |
41 #elif $infile.ext == 'analyze75' | 41 #elif $infile.ext == 'analyze75' |
42 msidata <- readMSIData('infile.hdr') | 42 msidata = readMSIData('infile.hdr') |
43 | 43 |
44 #else | 44 #else |
45 load('infile.RData') | 45 load('infile.RData') |
46 #end if | 46 #end if |
47 | 47 |
48 #if $inputpeptidefile: | |
49 ### Read tabular file with peptide masses for plots and heatmap images: | |
50 input_list = read.delim("$inputpeptidefile", header = FALSE, na.strings=c("","NA", "#NUM!", "#ZAHL!"), stringsAsFactors = FALSE) | |
51 if (ncol(input_list) == 1) | |
52 { | |
53 input_list = cbind(input_list, input_list) | |
54 } | |
55 #else | |
56 input_list = data.frame(0, 0) | |
57 #end if | |
58 colnames(input_list)[1:2] = c("mz", "name") | |
59 | |
60 #if $inputcalibrants: | |
61 ### Read tabular file with calibrant masses: | |
62 calibrant_list = read.delim("$inputcalibrants", header = FALSE, na.strings=c("","NA", "#NUM!", "#ZAHL!"), stringsAsFactors = FALSE) | |
63 if (ncol(calibrant_list) == 1) | |
64 { | |
65 calibrant_list = cbind(calibrant_list, calibrant_list) | |
66 } | |
67 #else | |
68 calibrant_list = data.frame(0,0) | |
69 #end if | |
70 | |
71 colnames(calibrant_list)[1:2] = c("mz", "name") | |
72 | 48 |
73 | 49 |
74 ###################################### file properties in numbers ###################### | 50 ###################################### file properties in numbers ###################### |
75 | 51 |
76 ## Number of features (mz) | 52 ## Number of features (mz) |
129 peakpickinginfo='FALSE' | 105 peakpickinginfo='FALSE' |
130 } else { | 106 } else { |
131 peakpickinginfo=processinginfo@peakPicking | 107 peakpickinginfo=processinginfo@peakPicking |
132 } | 108 } |
133 | 109 |
134 ### calculate how many input peptide masses are valid: | 110 ### Read tabular file with peptide masses for plots and heatmap images: |
135 inputpeptides = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] | 111 |
136 | 112 #if $peptide_file: |
137 ### calculate how many input calibrant masses are valid: | 113 |
138 inputcalibrants = calibrant_list[calibrant_list[,1]>minmz & calibrant_list[,1]<maxmz,] | 114 input_list = read.delim("$peptide_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE) |
115 if (ncol(input_list) == 1) | |
116 { | |
117 input_list = cbind(input_list, input_list) | |
118 } | |
119 | |
120 ### calculate how many input peptide masses are valid: | |
121 inputpeptides = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] | |
122 number_peptides_in = length(input_list[,1]) | |
123 number_peptides_valid = length(inputpeptides) | |
124 | |
125 #else | |
126 inputpeptides = data.frame(0,0) | |
127 number_peptides_in = 0 | |
128 number_peptides_valid = 0 | |
129 #end if | |
130 | |
131 colnames(inputpeptides) = c("mz", "name") | |
132 | |
133 #if $calibrant_file: | |
134 ### Read tabular file with calibrant masses: | |
135 calibrant_list = read.delim("$calibrant_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE) | |
136 if (ncol(calibrant_list) == 1) | |
137 { | |
138 calibrant_list = cbind(calibrant_list, calibrant_list) | |
139 } | |
140 ### calculate how many input calibrant masses are valid: | |
141 inputcalibrants = calibrant_list[calibrant_list[,1]>minmz & calibrant_list[,1]<maxmz,] | |
142 number_calibrants_in = length(calibrant_list[,1]) | |
143 number_calibrants_valid = length(inputcalibrants) | |
144 #else | |
145 inputcalibrants = data.frame(0,0) | |
146 number_calibrants_in = 0 | |
147 number_calibrants_valid = 0 | |
148 #end if | |
149 | |
150 colnames(inputcalibrants) = c("mz", "name") | |
139 | 151 |
140 ### bind inputcalibrants and inputpeptides together, to make heatmap on both lists | 152 ### bind inputcalibrants and inputpeptides together, to make heatmap on both lists |
141 | 153 |
142 inputs_all = rbind(inputcalibrants[,1:2], inputpeptides[,1:2]) | 154 inputs_all = rbind(inputcalibrants[,1:2], inputpeptides[,1:2]) |
143 inputmasses = inputs_all[,1] | 155 inputmasses = inputs_all[,1] |
157 "Normalization", | 169 "Normalization", |
158 "Smoothing", | 170 "Smoothing", |
159 "Baseline reduction", | 171 "Baseline reduction", |
160 "Peak picking", | 172 "Peak picking", |
161 "Centroided", | 173 "Centroided", |
162 paste0("# valid masses in ", "$filename")) | 174 paste0("# peptides in ", "$peptide_file.display_name"), |
175 paste0("# calibrants in ", "$calibrant_file.display_name")) | |
163 | 176 |
164 values = c(paste0(maxfeatures), | 177 values = c(paste0(maxfeatures), |
165 paste0(minmz, " - ", maxmz), | 178 paste0(minmz, " - ", maxmz), |
166 paste0(pixelcount), | 179 paste0(pixelcount), |
167 paste0(minimumx, " - ", maximumx), | 180 paste0(minimumx, " - ", maximumx), |
174 paste0(normalizationinfo), | 187 paste0(normalizationinfo), |
175 paste0(smoothinginfo), | 188 paste0(smoothinginfo), |
176 paste0(baselinereductioninfo), | 189 paste0(baselinereductioninfo), |
177 paste0(peakpickinginfo), | 190 paste0(peakpickinginfo), |
178 paste0(centroidedinfo), | 191 paste0(centroidedinfo), |
179 paste0(length(inputmasses), "/", length(calibrant_list[,1])+length(input_list[,1]))) | 192 paste0(number_peptides_valid, " / " , number_peptides_in), |
193 paste0(number_calibrants_valid, " / ", number_calibrants_in)) | |
180 | 194 |
181 | 195 |
182 property_df = data.frame(properties, values) | 196 property_df = data.frame(properties, values) |
183 | 197 |
184 ######################################## PDF ############################################# | 198 ######################################## PDF ############################################# |
205 plot_colorByDensity = function(x1,x2, | 219 plot_colorByDensity = function(x1,x2, |
206 ylim=c(min(x2),max(x2)), | 220 ylim=c(min(x2),max(x2)), |
207 xlim=c(min(x1),max(x1)), | 221 xlim=c(min(x1),max(x1)), |
208 xlab="",ylab="",main=""){ | 222 xlab="",ylab="",main=""){ |
209 | 223 |
210 df <- data.frame(x1,x2) | 224 df = data.frame(x1,x2) |
211 x <- densCols(x1,x2, colramp=colorRampPalette(c("black", "white"))) | 225 x = densCols(x1,x2, colramp=colorRampPalette(c("black", "white"))) |
212 df\$dens <- col2rgb(x)[1,] + 1L | 226 df\$dens = col2rgb(x)[1,] + 1L |
213 cols <- colorRampPalette(c("#000099", "#00FEFF", "#45FE4F","#FCFF00", "#FF9400", "#FF3100"))(256) | 227 cols = colorRampPalette(c("#000099", "#00FEFF", "#45FE4F","#FCFF00", "#FF9400", "#FF3100"))(256) |
214 df\$col <- cols[df\$dens] | 228 df\$col = cols[df\$dens] |
215 plot(x2~x1, data=df[order(df\$dens),], | 229 plot(x2~x1, data=df[order(df\$dens),], |
216 ylim=ylim,xlim=xlim,pch=20,col=col, | 230 ylim=ylim,xlim=xlim,pch=20,col=col, |
217 cex=1,xlab=xlab,ylab=ylab,las=1, | 231 cex=1,xlab=xlab,ylab=ylab,las=1, |
218 main=main) | 232 main=main) |
219 } | 233 } |
220 | 234 |
221 ## Variables for plots | |
222 xrange = 1 | |
223 yrange = 1 | |
224 maxx = max(coord(msidata)[,1])+xrange | |
225 minx = min(coord(msidata)[,1])-xrange | |
226 maxy = max(coord(msidata)[,2])+yrange | |
227 miny = min(coord(msidata)[,2])-yrange | |
228 | 235 |
229 ############################################################################ | 236 ############################################################################ |
230 | 237 |
231 ## 1) Acquisition image | 238 ## 1) Acquisition image |
232 | 239 |
247 | 254 |
248 if (length(inputcalibrantmasses) != 0) | 255 if (length(inputcalibrantmasses) != 0) |
249 { for (calibrantnr in 1:length(inputcalibrantmasses)) | 256 { for (calibrantnr in 1:length(inputcalibrantmasses)) |
250 { | 257 { |
251 calibrantmz = inputcalibrantmasses[calibrantnr] | 258 calibrantmz = inputcalibrantmasses[calibrantnr] |
252 calibrantfeaturemin = features(msidata, mz=calibrantmz-$plusminusinDalton) | 259 calibrantfeaturemin = features(msidata, mz=calibrantmz-$plusminus_dalton) |
253 calibrantfeaturemax = features(msidata, mz=calibrantmz+$plusminusinDalton) | 260 calibrantfeaturemax = features(msidata, mz=calibrantmz+$plusminus_dalton) |
254 | 261 |
255 if (calibrantfeaturemin == calibrantfeaturemax) | 262 if (calibrantfeaturemin == calibrantfeaturemax) |
256 { | 263 { |
257 | 264 |
258 calibrantintensity = spectra(msidata)[calibrantfeaturemin,] | 265 calibrantintensity = spectra(msidata)[calibrantfeaturemin,] |
265 pixelmatrix = rbind(pixelmatrix, calibrantintensity) | 272 pixelmatrix = rbind(pixelmatrix, calibrantintensity) |
266 } | 273 } |
267 | 274 |
268 countvector= as.factor(colSums(pixelmatrix>0)) | 275 countvector= as.factor(colSums(pixelmatrix>0)) |
269 countdf= cbind(coord(msidata), countvector) | 276 countdf= cbind(coord(msidata), countvector) |
270 mycolours = c("black","grey", "darkblue", "blue", "green" , "red", "yellow", "magenta", "olivedrap1", "lightseagreen") | 277 mycolours = c("black","grey", "darkblue", "blue", "green" , "red", "yellow", "magenta", "olivedrab1", "lightseagreen") |
271 | 278 |
272 print(ggplot(countdf, aes(x=x, y=y, fill=countvector)) | 279 print(ggplot(countdf, aes(x=x, y=y, fill=countvector)) |
273 + geom_tile() + coord_fixed() | 280 + geom_tile() + coord_fixed() |
274 + ggtitle("2) Number of calibrants per pixel") | 281 + ggtitle("2) Number of calibrants per pixel") |
275 + theme_bw() | 282 + theme_bw() |
276 + theme(text=element_text(family="ArialMT", face="bold", size=12)) | 283 + theme(text=element_text(family="ArialMT", face="bold", size=12)) |
277 + scale_fill_manual(values = mycolours[1:length(countvector)], | 284 + scale_fill_manual(values = mycolours[1:length(countvector)], |
278 na.value = "black", name = "# calibrants")) | 285 na.value = "black", name = "# calibrants")) |
279 }else{print("2) The inputcalibrant masses were outside the mass range")} | 286 }else{print("2) The inputcalibrant masses were not provided or outside the mass range")} |
280 | 287 |
281 | 288 |
282 ############# new 2b) image of foldchanges (log2 intensity ratios) between two masses in the same spectrum | 289 ############# new 2b) image of foldchanges (log2 intensity ratios) between two masses in the same spectrum |
283 | 290 |
284 #if $calibrantratio: | 291 #if $calibrantratio: |
304 mzdown1 = features(msidata, mz = mass1-2) | 311 mzdown1 = features(msidata, mz = mass1-2) |
305 mzup1 = features(msidata, mz = mass1+3) | 312 mzup1 = features(msidata, mz = mass1+3) |
306 mzdown2 = features(msidata, mz = mass2-2) | 313 mzdown2 = features(msidata, mz = mass2-2) |
307 mzup2 = features(msidata, mz = mass2+3) | 314 mzup2 = features(msidata, mz = mass2+3) |
308 | 315 |
309 ### plot the part which was chosen, with chosen value in blue, distance in blue, maxmass in red, xlim fixed to 5 Da window | 316 ### find mass in the given range with the highest intensity (will be plotted in red) |
310 | 317 |
311 if (mzrowdown1 == mzrowup1) | 318 if (mzrowdown1 == mzrowup1) |
312 { | 319 { |
313 maxmassrow1 = spectra(msidata)[mzrowup1,] | 320 maxmass1 = mz(msidata)[ mzrowdown1] |
314 maxmass1 = mz(msidata)[mzrowup1][which.max(maxmassrow1)] | 321 }else{ ### for all masses in the massrange calculate mean intensity over all pixels and take mass which has highest mean |
315 }else{ | |
316 maxmassrow1 = rowMeans(spectra(msidata)[mzrowdown1:mzrowup1,]) | 322 maxmassrow1 = rowMeans(spectra(msidata)[mzrowdown1:mzrowup1,]) |
317 maxmass1 = mz(msidata)[mzrowdown1:mzrowup1][which.max(maxmassrow1)] | 323 maxmass1 = mz(msidata)[mzrowdown1:mzrowup1][which.max(maxmassrow1)] |
318 } | 324 } |
319 if (mzrowdown2 == mzrowup2) | 325 if (mzrowdown2 == mzrowup2) |
320 { | 326 { |
321 maxmassrow2 = spectra(msidata)[mzrowup2,] | 327 maxmass2 = mz(msidata)[mzrowup2] |
322 maxmass2 = mz(msidata)[mzrowup2][which.max(maxmassrow2)] | |
323 }else{ | 328 }else{ |
324 maxmassrow2 = rowMeans(spectra(msidata)[mzrowdown2:mzrowup2,]) | 329 maxmassrow2 = rowMeans(spectra(msidata)[mzrowdown2:mzrowup2,]) |
325 maxmass2 = mz(msidata)[mzrowdown2:mzrowup2][which.max(maxmassrow2)] | 330 maxmass2 = mz(msidata)[mzrowdown2:mzrowup2][which.max(maxmassrow2)] |
326 } | 331 } |
327 | 332 |
333 ### plot the part which was chosen, with chosen value in blue, distance in blue, maxmass in red, xlim fixed to 5 Da window | |
328 par(mfrow=c(2,1), oma=c(0,0,2,0)) | 334 par(mfrow=c(2,1), oma=c(0,0,2,0)) |
329 plot(msidata[mzdown1:mzup1,], pixel = 1:pixelcount, main=paste0("average spectrum ", mass1, " Da")) | 335 plot(msidata[mzdown1:mzup1,], pixel = 1:pixelcount, main=paste0("average spectrum ", mass1, " Da")) |
330 abline(v=c(mass1-distance, mass1, mass1+distance), col="blue",lty=c(3,5,3)) | 336 abline(v=c(mass1-distance, mass1, mass1+distance), col="blue",lty=c(3,5,3)) |
331 abline(v=maxmass1, col="red", lty=5) | 337 abline(v=maxmass1, col="red", lty=5) |
332 | 338 |
337 | 343 |
338 ### filter spectra for maxmass to have two vectors, which can be divided | 344 ### filter spectra for maxmass to have two vectors, which can be divided |
339 | 345 |
340 mass1vector = spectra(msidata)[features(msidata, mz = maxmass1),] | 346 mass1vector = spectra(msidata)[features(msidata, mz = maxmass1),] |
341 mass2vector = spectra(msidata)[features(msidata, mz = maxmass2),] | 347 mass2vector = spectra(msidata)[features(msidata, mz = maxmass2),] |
342 | |
343 foldchange = log2(mass1vector/mass2vector) | 348 foldchange = log2(mass1vector/mass2vector) |
344 | 349 |
345 ratiomatrix = cbind(foldchange, coord(msidata)) | 350 ratiomatrix = cbind(foldchange, coord(msidata)) |
346 | 351 |
347 print(ggplot(ratiomatrix, aes(x=x, y=y, fill=foldchange), colour=colo) | 352 print(ggplot(ratiomatrix, aes(x=x, y=y, fill=foldchange), colour=colo) |
358 | 363 |
359 par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0) | 364 par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0) |
360 if (length(inputmasses) != 0) | 365 if (length(inputmasses) != 0) |
361 { for (mass in 1:length(inputmasses)) | 366 { for (mass in 1:length(inputmasses)) |
362 { | 367 { |
363 image(msidata, mz=inputmasses[mass], plusminus=$plusminusinDalton, | 368 image(msidata, mz=inputmasses[mass], plusminus=$plusminus_dalton, |
364 main= paste0("3", LETTERS[mass], ") ", inputnames[mass], " (", round(inputmasses[mass], digits = 2)," ± ", $plusminusinDalton, " Da)"), | 369 main= paste0("3", LETTERS[mass], ") ", inputnames[mass], " (", round(inputmasses[mass], digits = 2)," ± ", $plusminus_dalton, " Da)"), |
365 contrast.enhance = "histogram", ylim=c(maxy+1, 0)) | 370 contrast.enhance = "histogram", ylim=c(maximumy+2, 0)) |
366 } | 371 } |
367 } else {print("3) The inputpeptide masses were outside the mass range")} | 372 } else {print("3) The inputpeptide masses were outside the mass range")} |
368 | 373 |
369 ## 4) Number of peaks per pixel - image | 374 ## 4) Number of peaks per pixel - image |
370 | 375 |
379 + scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") | 384 + scale_fill_gradientn(colours = c("blue", "purple" , "red","orange") |
380 ,space = "Lab", na.value = "black", name = "# peaks")) | 385 ,space = "Lab", na.value = "black", name = "# peaks")) |
381 | 386 |
382 ## 5) TIC image | 387 ## 5) TIC image |
383 TICcoordarray=cbind(coord(msidata), TICs) | 388 TICcoordarray=cbind(coord(msidata), TICs) |
384 colo <- colorRampPalette( | 389 colo = colorRampPalette( |
385 c("blue", "cyan", "green", "yellow","red")) | 390 c("blue", "cyan", "green", "yellow","red")) |
386 print(ggplot(TICcoordarray, aes(x=x, y=y, fill=TICs), colour=colo) | 391 print(ggplot(TICcoordarray, aes(x=x, y=y, fill=TICs), colour=colo) |
387 + geom_tile() + coord_fixed() | 392 + geom_tile() + coord_fixed() |
388 + ggtitle("5) Total Ion Chromatogram") | 393 + ggtitle("5) Total Ion Chromatogram") |
389 + theme_bw() | 394 + theme_bw() |
412 | 417 |
413 secondhighestmz = names(sort(table(round(highestmz_matrix\$highestmzinDa, digits=0)), decreasing=TRUE)[2]) | 418 secondhighestmz = names(sort(table(round(highestmz_matrix\$highestmzinDa, digits=0)), decreasing=TRUE)[2]) |
414 secondhighestmz_pixel = which(round(highestmz_matrix\$highestmzinDa, digits=0) == secondhighestmz)[1] | 419 secondhighestmz_pixel = which(round(highestmz_matrix\$highestmzinDa, digits=0) == secondhighestmz)[1] |
415 | 420 |
416 ## 7) pca image for two components | 421 ## 7) pca image for two components |
417 pca <- PCA(msidata, ncomp=2) | 422 pca = PCA(msidata, ncomp=2) |
418 par(mfrow = c(2,1)) | 423 par(mfrow = c(2,1)) |
419 plot(pca, col=c("black", "darkgrey"), main="7) PCA for two components") | 424 plot(pca, col=c("black", "darkgrey"), main="7) PCA for two components") |
420 image(pca, col=c("black", "white"),ylim=c(maxy+1, 0)) | 425 image(pca, col=c("black", "white"),ylim=c(maximumy+2, 0)) |
421 | 426 |
422 | 427 |
423 ############################# III) properties over acquisition (spectra index)########## | 428 ############################# III) properties over acquisition (spectra index)########## |
424 ############################################################################## | 429 ############################################################################## |
425 | 430 |
434 hist(peaksperpixel, main="", las=1, xlab = "Number of peaks per spectrum", ylab="") | 439 hist(peaksperpixel, main="", las=1, xlab = "Number of peaks per spectrum", ylab="") |
435 title(main="8b) Number of peaks per spectrum", line=2) | 440 title(main="8b) Number of peaks per spectrum", line=2) |
436 title(ylab="Frequency = # spectra", line=4) | 441 title(ylab="Frequency = # spectra", line=4) |
437 abline(v=median(peaksperpixel), col="blue") | 442 abline(v=median(peaksperpixel), col="blue") |
438 | 443 |
439 ## 9a) TIC per spectrum - density scatterplot | 444 ## 9a) TIC per spectrum - density scatterplot |
440 zero=0 | 445 zero=0 |
441 par(mfrow = c(2,1), mar=c(5,6,4,2)) | 446 par(mfrow = c(2,1), mar=c(5,6,4,2)) |
442 plot_colorByDensity(pixels(msidata), TICs, ylab = "", xlab = "", main="9a) TIC per pixel") | 447 plot_colorByDensity(pixels(msidata), TICs, ylab = "", xlab = "", main="9a) TIC per pixel") |
443 title(xlab="Spectra index \n (= Acquisition time)", line=3) | 448 title(xlab="Spectra index \n (= Acquisition time)", line=3) |
444 title(ylab = "Total ion chromatogram intensity", line=4) | 449 title(ylab = "Total ion chromatogram intensity", line=4) |
531 plot(msidata, pixel =round(length(pixelnumber)/2, digits=0), main="Spectrum in middle of acquisition") | 536 plot(msidata, pixel =round(length(pixelnumber)/2, digits=0), main="Spectrum in middle of acquisition") |
532 plot(msidata, pixel = highestmz_pixel, main= paste0("Spectrum at ", rownames(coord(msidata)[highestmz_pixel,]))) | 537 plot(msidata, pixel = highestmz_pixel, main= paste0("Spectrum at ", rownames(coord(msidata)[highestmz_pixel,]))) |
533 plot(msidata, pixel = secondhighestmz_pixel, main= paste0("Spectrum at ", rownames(coord(msidata)[secondhighestmz_pixel,]))) | 538 plot(msidata, pixel = secondhighestmz_pixel, main= paste0("Spectrum at ", rownames(coord(msidata)[secondhighestmz_pixel,]))) |
534 | 539 |
535 ## 15) Zoomed in mass spectra for calibrants | 540 ## 15) Zoomed in mass spectra for calibrants |
536 plusminusvalue = $plusminusinDalton | 541 plusminusvalue = $plusminus_dalton |
537 x = 1 | 542 x = 1 |
538 if (length(inputcalibrantmasses) != 0) | 543 if (length(inputcalibrantmasses) != 0) |
539 { | 544 { |
540 | 545 |
541 for (calibrant in inputcalibrantmasses) | 546 for (calibrant in inputcalibrantmasses) |
543 minmasspixel = features(msidata, mz=calibrant-1) | 548 minmasspixel = features(msidata, mz=calibrant-1) |
544 maxmasspixel = features(msidata, mz=calibrant+3) | 549 maxmasspixel = features(msidata, mz=calibrant+3) |
545 par(mfrow = c(2, 2), oma=c(0,0,2,0)) | 550 par(mfrow = c(2, 2), oma=c(0,0,2,0)) |
546 plot(msidata[minmasspixel:maxmasspixel,], pixel = 1:length(pixelnumber), main= "average spectrum") | 551 plot(msidata[minmasspixel:maxmasspixel,], pixel = 1:length(pixelnumber), main= "average spectrum") |
547 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) | 552 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) |
548 plot(msidata[minmasspixel:maxmasspixel,], pixel =round(pixelnumber/2, digits=0), main="pixel in middle of acquisition") | 553 plot(msidata[minmasspixel:maxmasspixel,], pixel =round(length(pixelnumber)/2, digits=0), main="pixel in middle of acquisition") |
549 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) | 554 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) |
550 plot(msidata[minmasspixel:maxmasspixel,], pixel = highestmz_pixel,main= paste0("Spectrum at ", rownames(coord(msidata)[highestmz_pixel,]))) | 555 plot(msidata[minmasspixel:maxmasspixel,], pixel = highestmz_pixel,main= paste0("Spectrum at ", rownames(coord(msidata)[highestmz_pixel,]))) |
551 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) | 556 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) |
552 plot(msidata[minmasspixel:maxmasspixel,], pixel = secondhighestmz_pixel, main= paste0("Spectrum at ", rownames(coord(msidata)[secondhighestmz_pixel,]))) | 557 plot(msidata[minmasspixel:maxmasspixel,], pixel = secondhighestmz_pixel, main= paste0("Spectrum at ", rownames(coord(msidata)[secondhighestmz_pixel,]))) |
553 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) | 558 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) |
567 </configfiles> | 572 </configfiles> |
568 <inputs> | 573 <inputs> |
569 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" | 574 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" |
570 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> | 575 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> |
571 <param name="filename" type="text" value="" optional="true" label="Title" help="will appear in the quality report. If nothing given it will take the dataset name."/> | 576 <param name="filename" type="text" value="" optional="true" label="Title" help="will appear in the quality report. If nothing given it will take the dataset name."/> |
572 <param name="inputpeptidefile" type="data" optional="true" format="txt, csv" label="Text file with peptidemasses and names" | 577 <param name="peptide_file" type="data" optional="true" format="tabular" label="Text file with peptidemasses and names" |
573 help="first column peptide m/z, second column peptide name, tab separated file"/> | 578 help="first column peptide m/z, second column peptide name, tab separated file"/> |
574 <param name="inputcalibrants" type="data" optional="true" format="txt,csv" | 579 <param name="calibrant_file" type="data" optional="true" format="tabular" |
575 label="Internal calibrants" | 580 label="Internal calibrants" |
576 help="Used for plot number of calibrant per spectrum and for zoomed in mass spectra"/> | 581 help="Used for plot number of calibrant per spectrum and for zoomed in mass spectra"/> |
577 <param name="plusminusinDalton" value="0.25" type="text" label="Mass range" help="plusminus mass window in Dalton"/> | 582 <param name="plusminus_dalton" value="0.25" type="text" label="Mass range" help="plusminus mass window in Dalton"/> |
578 <repeat name="calibrantratio" title="Plot fold change of two masses for each spectrum" min="0" max="10"> | 583 <repeat name="calibrantratio" title="Plot fold change of two masses for each spectrum" min="0" max="10"> |
579 <param name="mass1" value="1111" type="float" label="Mass 1" help="First mass in Dalton"/> | 584 <param name="mass1" value="1111" type="float" label="Mass 1" help="First mass in Dalton"/> |
580 <param name="mass2" value="2222" type="float" label="Mass 2" help="Second mass in Dalton"/> | 585 <param name="mass2" value="2222" type="float" label="Mass 2" help="Second mass in Dalton"/> |
581 <param name="distance" value="0.25" type="float" label="Distance in Dalton" help="Distance in Da used to find peak maximum from input masses in both directions"/> | 586 <param name="distance" value="0.25" type="float" label="Distance in Dalton" help="Distance in Da used to find peak maximum from input masses in both directions"/> |
582 <param name="filenameratioplot" type="text" optional="true" label="Title" help="Optional title for fold change plot."/> | 587 <param name="filenameratioplot" type="text" optional="true" label="Title" help="Optional title for fold change plot."/> |
590 <test> | 595 <test> |
591 <param name="infile" value="" ftype="imzml"> | 596 <param name="infile" value="" ftype="imzml"> |
592 <composite_data value="Example_Continuous.imzML" /> | 597 <composite_data value="Example_Continuous.imzML" /> |
593 <composite_data value="Example_Continuous.ibd" /> | 598 <composite_data value="Example_Continuous.ibd" /> |
594 </param> | 599 </param> |
595 <param name="inputpeptidefile" value="inputpeptides.csv" ftype="csv"/> | 600 <param name="peptide_file" value="inputpeptides.csv" ftype="csv"/> |
596 <param name="inputcalibrants" ftype="txt" value="inputcalibrantfile1.txt"/> | 601 <param name="calibrant_file" ftype="txt" value="inputcalibrantfile1.txt"/> |
597 <param name="plusminusinDalton" value="0.25"/> | 602 <param name="plusminus_dalton" value="0.25"/> |
598 <param name="filename" value="Testfile_imzml"/> | 603 <param name="filename" value="Testfile_imzml"/> |
599 <repeat name="calibrantratio"> | 604 <repeat name="calibrantratio"> |
600 <param name="mass1" value="111"/> | 605 <param name="mass1" value="111"/> |
601 <param name="mass2" value="222"/> | 606 <param name="mass2" value="222"/> |
602 <param name="distance" value="0.25"/> | 607 <param name="distance" value="0.25"/> |
608 <param name="filenameratioplot" value = "Ratio of mass1 (111) / mass2 (222)"/> | |
603 </repeat> | 609 </repeat> |
604 <output name="plots" file="Testfile_qualitycontrol_imzml.pdf" compare="sim_size" delta="20000"/> | 610 <output name="plots" file="Testfile_qualitycontrol_imzml.pdf" compare="sim_size" delta="20000"/> |
605 </test> | 611 </test> |
606 | 612 |
607 <test> | 613 <test> |
608 <param name="infile" value="" ftype="analyze75"> | 614 <param name="infile" value="" ftype="analyze75"> |
609 <composite_data value="Analyze75.hdr"/> | 615 <composite_data value="Analyze75.hdr"/> |
610 <composite_data value="Analyze75.img"/> | 616 <composite_data value="Analyze75.img"/> |
611 <composite_data value="Analyze75.t2m"/> | 617 <composite_data value="Analyze75.t2m"/> |
612 </param> | 618 </param> |
613 <param name="inputpeptidefile" value="inputpeptides.txt" ftype="txt"/> | 619 <param name="peptide_file" value="inputpeptides.txt" ftype="txt"/> |
614 <param name="inputcalibrants" ftype="txt" value="inputcalibrantfile2.txt"/> | 620 <param name="calibrant_file" ftype="txt" value="inputcalibrantfile2.txt"/> |
615 <param name="plusminusinDalton" value="0.5"/> | 621 <param name="plusminus_dalton" value="0.5"/> |
616 <param name="filename" value="Testfile_analyze75"/> | 622 <param name="filename" value="Testfile_analyze75"/> |
617 <output name="plots" file="Testfile_qualitycontrol_analyze75.pdf" compare="sim_size" delta="20000"/> | 623 <output name="plots" file="Testfile_qualitycontrol_analyze75.pdf" compare="sim_size" delta="20000"/> |
618 </test> | 624 </test> |
619 | 625 |
620 <test> | 626 <test> |
621 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> | 627 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> |
622 <param name="inputpeptidefile" value="inputpeptides.csv" ftype="txt"/> | 628 <param name="peptide_file" value="inputpeptides.csv" ftype="txt"/> |
623 <param name="inputcalibrants" ftype="txt" value="inputcalibrantfile1.txt"/> | 629 <param name="calibrant_file" ftype="txt" value="inputcalibrantfile1.txt"/> |
624 <param name="plusminusinDalton" value="0.1"/> | 630 <param name="plusminus_dalton" value="0.1"/> |
625 <param name="filename" value="Testfile_rdata"/> | 631 <param name="filename" value="Testfile_rdata"/> |
626 <output name="plots" file="Testfile_qualitycontrol_rdata.pdf" compare="sim_size" delta="20000"/> | 632 <output name="plots" file="Testfile_qualitycontrol_rdata.pdf" compare="sim_size" delta="20000"/> |
627 </test> | 633 </test> |
628 <test> | 634 <test> |
629 <param name="infile" value="LM8_file16.rdata" ftype="rdata"/> | 635 <param name="infile" value="LM8_file16.rdata" ftype="rdata"/> |
630 <param name="inputpeptidefile" value="inputpeptides.txt" ftype="txt"/> | 636 <param name="peptide_file" value="inputpeptides.txt" ftype="txt"/> |
631 <param name="inputcalibrants" ftype="txt" value="inputcalibrantfile2.txt"/> | 637 <param name="calibrant_file" ftype="txt" value="inputcalibrantfile2.txt"/> |
632 <param name="plusminusinDalton" value="0.1"/> | 638 <param name="plusminus_dalton" value="0.1"/> |
633 <param name="filename" value="Testfile_rdata"/> | 639 <param name="filename" value="Testfile_rdata"/> |
634 <output name="plots" file="LM8_file16output.pdf" compare="sim_size" delta="20000"/> | 640 <output name="plots" file="LM8_file16output.pdf" compare="sim_size" delta="20000"/> |
635 </test> | 641 </test> |
636 </tests> | 642 </tests> |
637 <help> | 643 <help> |
638 <![CDATA[ | 644 <![CDATA[ |
639 Quality control for maldi imaging mass spectrometry data. | 645 Quality control for maldi imaging mass spectrometry data. The output of this tool contains key values and plots of the imaging data as pdf. |
640 | 646 For additional beautiful heatmap images use the MSI ion images tool and to plot more mass spectra use the MSI massspectra tool. |
641 | 647 |
642 Input data: 3 types of input data can be used: | 648 Input data: 3 types of input data can be used: |
643 | 649 |
644 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <http://ms-imaging.org/wp/introduction/>`_ | 650 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <http://ms-imaging.org/wp/introduction/>`_ |
645 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) | 651 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) |
646 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) | 652 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) |
647 | 653 |
648 The output of this tool contains key values and plots of the imaging data as pdf. | 654 |
649 | 655 |
650 ]]> | 656 ]]> |
651 </help> | 657 </help> |
652 <citations> | 658 <citations> |
653 <citation type="doi">10.1093/bioinformatics/btv146</citation> | 659 <citation type="doi">10.1093/bioinformatics/btv146</citation> |