# HG changeset patch # User galaxyp # Date 1530900881 14400 # Node ID 4f13aec6d8ffa55139e7a7e7e9159d5e1b0c58ce # Parent 9eef2792afa4cc46eb61b8046a5a025fbfb33cf6 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_spectra_plots commit 8087490eb4dcaf4ead0f03eae4126780d21e5503 diff -r 9eef2792afa4 -r 4f13aec6d8ff msi_spectra_plots.xml --- a/msi_spectra_plots.xml Tue Jun 19 18:08:52 2018 -0400 +++ b/msi_spectra_plots.xml Fri Jul 06 14:14:41 2018 -0400 @@ -1,4 +1,4 @@ - + mass spectrometry imaging mass spectra plots @@ -34,10 +34,15 @@ library(ggplot2) library(scales) + #if $infile.ext == 'imzml' - msidata <- readImzML('infile', mass.accuracy=$accuracy, units.accuracy = "$units") + #if str($processed_cond.processed_file) == "processed": + msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units") + #else + msidata <- readImzML('infile', attach.only=TRUE) + #end if #elif $infile.ext == 'analyze75' - msidata = readAnalyze('infile') + msidata = readAnalyze('infile', attach.only=TRUE) #else load('infile.RData') #end if @@ -58,19 +63,20 @@ minimumy = min(coord(msidata)[,2]) maximumy = max(coord(msidata)[,2]) ## Range of intensities -minint = round(min(spectra(msidata)[]), digits=2) -maxint = round(max(spectra(msidata)[]), digits=2) -medint = round(median(spectra(msidata)[]), digits=2) +minint = round(min(spectra(msidata)[], na.rm=TRUE), digits=2) +maxint = round(max(spectra(msidata)[], na.rm=TRUE), digits=2) +medint = round(median(spectra(msidata)[], na.rm=TRUE), digits=2) ## Number of intensities > 0 -npeaks= sum(spectra(msidata)[]>0) +npeaks= sum(spectra(msidata)[]>0, na.rm=TRUE) ## 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) ## Number of empty TICs -TICs = colSums(spectra(msidata)[]) +TICs = colSums(spectra(msidata)[], na.rm=TRUE) NumemptyTIC = sum(TICs == 0) + ## Processing informations processinginfo = processingData(msidata) centroidedinfo = processinginfo@centroided @@ -176,7 +182,7 @@ print(pixelisvalid) image(msidata, mz=$chosenpixel.inputmz, ylim = c(maximumy+(0.2*maximumy),minimumy-1), - colorkey=FALSE, plusminus = $chosenpixel.plusminusinDalton, contrast.enhance = "histogram", + colorkey=FALSE, plusminus = $chosenpixel.plusminusinDalton, main= paste0("x= ",$chosenpixel.inputx, ", y= ", $chosenpixel.inputy)) abline(v=$chosenpixel.inputx, col ="$chosenpixel.inputcolour", lty="$chosenpixel.inputtype", lwd=$chosenpixel.inputwidth) @@ -189,6 +195,8 @@ ##################### IV) plot zoom-in mass spectrum ############### #if $chosenpixel.zoomedplot: + iData(msidata) <- iData(msidata)[] ## getting back data on disk + #for $token in $chosenpixel.zoomedplot: minmasspixel = features(msidata, mz=$token.xlimmin) @@ -205,7 +213,6 @@ colnames(pixeldf) = c("pixel coordinates", "coordinates were found in this file") - ############################# sample pixel ################################ ########################################################################### @@ -260,13 +267,17 @@ key_legend = TRUE }else{key_legend = FALSE} + spectra(msidata) = is.na(spectra(msidata)[]) == 0 ## in case of NA values they will be set to zero + plot(msidata, pixel=1:ncol(msidata), pixel.groups=msidata\$combined_sample, key=key_legend, col=hue_pal()(length(levels(msidata\$combined_sample))),superpose=TRUE) }else{ + spectra(msidata) = is.na(spectra(msidata)[]) == 0 ## in case of NA values they will be set to zero plot(msidata, pixel=1:ncol(msidata), key=TRUE)} ##################### II) Sample: plot zoom-in mass spectrum ########## #if $pixel_conditional.zoomed_sample: + iData(msidata) <- iData(msidata)[] ## getting back data on disk #for $token in $pixel_conditional.zoomed_sample: print("zoomed sample pixels") @@ -284,6 +295,7 @@ #end for #end if + if (!is.null(levels(msidata\$combined_sample))){ pixeldf = data.frame(table(msidata\$combined_sample)) }else{ @@ -292,6 +304,11 @@ #end if + +############################# pixel table ###################################### +############################################################################### + + ### overview table of pixels or samples: plot(0,type='n',axes=FALSE,ann=FALSE) title(main="Overview of chosen pixel:") @@ -327,16 +344,25 @@ - - - - - + + + + + + + + + + + + + + - + - + diff -r 9eef2792afa4 -r 4f13aec6d8ff test-data/Plot_analyze75.pdf Binary file test-data/Plot_analyze75.pdf has changed diff -r 9eef2792afa4 -r 4f13aec6d8ff test-data/Plot_analyze75_allpixels.pdf Binary file test-data/Plot_analyze75_allpixels.pdf has changed diff -r 9eef2792afa4 -r 4f13aec6d8ff test-data/Plot_empty_spectra.pdf Binary file test-data/Plot_empty_spectra.pdf has changed diff -r 9eef2792afa4 -r 4f13aec6d8ff test-data/Plot_imzml.pdf Binary file test-data/Plot_imzml.pdf has changed diff -r 9eef2792afa4 -r 4f13aec6d8ff test-data/Plot_rdata.pdf Binary file test-data/Plot_rdata.pdf has changed