Mercurial > repos > galaxyp > msi_qualitycontrol
comparison msi_qualitycontrol.xml @ 5:ac786240ef07 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit ed7d3e6f1a09c78c8f71cc1bdc1a20249767f646
author | galaxyp |
---|---|
date | Sun, 11 Mar 2018 10:38:43 -0400 |
parents | fef8bd551236 |
children | 5c63fe03ed9e |
comparison
equal
deleted
inserted
replaced
4:fef8bd551236 | 5:ac786240ef07 |
---|---|
1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.7.0.3"> | 1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.7.0.4"> |
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> |
118 } | 118 } |
119 | 119 |
120 ### calculate how many input peptide masses are valid: | 120 ### calculate how many input peptide masses are valid: |
121 inputpeptides = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] | 121 inputpeptides = input_list[input_list[,1]>minmz & input_list[,1]<maxmz,] |
122 number_peptides_in = length(input_list[,1]) | 122 number_peptides_in = length(input_list[,1]) |
123 number_peptides_valid = length(inputpeptides) | 123 number_peptides_valid = length(inputpeptides[,1]) |
124 | 124 |
125 #else | 125 #else |
126 inputpeptides = data.frame(0,0) | 126 ###inputpeptides = data.frame(0,0) |
127 inputpeptides = as.data.frame(matrix(, nrow = 0, ncol = 2)) | |
127 number_peptides_in = 0 | 128 number_peptides_in = 0 |
128 number_peptides_valid = 0 | 129 number_peptides_valid = 0 |
129 #end if | 130 #end if |
130 | 131 |
131 colnames(inputpeptides) = c("mz", "name") | 132 colnames(inputpeptides) = c("mz", "name") |
138 calibrant_list = cbind(calibrant_list, calibrant_list) | 139 calibrant_list = cbind(calibrant_list, calibrant_list) |
139 } | 140 } |
140 ### calculate how many input calibrant masses are valid: | 141 ### calculate how many input calibrant masses are valid: |
141 inputcalibrants = calibrant_list[calibrant_list[,1]>minmz & calibrant_list[,1]<maxmz,] | 142 inputcalibrants = calibrant_list[calibrant_list[,1]>minmz & calibrant_list[,1]<maxmz,] |
142 number_calibrants_in = length(calibrant_list[,1]) | 143 number_calibrants_in = length(calibrant_list[,1]) |
143 number_calibrants_valid = length(inputcalibrants) | 144 number_calibrants_valid = length(inputcalibrants[,1]) |
144 #else | 145 #else |
145 inputcalibrants = data.frame(0,0) | 146 ###inputcalibrants = data.frame(0,0) |
147 | |
148 inputcalibrants = as.data.frame(matrix(, nrow = 0, ncol = 2)) | |
149 | |
146 number_calibrants_in = 0 | 150 number_calibrants_in = 0 |
147 number_calibrants_valid = 0 | 151 number_calibrants_valid = 0 |
148 #end if | 152 #end if |
149 | 153 |
150 colnames(inputcalibrants) = c("mz", "name") | 154 colnames(inputcalibrants) = c("mz", "name") |
152 ### bind inputcalibrants and inputpeptides together, to make heatmap on both lists | 156 ### bind inputcalibrants and inputpeptides together, to make heatmap on both lists |
153 | 157 |
154 inputs_all = rbind(inputcalibrants[,1:2], inputpeptides[,1:2]) | 158 inputs_all = rbind(inputcalibrants[,1:2], inputpeptides[,1:2]) |
155 inputmasses = inputs_all[,1] | 159 inputmasses = inputs_all[,1] |
156 inputnames = inputs_all[,2] | 160 inputnames = inputs_all[,2] |
161 | |
157 | 162 |
158 | 163 |
159 properties = c("Number of mz features", | 164 properties = c("Number of mz features", |
160 "Range of mz values [Da]", | 165 "Range of mz values [Da]", |
161 "Number of pixels", | 166 "Number of pixels", |
169 "Normalization", | 174 "Normalization", |
170 "Smoothing", | 175 "Smoothing", |
171 "Baseline reduction", | 176 "Baseline reduction", |
172 "Peak picking", | 177 "Peak picking", |
173 "Centroided", | 178 "Centroided", |
174 paste0("# peptides in ", "$peptide_file.display_name"), | 179 paste0("# peptides in \n", "$peptide_file.display_name"), |
175 paste0("# calibrants in ", "$calibrant_file.display_name")) | 180 paste0("# calibrants in \n", "$calibrant_file.display_name")) |
176 | 181 |
177 values = c(paste0(maxfeatures), | 182 values = c(paste0(maxfeatures), |
178 paste0(minmz, " - ", maxmz), | 183 paste0(minmz, " - ", maxmz), |
179 paste0(pixelcount), | 184 paste0(pixelcount), |
180 paste0(minimumx, " - ", maximumx), | 185 paste0(minimumx, " - ", maximumx), |
367 { | 372 { |
368 image(msidata, mz=inputmasses[mass], plusminus=$plusminus_dalton, | 373 image(msidata, mz=inputmasses[mass], plusminus=$plusminus_dalton, |
369 main= paste0("3", LETTERS[mass], ") ", inputnames[mass], " (", round(inputmasses[mass], digits = 2)," ± ", $plusminus_dalton, " Da)"), | 374 main= paste0("3", LETTERS[mass], ") ", inputnames[mass], " (", round(inputmasses[mass], digits = 2)," ± ", $plusminus_dalton, " Da)"), |
370 contrast.enhance = "histogram", ylim=c(maximumy+2, 0)) | 375 contrast.enhance = "histogram", ylim=c(maximumy+2, 0)) |
371 } | 376 } |
372 } else {print("3) The inputpeptide masses were outside the mass range")} | 377 } else {print("3) The inputpeptide masses were not provided or outside the mass range")} |
378 | |
373 | 379 |
374 ## 4) Number of peaks per pixel - image | 380 ## 4) Number of peaks per pixel - image |
375 | 381 |
376 peaksperpixel = colSums(spectra(msidata)[]> 0) | 382 peaksperpixel = colSums(spectra(msidata)[]> 0) |
377 peakscoordarray=cbind(coord(msidata), peaksperpixel) | 383 peakscoordarray=cbind(coord(msidata), peaksperpixel) |
420 | 426 |
421 ## 7) pca image for two components | 427 ## 7) pca image for two components |
422 pca = PCA(msidata, ncomp=2) | 428 pca = PCA(msidata, ncomp=2) |
423 par(mfrow = c(2,1)) | 429 par(mfrow = c(2,1)) |
424 plot(pca, col=c("black", "darkgrey"), main="7) PCA for two components") | 430 plot(pca, col=c("black", "darkgrey"), main="7) PCA for two components") |
425 image(pca, col=c("black", "white"),ylim=c(maximumy+2, 0)) | 431 image(pca, col=c("black", "white"),ylim=c(maximumy+2, 0), strip=FALSE) |
426 | 432 |
427 | 433 |
428 ############################# III) properties over acquisition (spectra index)########## | 434 ############################# III) properties over acquisition (spectra index)########## |
429 ############################################################################## | 435 ############################################################################## |
430 | 436 |
452 hist(log(TICs), main="", las=1, xlab = "log(TIC per spectrum)", ylab="") | 458 hist(log(TICs), main="", las=1, xlab = "log(TIC per spectrum)", ylab="") |
453 title(main= "9b) TIC per spectrum", line=2) | 459 title(main= "9b) TIC per spectrum", line=2) |
454 title(ylab="Frequency = # spectra", line=4) | 460 title(ylab="Frequency = # spectra", line=4) |
455 abline(v=median(log(TICs[TICs>0])), col="blue") | 461 abline(v=median(log(TICs[TICs>0])), col="blue") |
456 | 462 |
457 | |
458 ## 10) intensity of chosen peptides over acquisition (pixel index) | |
459 | |
460 if (length(inputcalibrants[,1]) != 0) | |
461 { | |
462 par(mfrow = c(3, 2), oma=c(0,0,2,0)) | |
463 intensityvector = vector() | |
464 for (mzvalue in 1:length(inputcalibrants[,1])) | |
465 { | |
466 mznumber = features(msidata, mz = inputcalibrants[,1][mzvalue]) | |
467 intensityvector = spectra(msidata)[][mznumber,] | |
468 plot(intensityvector, main=inputnames[mzvalue], xlab="Spectra index \n (= Acquisition time)") | |
469 } | |
470 title("10) intensity of calibrants over acquisition", outer=TRUE) | |
471 }else{print("10) The inputcalibrant masses were outside the mass range")} | |
472 | 463 |
473 ################################## IV) changes over mz ############################ | 464 ################################## IV) changes over mz ############################ |
474 ################################################################################### | 465 ################################################################################### |
475 | 466 |
476 ## 11) Number of peaks per mz | 467 ## 11) Number of peaks per mz |
558 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) | 549 abline(v=c(calibrant-plusminusvalue, calibrant,calibrant+plusminusvalue), col="blue", lty=c(3,5,3)) |
559 title(paste0(inputcalibrants[x,1]), outer=TRUE) | 550 title(paste0(inputcalibrants[x,1]), outer=TRUE) |
560 x=x+1 | 551 x=x+1 |
561 } | 552 } |
562 | 553 |
563 }else{print("15) The inputcalibrant masses were outside the mass range")} | 554 }else{print("15) The inputcalibrant masses were not provided or outside the mass range")} |
564 | 555 |
565 dev.off() | 556 dev.off() |
566 }else{ | 557 }else{ |
567 print("inputfile has no intensities > 0") | 558 print("inputfile has no intensities > 0") |
568 dev.off() | 559 dev.off() |
623 <output name="plots" file="Testfile_qualitycontrol_analyze75.pdf" compare="sim_size" delta="20000"/> | 614 <output name="plots" file="Testfile_qualitycontrol_analyze75.pdf" compare="sim_size" delta="20000"/> |
624 </test> | 615 </test> |
625 | 616 |
626 <test> | 617 <test> |
627 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> | 618 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> |
628 <param name="peptide_file" value="inputpeptides.csv" ftype="txt"/> | |
629 <param name="calibrant_file" ftype="txt" value="inputcalibrantfile1.txt"/> | |
630 <param name="plusminus_dalton" value="0.1"/> | 619 <param name="plusminus_dalton" value="0.1"/> |
631 <param name="filename" value="Testfile_rdata"/> | 620 <param name="filename" value="Testfile_rdata"/> |
632 <output name="plots" file="Testfile_qualitycontrol_rdata.pdf" compare="sim_size" delta="20000"/> | 621 <output name="plots" file="Testfile_qualitycontrol_rdata.pdf" compare="sim_size" delta="20000"/> |
633 </test> | 622 </test> |
634 <test> | 623 <test> |