Mercurial > repos > galaxyp > maldi_quant_peak_detection
comparison maldi_quant_peakdetection.xml @ 6:8431b33e6989 draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit 8c5cd26641af4b6206662ee525c1e7bd4205d96e"
author | galaxyp |
---|---|
date | Thu, 16 Apr 2020 21:48:53 +0000 |
parents | af766257766e |
children | 4bd085117204 |
comparison
equal
deleted
inserted
replaced
5:af766257766e | 6:8431b33e6989 |
---|---|
1 <tool id="maldi_quant_peak_detection" name="MALDIquant peak detection" version="@VERSION@.5"> | 1 <tool id="maldi_quant_peak_detection" name="MALDIquant peak detection" version="@VERSION@.6"> |
2 <description> | 2 <description> |
3 Peak detection, binning and filtering for mass-spectrometry imaging data | 3 Peak detection, binning and filtering for mass-spectrometry imaging data |
4 </description> | 4 </description> |
5 <macros> | 5 <macros> |
6 <import>maldi_macros.xml</import> | 6 <import>maldi_macros.xml</import> |
377 #if $infile.ext == 'rdata' | 377 #if $infile.ext == 'rdata' |
378 cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(peaks),,drop=FALSE] ## remove coordinates of empty spectra for Cardinal RData input | 378 cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(peaks),,drop=FALSE] ## remove coordinates of empty spectra for Cardinal RData input |
379 #end if | 379 #end if |
380 | 380 |
381 peaks = removeEmptyMassObjects(peaks) | 381 peaks = removeEmptyMassObjects(peaks) |
382 pixelnames = paste("xy", coordinates(peaks)[,1],coordinates(peaks)[,2], sep="_") | |
382 } | 383 } |
383 #end if | 384 #end if |
384 | 385 |
385 ## QC plot and numbers | 386 ## QC plot and numbers |
386 par(mfrow = c(2, 2), oma=c(0,0,2,0)) | 387 par(mfrow = c(2, 2), oma=c(0,0,2,0)) |
387 | 388 |
388 for (random_sample in random_spectra){ | 389 for (random_sample in random_spectra){ |
389 | 390 |
390 | 391 tryCatch( |
391 tryCatch( | 392 { |
392 { | 393 plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample])) |
393 plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}, | 394 },error=function(cond) |
394 error=function(cond) { | 395 { |
395 plot(NULL, xlim=c(0,0), ylim=c(0,0), ylab="intensity", xlab="m/z") | 396 plot(NULL, xlim=c(0,0), ylim=c(0,0), ylab="intensity", xlab="m/z") |
396 } | 397 } |
397 ) | 398 ) |
398 } | 399 } |
399 | 400 |
400 title("Aligned spectra", outer=TRUE, line=0) | 401 title("Aligned spectra", outer=TRUE, line=0) |
401 minmz = round(min(unlist(lapply(peaks,mass))), digits=4) | 402 minmz = round(min(unlist(lapply(peaks,mass))), digits=4) |
402 maxmz = round(max(unlist(lapply(peaks,mass))), digits=4) | 403 maxmz = round(max(unlist(lapply(peaks,mass))), digits=4) |
403 mean_features = round(length(unlist(lapply(peaks,mass)))/length(peaks), digits=2) | 404 mean_features = round(length(unlist(lapply(peaks,mass)))/length(peaks), digits=2) |
413 #if $infile.ext == 'imzml' | 414 #if $infile.ext == 'imzml' |
414 #if str($centroids) == "FALSE" | 415 #if str($centroids) == "FALSE" |
415 featureMatrix <- intensityMatrix(peaks, maldi_data) | 416 featureMatrix <- intensityMatrix(peaks, maldi_data) |
416 #end if | 417 #end if |
417 #end if | 418 #end if |
419 | |
418 featureMatrix2 =cbind(pixelnames, featureMatrix) | 420 featureMatrix2 =cbind(pixelnames, featureMatrix) |
419 colnames(featureMatrix2)[1] = c("mz") | 421 colnames(featureMatrix2)[1] = c("mz") |
420 featureMatrix2 = t(featureMatrix2) | 422 featureMatrix2 = t(featureMatrix2) |
421 write.table(featureMatrix2, file="$intensity_matrix", quote = FALSE, row.names = TRUE, col.names=FALSE, sep = "\t") | 423 write.table(featureMatrix2, file="$intensity_matrix", quote = FALSE, row.names = TRUE, col.names=FALSE, sep = "\t") |
422 }else{print("There are no spectra with peaks left")} | 424 }else{print("There are no spectra with peaks left")} |
423 | 425 |
426 | |
424 #elif str( $method.methods_conditional.method ) == 'Binning': | 427 #elif str( $method.methods_conditional.method ) == 'Binning': |
425 | 428 |
426 print('binning') | 429 print('binning') |
427 ##m/z binning | 430 ##m/z binning |
428 | 431 |
429 peaks <- binPeaks(peaks, tolerance=$method.methods_conditional.bin_tolerance, method="$method.methods_conditional.bin_method") | 432 peaks <- binPeaks(peaks, tolerance=$method.methods_conditional.bin_tolerance, method="$method.methods_conditional.bin_method") |
430 | 433 |
431 ## QC plot and numbers | 434 ## QC plot and numbers |
432 par(mfrow = c(2, 2), oma=c(0,0,2,0)) | 435 par(mfrow = c(2, 2), oma=c(0,0,2,0)) |
436 | |
433 for (random_sample in random_spectra){ | 437 for (random_sample in random_spectra){ |
434 plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))} | 438 |
439 tryCatch( | |
440 { | |
441 plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample])) | |
442 },error=function(cond) | |
443 { | |
444 plot(NULL, xlim=c(0,0), ylim=c(0,0), ylab="intensity", xlab="m/z") | |
445 } | |
446 ) | |
447 } | |
448 | |
435 title("Binned spectra", outer=TRUE, line=0) | 449 title("Binned spectra", outer=TRUE, line=0) |
436 minmz = round(min(unlist(lapply(peaks,mass))), digits=4) | 450 minmz = round(min(unlist(lapply(peaks,mass))), digits=4) |
437 maxmz = round(max(unlist(lapply(peaks,mass))), digits=4) | 451 maxmz = round(max(unlist(lapply(peaks,mass))), digits=4) |
438 mean_features = round(length(unlist(lapply(peaks,mass)))/length(peaks), digits=2) | 452 mean_features = round(length(unlist(lapply(peaks,mass)))/length(peaks), digits=2) |
439 medint =round( median(unlist(lapply(peaks,intensity))), digits=2) | 453 medint =round( median(unlist(lapply(peaks,intensity))), digits=2) |
479 mergeWhitelists=$method.methods_conditional.mergeWhitelists, label = samples) | 493 mergeWhitelists=$method.methods_conditional.mergeWhitelists, label = samples) |
480 #end if | 494 #end if |
481 | 495 |
482 ##QC plot and numbers | 496 ##QC plot and numbers |
483 par(mfrow = c(2, 2), oma=c(0,0,2,0)) | 497 par(mfrow = c(2, 2), oma=c(0,0,2,0)) |
498 | |
484 for (random_sample in random_spectra){ | 499 for (random_sample in random_spectra){ |
485 plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))} | 500 |
501 tryCatch( | |
502 { | |
503 plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample])) | |
504 },error=function(cond) | |
505 { | |
506 plot(NULL, xlim=c(0,0), ylim=c(0,0), ylab="intensity", xlab="m/z") | |
507 } | |
508 ) | |
509 } | |
510 | |
486 title("Filtered spectra", outer=TRUE, line=0) | 511 title("Filtered spectra", outer=TRUE, line=0) |
487 minmz = round(min(unlist(lapply(peaks,mass))), digits=4) | 512 minmz = round(min(unlist(lapply(peaks,mass))), digits=4) |
488 maxmz = round(max(unlist(lapply(peaks,mass))), digits=4) | 513 maxmz = round(max(unlist(lapply(peaks,mass))), digits=4) |
489 mean_features = round(length(unlist(lapply(peaks,mass)))/length(peaks), digits=2) | 514 mean_features = round(length(unlist(lapply(peaks,mass)))/length(peaks), digits=2) |
490 medint = round(median(unlist(lapply(peaks,intensity))), digits=2) | 515 medint = round(median(unlist(lapply(peaks,intensity))), digits=2) |