comparison msi_combine.xml @ 2:00b6c61f5054 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
author galaxyp
date Mon, 28 May 2018 12:35:49 -0400
parents f3f6c32ab690
children 91bba2486773
comparison
equal deleted inserted replaced
1:f3f6c32ab690 2:00b6c61f5054
36 #if str( $combine_conditional.combine_method ) == 'xy_shifts': 36 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
37 input_list = read.delim("$combine_conditional.coordinates_file", header = FALSE, 37 input_list = read.delim("$combine_conditional.coordinates_file", header = FALSE,
38 stringsAsFactors = FALSE) 38 stringsAsFactors = FALSE)
39 #end if 39 #end if
40 40
41 loadRData <- function(fileName){
42 #loads an RData file, and returns it
43 load(fileName)
44 get(ls()[ls() != "fileName"])
45 }
46
41 pixel_vector = numeric() 47 pixel_vector = numeric()
42 names_vector = character() 48 names_vector = character()
43 x_shifts = 0 49 x_shifts = 0
44 y_shifts = 0 50 y_shifts = 0
45 max_y = numeric() 51 max_y = numeric()
46 52
47 #set $msidata = [] 53 #set $msidata = []
48 #set $pixelcoords = [] 54 #set $pixelcoords = []
49 #set $num_infiles = len($infiles) 55 #set $num_infiles = len($infiles)
56 all_files = $num_infiles
50 57
51 #for $i, $infile in enumerate($infiles): 58 #for $i, $infile in enumerate($infiles):
52 59
53 #if $infile.ext == 'imzml' 60 #if $infile.ext == 'imzml'
54 msidata_$i <- readImzML('infile_${i}') 61 msidata_$i <- readImzML('infile_${i}')
62 #elif $infile.ext == 'analyze75'
63 msidata_$i <- readAnalyze('infile_${i}')
64 #else
65 msidata_$i = loadRData('infile_${i}.RData')
66 #end if
67
68 ########## wenn ncol msidata > 0 and nrow msidata > 0, dann alles abklappern andernfalls nicht in msiliste mitreinnehmen (unten hinter python vor end for: filenr ausprinten)
55 sampleNames(msidata_$i) = "msidata" 69 sampleNames(msidata_$i) = "msidata"
56 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i))) 70 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i)))
57 #elif $infile.ext == 'analyze75'
58 msidata_$i <- readAnalyze('infile_${i}')
59 sampleNames(msidata_$i) = "msidata"
60 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i)))
61 #else
62 loadRData <- function(fileName){
63 #loads an RData file, and returns it
64 load(fileName)
65 get(ls()[ls() != "fileName"])
66 }
67 msidata_$i = loadRData('infile_${i}.RData')
68 sampleNames(msidata_$i) = "msidata"
69 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i)))
70 #end if
71 colnames(pixelcoords_$i)[3] = "file_number"
72 71
73 #if str( $combine_conditional.combine_method ) == 'xy_shifts': 72 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
74 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] 73 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x]
75 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] 74 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y]
76 pixel_vector = append(pixel_vector, rep(input_list[$i+1,$combine_conditional.column_names],times=ncol(msidata_$i))) 75 pixel_vector = append(pixel_vector, rep(input_list[$i+1,$combine_conditional.column_names],times=ncol(msidata_$i)))
93 92
94 #end if 93 #end if
95 #silent $msidata.append('msidata_'+str($i)) 94 #silent $msidata.append('msidata_'+str($i))
96 #silent $pixelcoords.append('pixelcoords_'+str($i)) 95 #silent $pixelcoords.append('pixelcoords_'+str($i))
97 #end for 96 #end for
97 colnames(pixelcoords_$i)[3] = "file_number"
98 98
99 ###################### automatic combination ################################### 99 ###################### automatic combination ###################################
100 ################################################################################ 100 ################################################################################
101 101
102 #if str( $combine_conditional.combine_method ) == 'automatic_combine': 102 #if str( $combine_conditional.combine_method ) == 'automatic_combine':
103 print("automatic_combine") 103 print("automatic_combine")
104 msidata_combined = do.call(combine, list(#echo ','.join($msidata)#)) 104 msidata_combined = do.call(combine, list(#echo ','.join($msidata)#))
105 print("combination successful")
105 sample_names = as.factor(names_vector) 106 sample_names = as.factor(names_vector)
106 pData(msidata_combined)\$sample = sample_names 107 pData(msidata_combined)\$sample = sample_names
108 print("names successful")
107 109
108 ## create PDF to show pixels of each file 110 ## create PDF to show pixels of each file
109 pdf("combining_qc.pdf", width=15, height=15) 111 pdf("combining_qc.pdf", width=15, height=15)
110 position_df = cbind(coord(msidata_combined)[,1:2], pData(msidata_combined)\$sample) 112 position_df = cbind(coord(msidata_combined)[,1:2], pData(msidata_combined)\$sample)
111 colnames(position_df)[3] = "sample_name" 113 colnames(position_df)[3] = "sample_name"
114 print("position_df")
112 115
113 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ 116 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
114 geom_tile() + 117 geom_tile() +
115 coord_fixed()+ 118 coord_fixed()+
116 ggtitle("Spatial orientation of combined data")+ 119 ggtitle("Spatial orientation of combined data")+
321 <output name="combining_qc" file="12_auto_combined_QC.pdf" compare="sim_size" delta="20000"/> 324 <output name="combining_qc" file="12_auto_combined_QC.pdf" compare="sim_size" delta="20000"/>
322 </test> 325 </test>
323 </tests> 326 </tests>
324 <help> 327 <help>
325 <![CDATA[ 328 <![CDATA[
326 This tool can combine several mass-spectrometry imaging files. 329
327 1) m/z values need to be the same across all datasets 330 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_
328 2) pixels (defined by x and y coordinates) must be unique 331
329 332 This tool uses the Cardinal combine function to combine several mass-spectrometry imaging data.
330 1) Same m/z values/axis can be achieved with the filtering tool to get all datasets to the same m/z range and afterwards binning in the preprocessing tool to obtain the same bins for all dataset.
331 2) The pixels (defined by x and y coordinates) must be unique across all datasets, therefore the option "Select the way you want to combine multiple files" is helpful:
332
333 - "automatic combination": files are arranged in a grid with a distance in x and y direction which can be given by the user
334 - "no coordinates shift": this option can only be used if all pixels are unique across datasets
335 - "xy shifts by hand": each file can be moved in x and y direction according to the users need (define one tabular file in the order in which the files are loaded in the history (bottom to top) and define for each file the x and y coordinates shifts in separate columns
336 - "check pixels before combination": no combination takes place. You will only get a pdf which shows the arrangement of the pixels (with or without additional xy shifts)
337 333
338 Input data: 3 types of input data can be used: 334 Input data: 3 types of input data can be used:
339 335
340 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <http://ms-imaging.org/wp/introduction/>`_ 336 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
341 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) 337 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
342 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) 338 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData)
343 339
344 The output of this tool is a Cardinal "MSImageSet" with the variable name "msidata" saved as .RData. 340 Prerequisite:
341
342 - m/z values need to be the same across all datasets (before using this tool), this can be achieved with the filtering tool (use same m/z range) and the preprocessing tool (use same binning parameter)
343
344 Options:
345
346 - "automatic combination": files are arranged in a grid with a minimal distance in x and y direction which can be given by the user, subfiles are named according to input file name
347 - "no coordinates shift": this option can only be used if all pixels are unique across datasets, no assignment of names to the subfiles
348 - "xy shifts by hand": each file can be moved in x and y direction according to the users need (define one tabular file in the order in which the files are loaded in the history (bottom to top) and define for each file the x and y coordinates shifts in separate columns
349 - "check pixels before combination": no combination takes place but a pdf shows the current arrangement of the pixels
350
351 Output:
352
353 - imzML file containing multiple subfiles
354 - pdf that shows the pixel positions of the combined files
355 - optional: intensity matrix as tabular file (intensities for masses in rows and pixel in columns)
356
357
345 ]]> 358 ]]>
346 </help> 359 </help>
347 <citations> 360 <citations>
348 <citation type="doi">10.1093/bioinformatics/btv146</citation> 361 <citation type="doi">10.1093/bioinformatics/btv146</citation>
349 </citations> 362 </citations>