# HG changeset patch # User galaxyp # Date 1584655614 0 # Node ID af766257766e366706aec1600c1aa8e835050965 # Parent c6b47c89a2f599a722719a82a3f068bf35767fe9 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit 218c44b9ba1b5f0f47edb743ed70075fb661386e" diff -r c6b47c89a2f5 -r af766257766e maldi_quant_peakdetection.xml --- a/maldi_quant_peakdetection.xml Fri Mar 22 08:30:45 2019 -0400 +++ b/maldi_quant_peakdetection.xml Thu Mar 19 22:06:54 2020 +0000 @@ -1,4 +1,4 @@ - + Peak detection, binning and filtering for mass-spectrometry imaging data @@ -16,9 +16,10 @@ cp '${infile.extra_files_path}/img' infile.img && cp '${infile.extra_files_path}/t2m' infile.t2m && #else - ln -s $infile infile.RData && + ln -s '$infile' infile.RData && #end if - Rscript '${maldi_quant_peak_detection}'&& + cat '${maldi_quant_peak_detection}' && + Rscript '${maldi_quant_peak_detection}' && mkdir $outfile_imzml.files_path && mv ./out.imzMl "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true && mv ./out.ibd "${os.path.join($outfile_imzml.files_path, 'ibd')}" | true && @@ -359,16 +360,43 @@ ## 2) warp spectra: peaks_new_list = warpMassPeaks(list(peaks[[pixelnb]]), warping_function, emptyNoMatches=$method.methods_conditional.empty_nomatch) } - peaks_new = peaks_new_list + peaks = peaks_new_list #end if #end if + #if $method.methods_conditional.remove_empty: + print(paste(length(findEmptyMassObjects(peaks)), " empty spectra were removed", sep=" ")) + + ## only if there are empty spectra to remove + + if (length(findEmptyMassObjects(peaks))>0) + + { + #if $infile.ext == 'rdata' + cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(peaks),,drop=FALSE] ## remove coordinates of empty spectra for Cardinal RData input + #end if + + peaks = removeEmptyMassObjects(peaks) + } + #end if + ## QC plot and numbers par(mfrow = c(2, 2), oma=c(0,0,2,0)) + for (random_sample in random_spectra){ - plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))} + + + tryCatch( + { + plot(peaks[[random_sample]], sub="", main=paste0("spectrum ", pixelnames[random_sample]))}, + error=function(cond) { + plot(NULL, xlim=c(0,0), ylim=c(0,0), ylab="intensity", xlab="m/z") + } + ) +} + title("Aligned spectra", outer=TRUE, line=0) minmz = round(min(unlist(lapply(peaks,mass))), digits=4) maxmz = round(max(unlist(lapply(peaks,mass))), digits=4)