# HG changeset patch # User galaxyp # Date 1528752792 14400 # Node ID 693a8efdfdeb1b29b1bd5f2b0e4dcaf832f73272 # Parent 7e4797d9f7cadccd9044b09fdc30113ef71b5e69 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_spectra_plots commit a7be47698f53eb4f00961192327d93e8989276a7 diff -r 7e4797d9f7ca -r 693a8efdfdeb msi_spectra_plots.xml --- a/msi_spectra_plots.xml Mon May 28 12:35:32 2018 -0400 +++ b/msi_spectra_plots.xml Mon Jun 11 17:33:12 2018 -0400 @@ -1,4 +1,4 @@ - + mass spectrometry imaging mass spectra plots @@ -24,6 +24,7 @@ 0 npeaks= sum(spectra(msidata)[]>0) -## Spectra multiplied with mz (potential number of peaks) +## Spectra multiplied with m/z (potential number of peaks) numpeaks = ncol(spectra(msidata)[])*nrow(spectra(msidata)[]) ## Percentage of intensities > 0 percpeaks = round(npeaks/numpeaks*100, digits=2) @@ -99,8 +100,8 @@ peakpickinginfo=processinginfo@peakPicking } -properties = c("Number of mz features", - "Range of mz values [Da]", +properties = c("Number of m/z features", + "Range of m/z values [Da]", "Number of pixels", "Range of x coordinates", "Range of y coordinates", @@ -133,8 +134,6 @@ property_df = data.frame(properties, values) -print("before pdf") - ######################################## PDF ################################### ################################################################################ ################################################################################ @@ -142,62 +141,50 @@ pdf("mzplots.pdf", fonts = "Times", pointsize = 12) plot(0,type='n',axes=FALSE,ann=FALSE) - -title(main=paste0("Plotted mass spectra for file: \n\n", "$infile.display_name")) +#if not $filename: + #set $filename = $infile.display_name +#end if +title(main=paste0("Plotted mass spectra for file: \n\n","$filename")) ############################# I) numbers ###################################### ############################################################################### -print("in pdf") grid.table(property_df, rows= NULL) - +if (npeaks > 0){ -if (npeaks > 0) -{ pixeldf = data.frame(matrix(ncol = 2, nrow=0)) + ############################# single pixel ################################ + ########################################################################### #if str( $pixel_conditional.pixel_type) == 'single_pixel': - print("single_pixel") + print("single_pixel") #for $chosenpixel in $pixel_conditional.repeatpixel: - pixelisvalid = as.character($chosenpixel.inputx %in% coord(msidata)\$x & $chosenpixel.inputy %in% coord(msidata)\$y) pixelname = paste0("x=", $chosenpixel.inputx,", ", "y=", $chosenpixel.inputy) - print(pixelname) - print(colnames(pixeldf)) - print(colnames(cbind(pixelname, pixelisvalid))) pixeldf = rbind(pixeldf, cbind(pixelname, pixelisvalid)) - print(colnames(pixeldf)) ############################# II) control image #################### - #################################################################### - - if (pixelisvalid == "TRUE") - { + if (pixelisvalid == "TRUE"){ + print(pixelisvalid) - print(pixelisvalid) - - - image(msidata, mz=$chosenpixel.inputmz, - ylim = c(maximumy+(0.2*maximumy),minimumy-1),colorkey=FALSE, plusminus = $chosenpixel.plusminusinDalton, contrast.enhance = "histogram", - main= paste0("x= ",$chosenpixel.inputx, ", y= ", $chosenpixel.inputy)) + image(msidata, mz=$chosenpixel.inputmz, ylim = c(maximumy+(0.2*maximumy),minimumy-1), + colorkey=FALSE, plusminus = $chosenpixel.plusminusinDalton, contrast.enhance = "histogram", + main= paste0("x= ",$chosenpixel.inputx, ", y= ", $chosenpixel.inputy)) abline(v=$chosenpixel.inputx, col ="$chosenpixel.inputcolour", lty="$chosenpixel.inputtype", lwd=$chosenpixel.inputwidth) abline(h=$chosenpixel.inputy, col ="$chosenpixel.inputcolour", lty="$chosenpixel.inputtype", lwd=$chosenpixel.inputwidth) - ##################### III) plot full mass spectrum ################# - #################################################################### plot(msidata, coord=list(x=$chosenpixel.inputx, y=$chosenpixel.inputy)) ##################### IV) plot zoom-in mass spectrum ############### - #################################################################### #if $chosenpixel.zoomedplot: #for $token in $chosenpixel.zoomedplot: @@ -210,33 +197,39 @@ #end for #end if - }else{ print("The pixel coordinates did not correspond to a real pixel")} - #end for colnames(pixeldf) = c("pixel coordinates", "coordinates were found in this file") - #elif str( $pixel_conditional.pixel_type) == 'sample_pixel': - print("sample_pixel") + + ############################# sample pixel ################################ + ########################################################################### - ##################### I) Sample: plot full mass spectrum ########### - plot(msidata, pixel=1:ncol(msidata), pixel.groups=pData(msidata)\$sample, key=TRUE, col=c("blue", "orange", "green", "red", "yellow", "grey"), superpose=TRUE) + #elif str( $pixel_conditional.pixel_type) == 'sample_pixel': + print("sample_pixel") - ##################### II) Sample: plot zoom-in mass spectrum ####### + ##################### I) Sample: plot full mass spectrum ############## + + plot(msidata, pixel=1:ncol(msidata), pixel.groups=msidata\$combined_sample, key=TRUE, col=c("blue", "orange", "green", "red", "yellow", "grey"), superpose=TRUE) + + ##################### II) Sample: plot zoom-in mass spectrum ########## #if $pixel_conditional.zoomed_sample: #for $token in $pixel_conditional.zoomed_sample: minmasspixel = features(msidata, mz=$token.xlimmin) maxmasspixel = features(msidata, mz=$token.xlimmax) - plot(msidata[minmasspixel:maxmasspixel,], pixel=1:ncol(msidata), xlim= c($token.xlimmin,$token.xlimmax),pixel.groups=pData(msidata)\$sample, key=TRUE,col=c("blue", "orange", "green", "red", "yellow", "grey"), superpose=TRUE) + + plot(msidata[minmasspixel:maxmasspixel,], pixel=1:ncol(msidata), + xlim= c($token.xlimmin,$token.xlimmax),pixel.groups=msidata\$combined_sample, + key=TRUE,col=c("blue", "orange", "green", "red", "yellow", "grey"), superpose=TRUE) #end for #end if - pixeldf = data.frame(table(pData(msidata)\$sample)) + pixeldf = data.frame(table(msidata\$combined_sample)) colnames(pixeldf) = c("sample name", "number of pixels") #end if @@ -247,7 +240,6 @@ dev.off() - }else{ print("Inputfile has no intensities > 0") dev.off() @@ -257,6 +249,7 @@ + @@ -266,8 +259,8 @@ - - + + @@ -283,22 +276,22 @@ - - - + + + - - - + + + - + @@ -313,12 +306,12 @@ - - + + - - + + @@ -364,7 +357,7 @@ - + @@ -395,7 +388,7 @@ Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal `_ -This tool uses the Cardinal plot function to generate (zoomed in) mass spectra plots of mass-spectrometry imaging data. +This tool uses the Cardinal plot function to generate (zoomed in) mass spectra plots of mass spectrometry imaging data. Input data: 3 types of input data can be used: @@ -405,23 +398,23 @@ Options: -- "single pixel": Returns a full mass-spectrum plot for one pixel, which is defined by its x- and y-coordinates +- "single pixel": Returns a full mass spectrum plot for one pixel, which is defined by its x- and y-coordinates - Enter the x and y coordinates of your pixel of interest - - To have a visual control for the selected pixel, a heatmap of a mass of interest will be drawn. Two intersecting lines will show the pixel location. This procedure requires an mass of interest together with a mass range and for the lines the colour and type. - - Additionally zoom into mass-spectra plots is possible by providing the minimum and maximum mass value to define the limits of the plot -- "All pixels of a sample": Returns a full average mass-spectrum plot with different colours for each subfile + - To have a visual control for the selected pixel, a heatmap of a m/z of interest will be drawn. Two intersecting lines will show the pixel location. This procedure requires an m/z of interest together with a m/z range and for the lines the colour and type. + - Additionally zoom into mass spectra plots is possible by providing the minimum and maximum m/z value to define the limits of the plot +- "All pixels of a sample": Returns a full average mass spectrum plot with different colours for each subfile - This option only works on files that have previosly been combined in the combine tool - - Additionally zoom into mass-spectra plots is possible by providing the minimum and maximum mass value to define the limits of the plot + - Additionally zoom into mass spectra plots is possible by providing the minimum and maximum m/z value to define the limits of the plot Output: -- Pdf with the selected mass-spectra plots and additional control plots +- Pdf with the selected mass spectra plots and additional control plots Tip: -- Corresponding peaklists with masses and their intensities can be obtained with the filtering tool option "ranges for x and y" +- Corresponding mass spectra with m/z intensity pairs as tabular output can be obtained with the filtering tool option "ranges for x and y" ]]> diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/123_combined.RData Binary file test-data/123_combined.RData has changed diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/123_combined.rdata Binary file test-data/123_combined.rdata has changed diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/Example_Continuous.ibd Binary file test-data/Example_Continuous.ibd has changed diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/Example_Continuous.imzML --- a/test-data/Example_Continuous.imzML Mon May 28 12:35:32 2018 -0400 +++ b/test-data/Example_Continuous.imzML Mon Jun 11 17:33:12 2018 -0400 @@ -1,373 +1,313 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/Plot_analyze75.pdf Binary file test-data/Plot_analyze75.pdf has changed diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/Plot_empty_spectra.pdf Binary file test-data/Plot_empty_spectra.pdf has changed diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/Plot_imzml.pdf Binary file test-data/Plot_imzml.pdf has changed diff -r 7e4797d9f7ca -r 693a8efdfdeb test-data/Plot_rdata.pdf Binary file test-data/Plot_rdata.pdf has changed