# HG changeset patch # User galaxyp # Date 1630221015 0 # Node ID c56906ee67d33e060b5db7bf89e3a4e2a2291a0d # Parent 006fc980af6312906b51ff720e427d44c4eb5e17 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit c8d3adac445b4e08e2724e22d7201bfc38bbf40f" diff -r 006fc980af63 -r c56906ee67d3 macros.xml --- a/macros.xml Tue Nov 03 22:35:49 2020 +0000 +++ b/macros.xml Sun Aug 29 07:10:15 2021 +0000 @@ -1,5 +1,5 @@ - 2.6.0 + 2.10.0 diff -r 006fc980af63 -r c56906ee67d3 spectra_plots.xml --- a/spectra_plots.xml Tue Nov 03 22:35:49 2020 +0000 +++ b/spectra_plots.xml Sun Aug 29 07:10:15 2021 +0000 @@ -1,4 +1,4 @@ - + mass spectrometry imaging mass spectra plots @@ -6,7 +6,7 @@ macros.xml - r-ggplot2 + r-ggplot2 r-gridextra r-scales @@ -66,24 +66,28 @@ ## read and extract x,y, optional annotation information spectra_tabular = read.delim("$pixel_conditional.pixel_file", header = $pixel_conditional.tabular_pixel_header, stringsAsFactors = FALSE) - #if $pixel_conditional.column_pixel_annotation: + #if str($pixel_conditional.single_or_overlaid.plot_type) == 'overlaid_plots': - spectra_input = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y, $pixel_conditional.column_pixel_annotation)] + spectra_input = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y, $pixel_conditional.single_or_overlaid.column_pixel_annotation)] colnames(spectra_input) = c("x", "y", "annotation") - + spectra_input\$annotation = as.character(spectra_input\$annotation) + + ## keeping only spectra with annotations input_pixels = paste(spectra_input[,1], spectra_input[,2], sep="_") dataset_pixels = paste(coord(msidata)\$x, coord(msidata)\$y, sep="_") pixelsofinterest = dataset_pixels %in% input_pixels msidata = msidata[,pixelsofinterest] - ## merge with coordinate information of msidata msidata_coordinates = data.frame(coord(msidata)\$x, coord(msidata)\$y, c(1:ncol(msidata))) colnames(msidata_coordinates) = c("x", "y", "pixel_index") merged_annotation = merge(msidata_coordinates, spectra_input, by=c("x", "y"), all.x=TRUE) merged_annotation[is.na(merged_annotation)] = "NA" merged_annotation = merged_annotation[order(merged_annotation\$pixel_index),] msidata\$annotation = factor(merged_annotation[,4], levels = unique(as.character(merged_annotation[,4]))) ## keep the right order - + +print(msidata\$annotation) +print(merged_annotation) + ## overview plot over annotated samples number_combined = length(levels(msidata\$annotation)) @@ -100,9 +104,23 @@ legend_size = 6 } + ## colours selection: + + #if str($pixel_conditional.single_or_overlaid.colour_conditional.colour_type) == "manual_colour" + #set $color_string = ','.join(['"%s"' % $color.annotation_color for $color in $pixel_conditional.single_or_overlaid.colour_conditional.colours]) + colourvector = c($color_string) + + #elif str($pixel_conditional.single_or_overlaid.colour_conditional.colour_type) == "colourpalette" + + number_levels = (length(levels(msidata\$annotation))) + + colourvector = noquote($pixel_conditional.single_or_overlaid.colour_conditional.palettes)(number_levels) + + #end if + position_df = data.frame(coord(msidata)\$x, coord(msidata)\$y, as.factor(msidata\$annotation)) colnames(position_df) = c("x", "y", "sample_name") - +print(position_df) combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ geom_tile(height = 1, width=1)+ coord_fixed()+ @@ -111,15 +129,17 @@ theme(plot.title = element_text(hjust = 0.5))+ theme(text=element_text(family="ArialMT", face="bold", size=12))+ theme(legend.position="bottom",legend.direction="vertical")+ - theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = 6))+ - guides(fill=guide_legend(ncol=4,byrow=TRUE)) + theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = 10))+ + guides(fill=guide_legend(ncol=4,byrow=TRUE))+ + scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector) - coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass") - coord_labels\$file_number = 1:length(levels(position_df\$sample_name)) + coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass") + coord_labels\$file_number = 1:nrow(coord_labels) for(file_count in 1:nrow(coord_labels)) - {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"], - y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))} + {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"], + y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4])) + } print(combine_plot) @@ -130,13 +150,12 @@ #if $fullmz: ## plot single tabular mz, average per annotation - print(plot(msidata, run="infile", pixel.groups=msidata\$annotation, key=key_legend, col=hue_pal()(length(levels(msidata\$annotation))),superpose=TRUE, strip=FALSE, grid=$grid_variable), main="Average spectrum per group") + print(plot(msidata, run="infile", pixel.groups=msidata\$annotation, key=key_legend,superpose=TRUE, strip=FALSE, grid=$grid_variable, col = colourvector), main="Average spectrum per group") #end if pixeldf = data.frame(table(msidata\$annotation)) colnames(pixeldf) = c("sample name", "number of pixels") - ##################### II) Sample: plot zoom-in mass spectrum ########## #if str($mz_range.mz_range_options) == "manual_mz": @@ -165,9 +184,9 @@ ) ## plot single tabular mz, average per annotation, manual zoom - print(plot(msidata[minmasspixel:maxmasspixel,], run="infile", strip=FALSE, + print(plot(msidata[minmasspixel:maxmasspixel,], run="infile", strip=FALSE, col = colourvector, xlim= c($token.xlimmin,$token.xlimmax),pixel.groups=msidata\$annotation, grid = $grid_variable, - key=key_legend,col=hue_pal()(length(levels(msidata\$annotation))), superpose=TRUE, main="Average spectrum per group")) + key=key_legend, superpose=TRUE, main="Average spectrum per group")) #end for #elif str($mz_range.mz_range_options) == "tabular_mz": @@ -186,17 +205,18 @@ ## plot single tabular mz, average per annotation, tabular zoom print(plot(msidata[minmasspixel:maxmasspixel,], run="infile", strip=FALSE, main="Average spectrum per group", - xlim= c(xlimmin,xlimmax),pixel.groups=msidata\$annotation, grid = $grid_variable, - key=key_legend,col=hue_pal()(length(levels(msidata\$annotation))), superpose=TRUE)) + xlim= c(xlimmin,xlimmax),pixel.groups=msidata\$annotation, grid = $grid_variable, col = colourvector, + key=key_legend, superpose=TRUE)) + } } #end if + #elif str($pixel_conditional.single_or_overlaid.plot_type) == 'separate_plots': - #elif str($pixel_conditional.column_pixel_annotation)== "None": - spectra_tabular = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y)] - colnames(spectra_tabular) = c("x", "y") + spectra_tabular = spectra_tabular[,c($pixel_conditional.column_pixel_x, $pixel_conditional.column_pixel_y)] + colnames(spectra_tabular) = c("x", "y") dataset_pixels = data.frame(coord(msidata)\$x, coord(msidata)\$y) colnames(dataset_pixels) = c("x", "y") @@ -261,7 +281,17 @@ } ## print single tabular mz; manual zoom - print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c($token.xlimmin,$token.xlimmax), col="black")) + + tryCatch( + { + print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c($token.xlimmin,$token.xlimmax), col="black")) + } + , + error=function(cond) { + ## if there are no intensities > 0 in the chosen plotting window, write a warning + text(0.5,0.5,labels = c(paste("No peaks in the spectrum with the coordinates x =", x_coord, ", y =", y_coord, sep=" "))) + } + ) #end for @@ -456,17 +486,53 @@ - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -554,19 +620,33 @@ - + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + diff -r 006fc980af63 -r c56906ee67d3 test-data/Heatmaps_LM8_file16.pdf Binary file test-data/Heatmaps_LM8_file16.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Heatmaps_analyze75.pdf Binary file test-data/Heatmaps_analyze75.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Heatmaps_imzml.pdf Binary file test-data/Heatmaps_imzml.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Heatmaps_processed.pdf Binary file test-data/Heatmaps_processed.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Heatmaps_rdata.pdf Binary file test-data/Heatmaps_rdata.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Plot_analyze75.pdf Binary file test-data/Plot_analyze75.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Plot_analyze75_allpixels.pdf Binary file test-data/Plot_analyze75_allpixels.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Plot_imzml.pdf Binary file test-data/Plot_imzml.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Plot_picked.pdf Binary file test-data/Plot_picked.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Plot_processed.pdf Binary file test-data/Plot_processed.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/Plot_rdata.pdf Binary file test-data/Plot_rdata.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/QC_imzml_shortreport.pdf Binary file test-data/QC_imzml_shortreport.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/centroids_proc.pdf Binary file test-data/centroids_proc.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/pixels_test6.tabular --- a/test-data/pixels_test6.tabular Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/pixels_test6.tabular Sun Aug 29 07:10:15 2021 +0000 @@ -1,25 +1,25 @@ -pixel names x y predicted condition -xy_1_1 1 1 A -xy_2_1 2 1 A -xy_3_1 3 1 B -xy_4_1 4 1 C -xy_1_2 1 2 C -xy_2_2 2 2 C -xy_3_2 3 2 A -xy_4_2 4 2 A -xy_1_3 1 3 A -xy_2_3 2 3 B -xy_3_3 3 3 C -xy_4_3 4 3 A -xy_10_1 10 1 C -xy_11_1 11 1 C -xy_12_1 12 1 C -xy_13_1 13 1 B -xy_10_2 10 2 C -xy_11_2 11 2 B -xy_12_2 12 2 C -xy_13_2 13 2 C -xy_10_3 10 3 C -xy_11_3 11 3 C -xy_12_3 12 3 B -xy_13_3 13 3 C +pixel names x y predicted condition A B C +xy_1_1 1 1 A 0.434439526064797 0.195646317191818 0.369914156743386 +xy_2_1 2 1 A 0.38219998209377 0.242372158141275 0.375427859764956 +xy_3_1 3 1 B 0.312531499299517 0.385612104162858 0.301856396537625 +xy_4_1 4 1 C 0.393153488582866 0.191107087820634 0.4157394235965 +xy_1_2 1 2 C 0.366986470447772 0.216121568441093 0.416891961111135 +xy_2_2 2 2 C 0.381682206547616 0.213188918797062 0.405128874655322 +xy_3_2 3 2 A 0.376695037169723 0.260689491088564 0.362615471741713 +xy_4_2 4 2 A 0.42305935188829 0.174038449100755 0.402902199010954 +xy_1_3 1 3 A 0.382420991383021 0.249364697048677 0.368214311568302 +xy_2_3 2 3 B 0.272145998315727 0.446525938567718 0.281328063116555 +xy_3_3 3 3 C 0.36296987427851 0.255631013944556 0.381399111776934 +xy_4_3 4 3 A 0.444812272103175 0.132274264153212 0.422913463743613 +xy_10_1 10 1 C 0.376216993893763 0.227584528606788 0.39619847749945 +xy_11_1 11 1 C 0.358430578177403 0.236120068794936 0.405449353027661 +xy_12_1 12 1 C 0.359751662628136 0.218620985552221 0.421627351819643 +xy_13_1 13 1 B 0.101486342705225 0.813997511218961 0.0845161460758142 +xy_10_2 10 2 C 0.354612526523361 0.272635192773437 0.372752280703202 +xy_11_2 11 2 B 0.291635599769993 0.444466545540823 0.263897854689184 +xy_12_2 12 2 C 0.36763798979782 0.203911653614431 0.428450356587749 +xy_13_2 13 2 C 0.344608135177236 0.304026642707691 0.351365222115073 +xy_10_3 10 3 C 0.37046458150651 0.205561286708086 0.423974131785404 +xy_11_3 11 3 C 0.358113833435286 0.262878459144526 0.379007707420187 +xy_12_3 12 3 B 0.180921926305915 0.66902588624642 0.150052187447665 +xy_13_3 13 3 C 0.378266307042675 0.20859472985319 0.413138963104135 diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results1.ibd Binary file test-data/preprocessing_results1.ibd has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results1.imzml --- a/test-data/preprocessing_results1.imzml Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results1.imzml Sun Aug 29 07:10:15 2021 +0000 @@ -9,8 +9,8 @@ - - + + @@ -86,15 +86,15 @@ - - + + - - - + + + @@ -115,15 +115,15 @@ - - + + - - - + + + @@ -144,15 +144,15 @@ - - + + - - - + + + @@ -173,15 +173,15 @@ - - + + - - - + + + @@ -202,15 +202,15 @@ - - + + - - - + + + @@ -231,15 +231,15 @@ - - + + - - - + + + @@ -260,15 +260,15 @@ - - + + - - - + + + @@ -289,15 +289,15 @@ - - + + - - - + + + @@ -318,15 +318,15 @@ - - + + - - - + + + diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results1.imzml.txt --- a/test-data/preprocessing_results1.imzml.txt Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results1.imzml.txt Sun Aug 29 07:10:15 2021 +0000 @@ -1,4 +1,4 @@ imzML file: total 24 --rw-rw-r-- 1 meli meli 216 Oct 5 19:57 ibd --rw-rw-r-- 1 meli meli 18090 Oct 5 19:57 imzml +-rw-rw-r-- 1 meli meli 336 Nov 29 01:14 ibd +-rw-rw-r-- 1 meli meli 18092 Nov 29 01:14 imzml diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results1.pdf Binary file test-data/preprocessing_results1.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results2.ibd Binary file test-data/preprocessing_results2.ibd has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results2.imzml --- a/test-data/preprocessing_results2.imzml Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results2.imzml Sun Aug 29 07:10:15 2021 +0000 @@ -9,8 +9,8 @@ - - + + diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results2.imzml.txt --- a/test-data/preprocessing_results2.imzml.txt Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results2.imzml.txt Sun Aug 29 07:10:15 2021 +0000 @@ -1,4 +1,4 @@ imzML file: total 64 --rw-rw-r-- 1 meli meli 37404 Oct 5 19:57 ibd --rw-rw-r-- 1 meli meli 22796 Oct 5 19:57 imzml +-rw-rw-r-- 1 meli meli 37404 Nov 29 18:03 ibd +-rw-rw-r-- 1 meli meli 22796 Nov 29 18:03 imzml diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results2.pdf Binary file test-data/preprocessing_results2.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results3.ibd Binary file test-data/preprocessing_results3.ibd has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results3.imzml --- a/test-data/preprocessing_results3.imzml Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results3.imzml Sun Aug 29 07:10:15 2021 +0000 @@ -9,9 +9,9 @@ - - - + + + @@ -86,15 +86,15 @@ - - + + - - - + + + @@ -114,16 +114,16 @@ - - - + + + - - - + + + @@ -143,16 +143,16 @@ - - - + + + - - - + + + @@ -172,16 +172,16 @@ - - - + + + - - - + + + @@ -201,16 +201,16 @@ - - - + + + - - - + + + @@ -230,16 +230,16 @@ - - - + + + - - - + + + @@ -259,16 +259,16 @@ - - - + + + - - - + + + @@ -288,16 +288,16 @@ - - - + + + - - - + + + @@ -317,16 +317,16 @@ - - - + + + - - - + + + diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results3.imzml.txt --- a/test-data/preprocessing_results3.imzml.txt Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results3.imzml.txt Sun Aug 29 07:10:15 2021 +0000 @@ -1,4 +1,4 @@ imzML file: total 24 --rw-rw-r-- 1 meli meli 960 Oct 5 19:58 ibd --rw-rw-r-- 1 meli meli 18112 Oct 5 19:58 imzml +-rw-rw-r-- 1 meli meli 1456 Nov 29 18:04 ibd +-rw-rw-r-- 1 meli meli 18133 Nov 29 18:04 imzml diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results3.pdf Binary file test-data/preprocessing_results3.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results4.ibd Binary file test-data/preprocessing_results4.ibd has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results4.imzml --- a/test-data/preprocessing_results4.imzml Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results4.imzml Sun Aug 29 07:10:15 2021 +0000 @@ -9,8 +9,8 @@ - - + + @@ -42,7 +42,7 @@ - + diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results4.imzml.txt --- a/test-data/preprocessing_results4.imzml.txt Tue Nov 03 22:35:49 2020 +0000 +++ b/test-data/preprocessing_results4.imzml.txt Sun Aug 29 07:10:15 2021 +0000 @@ -1,4 +1,4 @@ imzML file: total 84 --rw-rw-r-- 1 meli meli 62696 Oct 5 19:58 ibd --rw-rw-r-- 1 meli meli 18199 Oct 5 19:58 imzml +-rw-rw-r-- 1 meli meli 62696 Aug 28 16:41 ibd +-rw-rw-r-- 1 meli meli 18200 Aug 28 16:41 imzml diff -r 006fc980af63 -r c56906ee67d3 test-data/preprocessing_results4.pdf Binary file test-data/preprocessing_results4.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test1.pdf Binary file test-data/test1.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test2.pdf Binary file test-data/test2.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test3.pdf Binary file test-data/test3.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test4.pdf Binary file test-data/test4.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test5.pdf Binary file test-data/test5.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test6.pdf Binary file test-data/test6.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test6.rdata Binary file test-data/test6.rdata has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test7.pdf Binary file test-data/test7.pdf has changed diff -r 006fc980af63 -r c56906ee67d3 test-data/test7.rdata Binary file test-data/test7.rdata has changed