comparison spectra_plots.xml @ 12:10566783d718 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit e499c9124d3fd85a7fc47b95c206ce91a5e3678c-dirty"
author galaxyp
date Tue, 03 Nov 2020 23:11:11 +0000
parents 0b7e00e5b9d2
children c5aa9fca18c6
comparison
equal deleted inserted replaced
11:d2596e1be091 12:10566783d718
1 <tool id="cardinal_spectra_plots" name="MSI plot spectra" version="@VERSION@.0"> 1 <tool id="cardinal_spectra_plots" name="MSI plot spectra" version="@VERSION@.1">
2 <description> 2 <description>
3 mass spectrometry imaging mass spectra plots 3 mass spectrometry imaging mass spectra plots
4 </description> 4 </description>
5 <macros> 5 <macros>
6 <import>macros.xml</import> 6 <import>macros.xml</import>
80 msidata_coordinates = data.frame(coord(msidata)\$x, coord(msidata)\$y, c(1:ncol(msidata))) 80 msidata_coordinates = data.frame(coord(msidata)\$x, coord(msidata)\$y, c(1:ncol(msidata)))
81 colnames(msidata_coordinates) = c("x", "y", "pixel_index") 81 colnames(msidata_coordinates) = c("x", "y", "pixel_index")
82 merged_annotation = merge(msidata_coordinates, spectra_input, by=c("x", "y"), all.x=TRUE) 82 merged_annotation = merge(msidata_coordinates, spectra_input, by=c("x", "y"), all.x=TRUE)
83 merged_annotation[is.na(merged_annotation)] = "NA" 83 merged_annotation[is.na(merged_annotation)] = "NA"
84 merged_annotation = merged_annotation[order(merged_annotation\$pixel_index),] 84 merged_annotation = merged_annotation[order(merged_annotation\$pixel_index),]
85 msidata\$annotation = as.factor(merged_annotation[,4]) 85 msidata\$annotation = factor(merged_annotation[,4], levels = unique(as.character(merged_annotation[,4]))) ## keep the right order
86 86
87 ## overview plot over annotated samples 87 ## overview plot over annotated samples
88 number_combined = length(levels(msidata\$annotation)) 88 number_combined = length(levels(msidata\$annotation))
89 89
90 ## the more annotation groups a file has the smaller will be the legend 90 ## the more annotation groups a file has the smaller will be the legend
212 212
213 ##################### I) Sample: plot full mass spectrum ############## 213 ##################### I) Sample: plot full mass spectrum ##############
214 214
215 #if $fullmz: 215 #if $fullmz:
216 ## plot full mz for single tabular mz 216 ## plot full mz for single tabular mz
217 print(plot(msidata, coord=list(x=x_coord, y=y_coord), key=TRUE, grid = $grid_variable)) 217 print(plot(msidata, coord=list(x=x_coord, y=y_coord), key=TRUE, grid = $grid_variable, col="black"))
218 #end if 218 #end if
219 219
220 pixelname = paste0("x = ", x_coord,", ", "y = ", y_coord) 220 pixelname = paste0("x = ", x_coord,", ", "y = ", y_coord)
221 221
222 input_pixels = paste(x_coord, y_coord, sep="_") 222 input_pixels = paste(x_coord, y_coord, sep="_")
259 maxmasspixel = maxmasspixel+1 259 maxmasspixel = maxmasspixel+1
260 } 260 }
261 } 261 }
262 262
263 ## print single tabular mz; manual zoom 263 ## print single tabular mz; manual zoom
264 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c($token.xlimmin,$token.xlimmax))) 264 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"))
265 265
266 #end for 266 #end for
267 267
268 #elif str($mz_range.mz_range_options) == "tabular_mz": 268 #elif str($mz_range.mz_range_options) == "tabular_mz":
269 269
304 maxmasspixel = maxmasspixel+1 304 maxmasspixel = maxmasspixel+1
305 } 305 }
306 } 306 }
307 307
308 ## print single tabular mz; tabular zoom 308 ## print single tabular mz; tabular zoom
309 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c(xlimmin,xlimmax))) 309 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, coord=list(x=x_coord, y=y_coord), key=TRUE, xlim= c(xlimmin,xlimmax), col="black"))
310 } 310 }
311 } 311 }
312 312
313 #end if 313 #end if
314 314
327 327
328 ##################### I) Sample: plot full mass spectrum ############## 328 ##################### I) Sample: plot full mass spectrum ##############
329 329
330 #if $fullmz: 330 #if $fullmz:
331 331
332 print(plot(msidata, run="infile", key=TRUE, strip=FALSE, main="Average spectrum", grid = $grid_variable)) 332 print(plot(msidata, run="infile", key=TRUE, strip=FALSE, main="Average spectrum", grid = $grid_variable, col="black"))
333 #end if 333 #end if
334 334
335 ##################### II) Sample: plot zoom-in mass spectrum ########## 335 ##################### II) Sample: plot zoom-in mass spectrum ##########
336 336
337 #if str($mz_range.mz_range_options) == "manual_mz": 337 #if str($mz_range.mz_range_options) == "manual_mz":
364 }else{ 364 }else{
365 maxmasspixel = maxmasspixel+1 365 maxmasspixel = maxmasspixel+1
366 } 366 }
367 } 367 }
368 368
369 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, main="Average spectrum", run = "infile", strip=FALSE, key=TRUE, xlim= c($token.xlimmin,$token.xlimmax))) 369 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, main="Average spectrum", run = "infile", strip=FALSE, key=TRUE, xlim= c($token.xlimmin,$token.xlimmax), col="black"))
370 370
371 #end for 371 #end for
372 372
373 #elif str($mz_range.mz_range_options) == "tabular_mz": 373 #elif str($mz_range.mz_range_options) == "tabular_mz":
374 374
399 ## if xlimax is outside mz range, use max mz value 399 ## if xlimax is outside mz range, use max mz value
400 return(features(msidata, mz=max(mz(msidata)))) 400 return(features(msidata, mz=max(mz(msidata))))
401 } 401 }
402 ) 402 )
403 403
404 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, run="infile", key=TRUE, strip=FALSE, main="Average spectrum", xlim= c(xlimmin,xlimmax))) 404 print(plot(msidata[minmasspixel:maxmasspixel,], grid = $grid_variable, run="infile", key=TRUE, strip=FALSE, main="Average spectrum", xlim= c(xlimmin,xlimmax), col="black"))
405 } 405 }
406 } 406 }
407 407
408 408
409 #end if 409 #end if