Mercurial > repos > galaxyp > cardinal_combine
comparison combine.xml @ 0:b414378b969f draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 0825a4ccd3ebf4ca8a298326d14f3e7b25ae8415
author | galaxyp |
---|---|
date | Mon, 01 Oct 2018 01:02:18 -0400 |
parents | |
children | ac474da43605 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b414378b969f |
---|---|
1 <tool id="cardinal_combine" name="MSI combine" version="@VERSION@.0"> | |
2 <description> | |
3 combine several mass spectrometry imaging datasets into one | |
4 </description> | |
5 <macros> | |
6 <import>macros.xml</import> | |
7 </macros> | |
8 <expand macro="requirements"> | |
9 <requirement type="package" version="3.0.0">r-ggplot2</requirement> | |
10 </expand> | |
11 <command detect_errors="exit_code"> | |
12 <![CDATA[ | |
13 #for $i, $infile in enumerate($infiles): | |
14 #if $infile.ext == 'imzml' | |
15 ln -s '${infile.extra_files_path}/imzml' infile_${i}.imzML && | |
16 ln -s '${infile.extra_files_path}/ibd' infile_${i}.ibd && | |
17 #elif $infile.ext == 'analyze75' | |
18 ln -s '${infile.extra_files_path}/hdr' infile_${i}.hdr && | |
19 ln -s '${infile.extra_files_path}/img' infile_${i}.img && | |
20 ln -s '${infile.extra_files_path}/t2m' infile_${i}.t2m && | |
21 #else | |
22 ln -s '$infile' infile_${i}.RData && | |
23 #end if | |
24 #end for | |
25 #if $annotation_cond.annotation_tabular == 'annotation' | |
26 #for $i, $annotation_file in enumerate($annotation_cond.annotation_files): | |
27 ln -s '$annotation_file' annotation_file_${i}.tabular && | |
28 #end for | |
29 #end if | |
30 | |
31 cat '${msi_combine}' && | |
32 Rscript '${msi_combine}' | |
33 | |
34 ]]> | |
35 </command> | |
36 <configfiles> | |
37 <configfile name="msi_combine"><![CDATA[ | |
38 | |
39 #import re | |
40 | |
41 ################ load libraries and some preparations ################# | |
42 | |
43 library(Cardinal) | |
44 library(ggplot2) | |
45 | |
46 ## read tabular file for xy_shift option | |
47 #if str( $combine_conditional.combine_method ) == 'xy_shifts': | |
48 input_list = read.delim("$combine_conditional.coordinates_file", header = $combine_conditional.xy_header, | |
49 stringsAsFactors = FALSE) | |
50 #end if | |
51 | |
52 ## function to load RData and store with new variable name | |
53 loadRData <- function(fileName){ | |
54 load(fileName) | |
55 get(ls()[ls() != "fileName"]) | |
56 } | |
57 | |
58 ## preparations for reading files one by one with for loop | |
59 pixel_vector = numeric() | |
60 x_shifts = 0 | |
61 y_shifts = 0 | |
62 max_y = numeric() | |
63 valid_dataset = logical() | |
64 #set $msidata = [] | |
65 #set $pixelcoords = [] | |
66 #set $num_infiles = len($infiles) | |
67 all_files = $num_infiles | |
68 | |
69 | |
70 ############## reading files and changing pixel coordinates ################### | |
71 | |
72 #for $i, $infile in enumerate($infiles): | |
73 | |
74 ## read and manipulate MSI data | |
75 | |
76 #if $infile.ext == 'imzml' | |
77 #if str($processed_cond.processed_file) == "processed": | |
78 msidata_$i <- readImzML('infile_${i}', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units") | |
79 centroided(msidata) = $centroids | |
80 #else | |
81 msidata_$i <- readImzML('infile_${i}') | |
82 centroided(msidata) = $centroids | |
83 #end if | |
84 #elif $infile.ext == 'analyze75' | |
85 msidata_$i <- readAnalyze('infile_${i}') | |
86 centroided(msidata) = $centroids | |
87 #else | |
88 msidata_$i = loadRData('infile_${i}.RData') | |
89 #end if | |
90 | |
91 ## remove duplicated coordinates, otherwise combine will fail | |
92 print(paste0(sum(duplicated(coord(msidata_$i))), " duplicated coordinates were removed from input file")) | |
93 msidata_${i} <- msidata_${i}[,!duplicated(coord(msidata_${i}))] | |
94 | |
95 ## same name for MSI data files necessary to combine data in one single coordinate system | |
96 sampleNames(msidata_$i) = "msidata" | |
97 | |
98 | |
99 ## read and process annotation tabular or automatically use name of infile as annotation | |
100 | |
101 ## set all pixel annotations to NA, necessary in case files were combined before with different annotations | |
102 msidata_$i\$column1 = rep(NA, ncol(msidata_$i)) | |
103 msidata_$i\$column2 = rep(NA, ncol(msidata_$i)) | |
104 msidata_$i\$column3 = rep(NA, ncol(msidata_$i)) | |
105 msidata_$i\$column4 = rep(NA, ncol(msidata_$i)) | |
106 msidata_$i\$column5 = rep(NA, ncol(msidata_$i)) | |
107 msidata_$i\$combined_sample = rep(NA, ncol(msidata_$i)) | |
108 | |
109 #if str($annotation_cond.annotation_tabular) == 'annotation' | |
110 print("annotations") | |
111 | |
112 ## read annotation tabular, set first two columns as x and y, merge with coordinates dataframe and order according to pixelorder in msidata | |
113 input_annotation = read.delim("annotation_file_${i}.tabular", header = $annotation_cond.tabular_header, stringsAsFactors = FALSE) | |
114 | |
115 colnames(input_annotation)[1:2] = c("x", "y") | |
116 msidata_coordinates = cbind(coord(msidata_$i)[,1:2], 1:ncol(msidata_$i)) | |
117 colnames(msidata_coordinates)[3] = "pixel_index" | |
118 | |
119 ## only first 5 annotation columns are kept | |
120 if (ncol(input_annotation) > 7){ | |
121 input_annotation = input_annotation[,1:7]} | |
122 | |
123 annotation_df = merge(msidata_coordinates, input_annotation, by=c("x", "y"), all.x=TRUE) | |
124 annotation_df_8 = cbind(annotation_df, data.frame(matrix(NA,ncol=8-ncol(annotation_df), nrow=ncol(msidata_$i)))) | |
125 annotation_df_8_sorted = annotation_df_8[order(annotation_df_8\$pixel_index),]## orders pixel according to msidata | |
126 | |
127 ## each annotation column is assigned to the pixel in the pData slot of the MSIdata | |
128 msidata_$i\$column1 = annotation_df_8_sorted[,4] | |
129 msidata_$i\$column2 = annotation_df_8_sorted[,5] | |
130 msidata_$i\$column3 = annotation_df_8_sorted[,6] | |
131 msidata_$i\$column4 = annotation_df_8_sorted[,7] | |
132 msidata_$i\$column5 = annotation_df_8_sorted[,8] | |
133 | |
134 ## extract columnnames from (last) annotation tabular (for QC plot names) | |
135 annotation_colnames = colnames(input_annotation)[-c(1,2)] | |
136 | |
137 #end if | |
138 | |
139 | |
140 ################### preparation xy shifts ########################## | |
141 | |
142 #if str( $combine_conditional.combine_method ) == 'xy_shifts': | |
143 | |
144 ## shift coordinates according to input tabular file and store file names | |
145 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] ## shifts x coordinates according to tabular file | |
146 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] ## shifts y coordinates according to tabular file | |
147 pixel_vector = append(pixel_vector, rep(paste($i+1, input_list[$i+1,$combine_conditional.column_names], sep="_"),times=ncol(msidata_$i))) ## stores file name for each pixel | |
148 msidata_$i\$combined_sample = rep(paste($i+1, input_list[$i+1,$combine_conditional.column_names], sep="_"),times=ncol(msidata_$i)) | |
149 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i))) | |
150 #silent $pixelcoords.append('pixelcoords_'+str($i)) | |
151 colnames(pixelcoords_$i)[3] = "file_number" | |
152 | |
153 ################### preparation automatic combination ########################## | |
154 | |
155 #elif str( $combine_conditional.combine_method ) == 'automatic_combine': | |
156 | |
157 ## use name of Galaxy inputfile as combined sample annotation | |
158 names_vector = character() | |
159 #set escaped_element_identifier = re.sub('[^\w\-\s\[/]]', '_', str($infile.element_identifier)) | |
160 if (sum(spectra(msidata_$i)[],na.rm=TRUE)>0) ## use only valid files | |
161 { | |
162 if (is.null(levels(msidata_$i\$combined_sample))) | |
163 { | |
164 names_vector = append(names_vector, rep(paste($i+1, "$escaped_element_identifier", sep="_"),ncol(msidata_$i))) | |
165 msidata_$i\$combined_sample = as.factor(names_vector) | |
166 } | |
167 } | |
168 | |
169 ## Number of input files define grid which is row-wise filled with files | |
170 | |
171 coord(msidata_$i)\$x = coord(msidata_$i)\$x - (min(coord(msidata_$i)\$x-1)) + x_shifts | |
172 coord(msidata_$i)\$y = coord(msidata_$i)\$y - (min(coord(msidata_$i)\$y-1)) + y_shifts | |
173 x_shifts = max(coord(msidata_$i)\$x) + 5 | |
174 max_y = append(max_y, max(coord(msidata_$i)\$y)) | |
175 all_files = $num_infiles | |
176 new_row = ($i+1)/ceiling(sqrt(all_files)) | |
177 new_row%%1==0 | |
178 if (new_row%%1==0) | |
179 {x_shifts = 0 ### when row is filled: x values start again at zero | |
180 y_shifts = max(max_y) + 5 ### when row is filled: y value increases to start a new row | |
181 max_y = numeric()} | |
182 | |
183 #end if | |
184 | |
185 ## store files to combine them later and for each file check if it is valid | |
186 | |
187 #silent $msidata.append('msidata_'+str($i)) | |
188 valid_dataset = append(valid_dataset, | |
189 (ncol(msidata_$i)>0 & nrow(msidata_$i)>0 & sum(spectra(msidata_$i)[], na.rm=TRUE)>0)) | |
190 | |
191 #end for | |
192 | |
193 | |
194 ###################### automatic combination ################################### | |
195 ################################################################################ | |
196 | |
197 #if str( $combine_conditional.combine_method ) == 'automatic_combine': | |
198 print("automatic_combine") | |
199 | |
200 ## combine only valid datasets | |
201 | |
202 valid_data = list(#echo ','.join($msidata)#)[valid_dataset] | |
203 msidata_combined = do.call(combine, valid_data) | |
204 print("Valid datasets in order of input bottom to top:") | |
205 print(valid_dataset) | |
206 | |
207 ## create dataframe with x,y,sample_name and show all pixels in PDF as QC | |
208 position_df = cbind(coord(msidata_combined)[,1:2], msidata_combined\$combined_sample) | |
209 colnames(position_df)[3] = "sample_name" | |
210 | |
211 ## save as (.RData) | |
212 | |
213 msidata = msidata_combined | |
214 save(msidata, file="$msidata_combined") | |
215 | |
216 ################################## xy shifts ################################### | |
217 ################################################################################ | |
218 | |
219 #elif str( $combine_conditional.combine_method ) == 'xy_shifts': | |
220 print("xy_shifts") | |
221 | |
222 ## in case user made mistake with xy shifts: find duplicated coordinates | |
223 all_coordinates = do.call(rbind, list(#echo ','.join($pixelcoords)#)) | |
224 duplicated_coordinates= duplicated(all_coordinates[,1:2])| duplicated(all_coordinates[,1:2], fromLast=TRUE) | |
225 print(paste0("Number of removed duplicated coordinates after combination: ", sum(duplicated_coordinates)/2)) | |
226 unique_coordinates = all_coordinates[!duplicated_coordinates,] | |
227 | |
228 ## remove duplicated coordinates | |
229 datasetlist = list() | |
230 count = 1 | |
231 for (usable_dataset in list(#echo ','.join($msidata)#)){ | |
232 pixelsofinterest = pixels(usable_dataset)[names(pixels(usable_dataset)) %in% rownames(unique_coordinates)] | |
233 filtered_dataset = usable_dataset[,pixelsofinterest] | |
234 if (ncol(filtered_dataset) > 0 ){ | |
235 datasetlist[[count]] = filtered_dataset} | |
236 count = count +1} | |
237 | |
238 msidata_combined = do.call(combine, datasetlist) | |
239 | |
240 ## save as (.RData) | |
241 | |
242 msidata = msidata_combined | |
243 save(msidata, file="$msidata_combined") | |
244 | |
245 ## create x,y,sample_name dataframe for QC pdf | |
246 | |
247 position_df = cbind(coord(msidata), msidata\$combined_sample) | |
248 colnames(position_df)[3] = "sample_name" | |
249 | |
250 #end if | |
251 | |
252 | |
253 ################################## outputs #################################### | |
254 ################################################################################ | |
255 | |
256 ########### QC with pixels and their annotations ################################ | |
257 | |
258 print(paste0("Number of NA in input file: ",sum(is.na(spectra(msidata)[])))) | |
259 | |
260 pdf("Combined_qc.pdf", width=15, height=15) | |
261 | |
262 ## combined plot | |
263 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ | |
264 geom_tile() + | |
265 coord_fixed()+ | |
266 ggtitle("Spatial orientation of combined data")+ | |
267 theme_bw()+ | |
268 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
269 theme(legend.position="bottom",legend.direction="vertical")+ | |
270 guides(fill=guide_legend(ncol=5,byrow=TRUE)) | |
271 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean) | |
272 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name) | |
273 for(file_count in 1:nrow(coord_labels)) | |
274 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"], | |
275 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))} | |
276 print(combine_plot) | |
277 | |
278 #if str($annotation_cond.annotation_tabular) == 'annotation' | |
279 | |
280 ## annotation plots | |
281 | |
282 ## plot 1 | |
283 | |
284 column1_df = cbind(coord(msidata), msidata\$column1) | |
285 colnames(column1_df)[3] = "column1" | |
286 | |
287 if (sum(is.na(column1_df[3])) < nrow(column1_df)){ | |
288 column1_plot = ggplot(column1_df, aes(x=x, y=y, fill=column1))+ | |
289 geom_tile() + | |
290 coord_fixed()+ | |
291 ggtitle(paste0(annotation_colnames[1]))+ | |
292 theme_bw()+ | |
293 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
294 theme(legend.position="bottom",legend.direction="vertical")+ | |
295 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[1])) | |
296 print(column1_plot)} | |
297 ##rename columnname for output tabular file | |
298 colnames(column1_df)[3] = annotation_colnames[1] | |
299 | |
300 ## plot 2 | |
301 column2_df = cbind(coord(msidata), msidata\$column2) | |
302 colnames(column2_df)[3] = "column2" | |
303 | |
304 if (sum(is.na(column2_df[3])) < nrow(column2_df)){ | |
305 column2_plot = ggplot(column2_df, aes(x=x, y=y, fill=column2))+ | |
306 geom_tile() + | |
307 coord_fixed()+ | |
308 ggtitle(paste0(annotation_colnames[2]))+ | |
309 theme_bw()+ | |
310 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
311 theme(legend.position="bottom",legend.direction="vertical")+ | |
312 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[2])) | |
313 print(column2_plot)} | |
314 ##rename columnname for output tabular file | |
315 colnames(column2_df)[3] = annotation_colnames[2] | |
316 | |
317 ## plot 3 | |
318 column3_df = cbind(coord(msidata), msidata\$column3) | |
319 colnames(column3_df)[3] = "column3" | |
320 if (sum(is.na(column3_df[3])) < nrow(column3_df)){ | |
321 column3_plot = ggplot(column3_df, aes(x=x, y=y, fill=column3))+ | |
322 geom_tile() + | |
323 coord_fixed()+ | |
324 ggtitle(paste0(annotation_colnames[3]))+ | |
325 theme_bw()+ | |
326 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
327 theme(legend.position="bottom",legend.direction="vertical")+ | |
328 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[3])) | |
329 print(column3_plot)} | |
330 ##rename columnname for output tabular file | |
331 colnames(column3_df)[3] = annotation_colnames[3] | |
332 | |
333 ## plot 4 | |
334 column4_df = cbind(coord(msidata), msidata\$column4) | |
335 colnames(column4_df)[3] = "column4" | |
336 | |
337 if (sum(is.na(column4_df[3])) < nrow(column4_df)){ | |
338 column4_plot = ggplot(column4_df, aes(x=x, y=y, fill=column4))+ | |
339 geom_tile() + | |
340 coord_fixed()+ | |
341 ggtitle(paste0(annotation_colnames[4]))+ | |
342 theme_bw()+ | |
343 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
344 theme(legend.position="bottom",legend.direction="vertical")+ | |
345 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[4])) | |
346 print(column4_plot)} | |
347 ##rename columnname for output tabular file | |
348 colnames(column4_df)[3] = annotation_colnames[4] | |
349 | |
350 ## plot5 | |
351 | |
352 column5_df = cbind(coord(msidata), msidata\$column5) | |
353 colnames(column5_df)[3] = "column5" | |
354 if (sum(is.na(column5_df[3])) < nrow(column5_df)){ | |
355 column5_plot = ggplot(column5_df, aes(x=x, y=y, fill=column5))+ | |
356 geom_tile() + | |
357 coord_fixed()+ | |
358 ggtitle(paste0(annotation_colnames[5]))+ | |
359 theme_bw()+ | |
360 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
361 theme(legend.position="bottom",legend.direction="vertical")+ | |
362 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[5])) | |
363 print(column5_plot)} | |
364 ##rename columnname for output tabular file | |
365 colnames(column5_df)[3] = annotation_colnames[5] | |
366 | |
367 #end if | |
368 | |
369 dev.off() | |
370 | |
371 ##################### annotation tabular output ################################ | |
372 | |
373 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){ | |
374 | |
375 position_df\$sample_name = gsub("^[^_]*_","",position_df\$sample_name) | |
376 | |
377 #if str($annotation_cond.annotation_tabular) == 'no_annotation': | |
378 | |
379 write.table(position_df, file="$pixel_annotations", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") | |
380 | |
381 #else | |
382 annotation_df_list = list(position_df, column1_df, column2_df, column3_df, column4_df, column5_df) | |
383 combined_annotations = Reduce(function(...) merge(..., by=c("x", "y"), all=TRUE), annotation_df_list) | |
384 write.table(combined_annotations, file="$pixel_annotations", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") | |
385 | |
386 #end if | |
387 | |
388 }else{ | |
389 print("No annotation tabular output because file has no features or pixels left") | |
390 } | |
391 | |
392 | |
393 ]]></configfile> | |
394 </configfiles> | |
395 <inputs> | |
396 <param name="infiles" type="data" multiple="true" format="imzml,rdata,analyze75" | |
397 label="MSI data as imzml, analyze7.5 or Cardinal MSImageSet saved as RData" | |
398 help="load imzml and ibd file by uploading composite datatype imzml"/> | |
399 <param name="centroids" type="boolean" label="Is the input data centroided (picked)" help="Choose Yes if peak detection has already been done." truevalue="TRUE" falsevalue="FALSE"/> | |
400 <conditional name="processed_cond"> | |
401 <param name="processed_file" type="select" label="Is the input file a processed imzML file "> | |
402 <option value="no_processed" selected="True">not a processed imzML</option> | |
403 <option value="processed">processed imzML</option> | |
404 </param> | |
405 <when value="no_processed"/> | |
406 <when value="processed"> | |
407 <param name="accuracy" type="float" value="50" label="Mass accuracy to which the m/z values will be binned" help="This should be set to the native accuracy of the mass spectrometer, if known"/> | |
408 <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm"> | |
409 <option value="mz" >mz</option> | |
410 <option value="ppm" selected="True" >ppm</option> | |
411 </param> | |
412 </when> | |
413 </conditional> | |
414 <conditional name="annotation_cond"> | |
415 <param name="annotation_tabular" type="select" label="Optional annotation of pixels with tabular files"> | |
416 <option value="no_annotation" selected="True">no annotation</option> | |
417 <option value="annotation">pixel annotations</option> | |
418 </param> | |
419 <when value="no_annotation"/> | |
420 <when value="annotation"> | |
421 <param name="annotation_files" type="data" multiple="true" format="tabular" | |
422 label="Pixel annotations tabular files" | |
423 help="Same number and order of files as input files. First column x values, second column y values. Up to 5 columns with pixel annotations"/> | |
424 <param name="tabular_header" type="boolean" label="Tabular files contain a header line" truevalue="TRUE" falsevalue="FALSE"/> | |
425 </when> | |
426 </conditional> | |
427 <conditional name="combine_conditional"> | |
428 <param name="combine_method" type="select" label="Way of combining multiple files"> | |
429 <option value="automatic_combine" selected="True" >automatic combination</option> | |
430 <option value="xy_shifts">shift xy coordinates with a tabular file</option> | |
431 </param> | |
432 <when value="automatic_combine"/> | |
433 <when value="xy_shifts"> | |
434 <param name="coordinates_file" type="data" format="tabular" label="datasetnames, x and y values to shift pixel coordinates before combining" | |
435 help="Tabular file with three columns: 1 for the filename, 1 for the x-coordinate shift and 1 for the y-coordinate shift. Pixels with the same coordinates after shifting will be deleted."/> | |
436 <param name="column_x" data_ref="coordinates_file" label="Column with values for shift in x direction" type="data_column"/> | |
437 <param name="column_y" data_ref="coordinates_file" label="Column with values for shift in y direction" type="data_column"/> | |
438 <param name="column_names" data_ref="coordinates_file" label="Column with dataset names" type="data_column"/> | |
439 <param name="xy_header" type="boolean" label="Tabular files contain a header line" truevalue="TRUE" falsevalue="FALSE"/> | |
440 </when> | |
441 </conditional> | |
442 </inputs> | |
443 <outputs> | |
444 <data format="rdata" name="msidata_combined" label="${tool.name} on ${on_string}"/> | |
445 <data format="pdf" name="QC_overview" from_work_dir="Combined_qc.pdf" label = "${tool.name} on ${on_string}: QC"/> | |
446 <data format="tabular" name="pixel_annotations" label="${tool.name} on ${on_string}: annotations"/> | |
447 </outputs> | |
448 <tests> | |
449 <test> | |
450 <param name="infiles" value="msidata_1.RData,msidata_2.RData,msidata_3.RData" ftype="rdata"/> | |
451 <conditional name="annotation_cond"> | |
452 <param name="annotation_tabular" value="annotation"/> | |
453 <param name="annotation_files" value="annotations_file1.tabular,annotations_file2.tabular,annotations_file3.tabular" ftype="tabular"/> | |
454 <param name="tabular_header" value="TRUE"/> | |
455 </conditional> | |
456 <param name="combine_method" value="xy_shifts"/> | |
457 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/> | |
458 <param name="column_x" value="1"/> | |
459 <param name="column_y" value="2"/> | |
460 <param name="column_names" value="3"/> | |
461 <output name="pixel_annotations" file="123_annotation_output.tabular"/> | |
462 <output name="msidata_combined" file="123_combined.RData" compare="sim_size" /> | |
463 <output name="QC_overview" file="123_combined_QC.pdf" compare="sim_size"/> | |
464 </test> | |
465 <test> | |
466 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/> | |
467 <conditional name="annotation_cond"> | |
468 <param name="annotation_tabular" value="annotation"/> | |
469 <param name="annotation_files" value="annotations_file1.tabular,annotations_file2.tabular" ftype="tabular"/> | |
470 <param name="tabular_header" value="TRUE"/> | |
471 </conditional> | |
472 <param name="combine_method" value="automatic_combine"/> | |
473 <output name="pixel_annotations" file="12_annotation_output.tabular"/> | |
474 <output name="msidata_combined" file="12_combined.RData" compare="sim_size" /> | |
475 <output name="QC_overview" file="12_combined_QC.pdf" compare="sim_size"/> | |
476 </test> | |
477 <test> | |
478 <param name="infiles" value="msidata_1.RData,123_combined.RData" ftype="rdata"/> | |
479 <conditional name="annotation_cond"> | |
480 <param name="annotation_tabular" value="annotation"/> | |
481 <param name="annotation_files" value="annotations_file1.tabular,123_annotation.tabular" ftype="tabular"/> | |
482 <param name="tabular_header" value="TRUE"/> | |
483 </conditional> | |
484 <param name="combine_method" value="automatic_combine"/> | |
485 <output name="pixel_annotations" file="112_annotation_output.tabular"/> | |
486 <output name="msidata_combined" file="112_auto_combined.RData" compare="sim_size" /> | |
487 <output name="QC_overview" file="112_auto_combined_QC.pdf" compare="sim_size"/> | |
488 </test> | |
489 <test> | |
490 <param name="infiles" value="msidata_2.RData,123_combined.RData" ftype="rdata"/> | |
491 <conditional name="annotation_cond"> | |
492 <param name="annotation_tabular" value="no_annotation"/> | |
493 </conditional> | |
494 <param name="combine_method" value="automatic_combine"/> | |
495 <output name="pixel_annotations" file="2123_annotation_output.tabular"/> | |
496 <output name="msidata_combined" file="2123_auto_combined.RData" compare="sim_size" /> | |
497 <output name="QC_overview" file="2123_auto_combined_QC.pdf" compare="sim_size"/> | |
498 </test> | |
499 </tests> | |
500 <help> | |
501 <![CDATA[ | |
502 | |
503 @CARDINAL_DESCRIPTION@ | |
504 | |
505 ----- | |
506 | |
507 This tool uses the Cardinal combine function to combine several mass spectrometry imaging data. | |
508 | |
509 @MSIDATA_INPUT_DESCRIPTION@ | |
510 - MSI data files must have the same m/z values (to obtain same m/z values for different files: filtering tool same m/z range and preprocessing tool same binning width) | |
511 - Coordinates stored as decimals rather than integers will be rounded to obtain a regular pixel grid. This might lead to duplicated coordinates which will be automatically removed before the tools analysis starts. | |
512 @SPECTRA_TABULAR_INPUT_DESCRIPTION@ | |
513 | |
514 - For xy shifts with tabular file: Tabular file with x and y coordinates shift and file name | |
515 | |
516 - Each input file is shifted in x and y direction according to this tabular file. In the example the files have about the same pixel dimensions which is smaller than 510x260. | |
517 - The file can have any column names as header (in this case set "Tabular file contains a header line" to yes) or no header at all | |
518 | |
519 :: | |
520 | |
521 x_shift y_shift file name | |
522 0 0 file1 | |
523 510 0 file2 | |
524 0 260 file3 | |
525 510 260 file4 | |
526 ... | |
527 ... | |
528 | |
529 | |
530 | |
531 | |
532 **Options** | |
533 | |
534 - "automatic combination": files are automatically arranged in a grid (duplicated pixels are allowed), subfiles are named according to the input file name | |
535 - "xy shifts": 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 and the file name in a third column as shown above). The xy shift option combines all datasets and removes all duplicated pixels (same x and y coordinates). | |
536 | |
537 **Tips** | |
538 | |
539 - The combine tools puts all samples into a common x-y-grid, therefore pixel coordinates will change. In case the pixels are already annotated, the annotations should be provided as tabular files and the tool will return an annotation file with the new pixel coordinates. This annotation file can then be used together with the combined MSI data for tools in which the annotation is required (e.g. 'MSI classification') or useful (e.g. 'MSI spectra plots'). | |
540 - In case more annotations are required: The annotation input file should have an identifier column, for example the patient_ID. A second tabular file that contains more annotations and also one column with the identifier column (e.g. 'patient_ID') can be merged to the annotation output file of this tool with the tool 'join two files' and then set the 'Column to use' parameters for both files to the identifier column. | |
541 | |
542 | |
543 | |
544 **Output** | |
545 | |
546 - single imzML file containing all valid input files | |
547 - pdf that shows the pixel positions and annotations of the combined files | |
548 - Tabular file with pixel annotations (x,y,column with input file names and up to five annotation columns) | |
549 | |
550 | |
551 ]]> | |
552 </help> | |
553 <expand macro="citations"/> | |
554 </tool> |