Mercurial > repos > galaxyp > cardinal_spectra_plots
comparison spectra_plots.xml @ 9:006fc980af63 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 22:35:49 +0000 |
parents | f64aadd66808 |
children | c56906ee67d3 |
comparison
equal
deleted
inserted
replaced
8:33dcc1606d53 | 9:006fc980af63 |
---|---|
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> |
7 </macros> | 7 </macros> |
8 <expand macro="requirements"> | 8 <expand macro="requirements"> |
9 <requirement type="package" version="3.2.1">r-ggplot2</requirement> | 9 <requirement type="package" version="3.3.2">r-ggplot2</requirement> |
10 <requirement type="package" version="2.3">r-gridextra</requirement> | 10 <requirement type="package" version="2.3">r-gridextra</requirement> |
11 <requirement type="package" version="1.0.0">r-scales</requirement> | 11 <requirement type="package" version="1.1.1">r-scales</requirement> |
12 </expand> | 12 </expand> |
13 <command detect_errors="exit_code"> | 13 <command detect_errors="exit_code"> |
14 <![CDATA[ | 14 <![CDATA[ |
15 @INPUT_LINKING@ | 15 @INPUT_LINKING@ |
16 cat '${MSI_mzplots}' && | 16 cat '${MSI_mzplots}' && |
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 |
454 </configfiles> | 454 </configfiles> |
455 <inputs> | 455 <inputs> |
456 <expand macro="reading_msidata"/> | 456 <expand macro="reading_msidata"/> |
457 <expand macro="pdf_filename"/> | 457 <expand macro="pdf_filename"/> |
458 <conditional name="pixel_conditional"> | 458 <conditional name="pixel_conditional"> |
459 <param name="pixel_type" type="select" label="Choose spectra (pixel)"> | 459 <param name="pixel_type" type="select" label="Choose spectra (pixel) and/or add spectra annotations"> |
460 <option value="all_pixel" selected="True" >All spectra</option> | 460 <option value="all_pixel" selected="True" >All spectra</option> |
461 <option value="tabular_pixel">Single spectra</option> | 461 <option value="tabular_pixel">Single spectra</option> |
462 </param> | 462 </param> |
463 <when value="tabular_pixel"> | 463 <when value="tabular_pixel"> |
464 <param name="pixel_file" type="data" format="tabular" label="Load tabular file with pixel coordinates" | 464 <param name="pixel_file" type="data" format="tabular" label="Load tabular file with pixel coordinates" |
586 </test> | 586 </test> |
587 <test> | 587 <test> |
588 <expand macro="processed_infile_imzml"/> | 588 <expand macro="processed_infile_imzml"/> |
589 <conditional name="processed_cond"> | 589 <conditional name="processed_cond"> |
590 <param name="processed_file" value="processed"/> | 590 <param name="processed_file" value="processed"/> |
591 <param name="accuracy" value="50"/> | 591 <param name="accuracy" value="100"/> |
592 <param name="units" value="ppm"/> | 592 <param name="units" value="ppm"/> |
593 </conditional> | 593 </conditional> |
594 <conditional name="pixel_conditional"> | 594 <conditional name="pixel_conditional"> |
595 <param name="pixel_type" value="all_pixel"/> | 595 <param name="pixel_type" value="all_pixel"/> |
596 </conditional> | 596 </conditional> |