comparison msi_combine.xml @ 6:f4aafc565aa3 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
author galaxyp
date Tue, 24 Jul 2018 04:52:39 -0400
parents ff91e78b5c5c
children 19d8eee15959
comparison
equal deleted inserted replaced
5:ff91e78b5c5c 6:f4aafc565aa3
1 <tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.3"> 1 <tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.4">
2 <description> 2 <description>
3 combine several mass spectrometry imaging datasets into one 3 combine several mass spectrometry imaging datasets into one
4 </description> 4 </description>
5 <requirements> 5 <requirements>
6 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement> 6 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement>
18 ln -s '${infile.extra_files_path}/t2m' infile_${i}.t2m && 18 ln -s '${infile.extra_files_path}/t2m' infile_${i}.t2m &&
19 #else 19 #else
20 ln -s '$infile' infile_${i}.RData && 20 ln -s '$infile' infile_${i}.RData &&
21 #end if 21 #end if
22 #end for 22 #end for
23 #for $i, $annotation_file in enumerate($annotation_files):
24 ln -s '$annotation_file' annotation_file_${i}.tabular &&
25 #end for
26
23 cat '${msi_combine}' && 27 cat '${msi_combine}' &&
24 Rscript '${msi_combine}' 28 Rscript '${msi_combine}'
25 29
26 ]]> 30 ]]>
27 </command> 31 </command>
65 69
66 ############## reading files and changing pixel coordinates ################### 70 ############## reading files and changing pixel coordinates ###################
67 71
68 #for $i, $infile in enumerate($infiles): 72 #for $i, $infile in enumerate($infiles):
69 73
70 #if $infile.ext == 'imzml' 74 ## read MSI data
71 #if str($processed_cond.processed_file) == "processed": 75
72 msidata_$i <- readImzML('infile_${i}', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units") 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 #else
80 msidata_$i <- readImzML('infile_${i}')
81 #end if
82 #elif $infile.ext == 'analyze75'
83 msidata_$i <- readAnalyze('infile_${i}')
73 #else 84 #else
74 msidata <- readImzML('infile') 85 msidata_$i = loadRData('infile_${i}.RData')
75 #end if 86 #end if
76 #elif $infile.ext == 'analyze75' 87
77 msidata_$i <- readAnalyze('infile_${i}') 88
78 #else 89 ## read annotation data, up to 5 annotations can be used for now
79 msidata_$i = loadRData('infile_${i}.RData') 90
80 #end if 91 ## read annotation tabular, set first two columns as x and y, merge with coordinates dataframe and order according to pixelorder in msidata
81 92 input_annotation = read.delim("annotation_file_${i}.tabular", header = TRUE,
82 93 stringsAsFactors = FALSE)
83 sampleNames(msidata_$i) = "msidata" ## same name necessary to combine data in one single coordinate system 94 colnames(input_annotation)[1:2] = c("x", "y")
95 msidata_coordinates = cbind(coord(msidata_$i)[,1:2], 1:ncol(msidata_$i))
96 colnames(msidata_coordinates)[3] = "pixel_index"
97 ## only first 5 annotation columns are kept
98 if (ncol(input_annotation) > 7){
99 input_annotation = input_annotation[,1:7]}
100
101 annotation_df = merge(msidata_coordinates, input_annotation, by=c("x", "y"), all.x=TRUE)
102 annotation_df_8 = cbind(annotation_df, data.frame(matrix(NA,ncol=8-ncol(annotation_df), nrow=ncol(msidata_$i))))
103 annotation_df_8_sorted = annotation_df_8[order(annotation_df_8\$pixel_index),]## orders pixel according to msidata
104
105 ## each annotation column is assigned to the pixel in the pData slot of the MSIdata
106 msidata_$i\$column1 = annotation_df_8_sorted[,4]
107 msidata_$i\$column2 = annotation_df_8_sorted[,5]
108 msidata_$i\$column3 = annotation_df_8_sorted[,6]
109 msidata_$i\$column4 = annotation_df_8_sorted[,7]
110 msidata_$i\$column5 = annotation_df_8_sorted[,8]
111
112 ## same name for MSI data files necessary to combine data in one single coordinate system
113 sampleNames(msidata_$i) = "msidata"
84 114
85 ################### preparation xy shifts ########################## 115 ################### preparation xy shifts ##########################
86 116
87 #if str( $combine_conditional.combine_method ) == 'xy_shifts': 117 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
88 118
119 ## shift coordinates according to input tabular file and store file names
89 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] ## shifts x coordinates according to tabular file 120 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] ## shifts x coordinates according to tabular file
90 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] ## shifts y coordinates according to tabular file 121 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] ## shifts y coordinates according to tabular file
91 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 122 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
92 msidata_$i\$combined_sample = rep(paste($i+1, input_list[$i+1,$combine_conditional.column_names], sep="_"),times=ncol(msidata_$i)) 123 msidata_$i\$combined_sample = rep(paste($i+1, input_list[$i+1,$combine_conditional.column_names], sep="_"),times=ncol(msidata_$i))
93 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i))) 124 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i)))
130 valid_dataset = append(valid_dataset, 161 valid_dataset = append(valid_dataset,
131 (ncol(msidata_$i)>0 & nrow(msidata_$i)>0 & sum(spectra(msidata_$i)[], na.rm=TRUE)>0)) 162 (ncol(msidata_$i)>0 & nrow(msidata_$i)>0 & sum(spectra(msidata_$i)[], na.rm=TRUE)>0))
132 163
133 #end for 164 #end for
134 165
166 ## extract columnnames from (last) annotation tabular (for QC plot names)
167 annotation_colnames = colnames(input_annotation)[-c(1,2)]
135 168
136 ###################### automatic combination ################################### 169 ###################### automatic combination ###################################
137 ################################################################################ 170 ################################################################################
138 171
139 #if str( $combine_conditional.combine_method ) == 'automatic_combine': 172 #if str( $combine_conditional.combine_method ) == 'automatic_combine':
152 position_df = cbind(coord(msidata_combined)[,1:2], msidata_combined\$combined_sample) 185 position_df = cbind(coord(msidata_combined)[,1:2], msidata_combined\$combined_sample)
153 colnames(position_df)[3] = "sample_name" 186 colnames(position_df)[3] = "sample_name"
154 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ 187 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
155 geom_tile() + 188 geom_tile() +
156 coord_fixed()+ 189 coord_fixed()+
157 ggtitle("Spatial orientation of combined data")+ 190 ggtitle("Spatial orientation of combined data (sample names)")+
158 theme_bw()+ 191 theme_bw()+
159 theme(text=element_text(family="ArialMT", face="bold", size=15))+ 192 theme(text=element_text(family="ArialMT", face="bold", size=15))+
160 theme(legend.position="bottom",legend.direction="vertical")+ 193 theme(legend.position="bottom",legend.direction="vertical")+
161 guides(fill=guide_legend(ncol=4,byrow=TRUE)) 194 guides(fill=guide_legend(ncol=4,byrow=TRUE))
162 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass") 195 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass")
177 ################################################################################ 210 ################################################################################
178 211
179 #elif str( $combine_conditional.combine_method ) == 'xy_shifts': 212 #elif str( $combine_conditional.combine_method ) == 'xy_shifts':
180 print("xy_shifts") 213 print("xy_shifts")
181 214
182 #if str($combine_conditional.combination_true) == "yes_combi": 215 ## find duplicated coordinates
183 print("combination with xy shifts") 216 all_coordinates = do.call(rbind, list(#echo ','.join($pixelcoords)#))
184 217 duplicated_coordinates= duplicated(all_coordinates[,1:2])| duplicated(all_coordinates[,1:2], fromLast=TRUE)
185 ## find duplicated coordinates
186 all_coordinates = do.call(rbind, list(#echo ','.join($pixelcoords)#))
187 duplicated_coordinates= duplicated(all_coordinates[,1:2])| duplicated(all_coordinates[,1:2], fromLast=TRUE)
188 print(paste0("Number of removed duplicated coordinates: ", sum(duplicated_coordinates)/2)) 218 print(paste0("Number of removed duplicated coordinates: ", sum(duplicated_coordinates)/2))
189 unique_coordinates = all_coordinates[!duplicated_coordinates,] 219 unique_coordinates = all_coordinates[!duplicated_coordinates,]
190 220
191 ## remove duplicated coordinates 221 ## remove duplicated coordinates
192 datasetlist = list() 222 datasetlist = list()
193 count = 1 223 count = 1
194 for (usable_dataset in list(#echo ','.join($msidata)#)){ 224 for (usable_dataset in list(#echo ','.join($msidata)#)){
195 pixelsofinterest = pixels(usable_dataset)[names(pixels(usable_dataset)) %in% rownames(unique_coordinates)] 225 pixelsofinterest = pixels(usable_dataset)[names(pixels(usable_dataset)) %in% rownames(unique_coordinates)]
196 filtered_dataset = usable_dataset[,pixelsofinterest] 226 filtered_dataset = usable_dataset[,pixelsofinterest]
197 if (ncol(filtered_dataset) > 0 ){ 227 if (ncol(filtered_dataset) > 0 ){
198 datasetlist[[count]] = filtered_dataset} 228 datasetlist[[count]] = filtered_dataset}
199 count = count +1} 229 count = count +1}
200 230
201 msidata_combined = do.call(combine, datasetlist) 231 msidata_combined = do.call(combine, datasetlist)
202 232
203 ## save as (.RData) 233 ## save as (.RData)
204 234
205 msidata = msidata_combined 235 msidata = msidata_combined
206 save(msidata, file="$msidata_combined") 236 save(msidata, file="$msidata_combined")
207 237
208 ## create x,y,sample_name dataframe for QC pdf 238 ## create x,y,sample_name dataframe for QC pdf
209 239
210 position_df = cbind(coord(msidata), msidata\$combined_sample) 240 position_df = cbind(coord(msidata), msidata\$combined_sample)
211 colnames(position_df)[3] = "sample_name" 241 colnames(position_df)[3] = "sample_name"
212 242
213 #else: 243 #end if
214 print("no combination, only testing xy shifts") 244
215 245
216 position_df = do.call(rbind, list(#echo ','.join($pixelcoords)#)) 246 ################################## outputs ####################################
217 position_df\$sample_name = as.factor(pixel_vector) 247 ################################################################################
218 248
219 print(paste0("Number of duplicated coordinates: ", sum(duplicated(position_df[,1:2])))) 249 ########### QC with pixels and their annotations ################################
220 250
221 #end if 251 pdf("Combined_qc.pdf", width=15, height=15)
222 252
223 ## create PDF to show all pixels in PDF as QC 253 ## combined plot
224 254 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
225 pdf("Combined_qc.pdf", width=15, height=15) 255 geom_tile() +
226 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ 256 coord_fixed()+
257 ggtitle("Spatial orientation of combined data")+
258 theme_bw()+
259 theme(text=element_text(family="ArialMT", face="bold", size=15))+
260 theme(legend.position="bottom",legend.direction="vertical")+
261 guides(fill=guide_legend(ncol=5,byrow=TRUE))
262 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean)
263 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
264 for(file_count in 1:nrow(coord_labels))
265 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
266 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
267 print(combine_plot)
268
269
270 ## annotation plots
271
272 ## plot 1
273
274 column1_df = cbind(coord(msidata), msidata\$column1)
275 colnames(column1_df)[3] = "column1"
276
277 if (sum(is.na(column1_df[3])) < nrow(column1_df)){
278 column1_plot = ggplot(column1_df, aes(x=x, y=y, fill=column1))+
227 geom_tile() + 279 geom_tile() +
228 coord_fixed()+ 280 coord_fixed()+
229 ggtitle("Spatial orientation of combined data")+ 281 ggtitle(paste0(annotation_colnames[1]))+
230 theme_bw()+ 282 theme_bw()+
231 theme(text=element_text(family="ArialMT", face="bold", size=15))+ 283 theme(text=element_text(family="ArialMT", face="bold", size=15))+
232 theme(legend.position="bottom",legend.direction="vertical")+ 284 theme(legend.position="bottom",legend.direction="vertical")+
233 guides(fill=guide_legend(ncol=5,byrow=TRUE)) 285 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[1]))
234 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean) 286 print(column1_plot)}
235 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name) 287 ##rename columnname for output tabular file
236 for(file_count in 1:nrow(coord_labels)) 288 colnames(column1_df)[3] = annotation_colnames[1]
237 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"], 289
238 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))} 290 ## plot 2
239 print(combine_plot) 291 column2_df = cbind(coord(msidata), msidata\$column2)
292 colnames(column2_df)[3] = "column2"
293
294 if (sum(is.na(column2_df[3])) < nrow(column2_df)){
295 column2_plot = ggplot(column2_df, aes(x=x, y=y, fill=column2))+
296 geom_tile() +
297 coord_fixed()+
298 ggtitle(paste0(annotation_colnames[2]))+
299 theme_bw()+
300 theme(text=element_text(family="ArialMT", face="bold", size=15))+
301 theme(legend.position="bottom",legend.direction="vertical")+
302 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[2]))
303 print(column2_plot)}
304 ##rename columnname for output tabular file
305 colnames(column2_df)[3] = annotation_colnames[2]
306
307 ## plot 3
308 column3_df = cbind(coord(msidata), msidata\$column3)
309 colnames(column3_df)[3] = "column3"
310 if (sum(is.na(column3_df[3])) < nrow(column3_df)){
311 column3_plot = ggplot(column3_df, aes(x=x, y=y, fill=column3))+
312 geom_tile() +
313 coord_fixed()+
314 ggtitle(paste0(annotation_colnames[3]))+
315 theme_bw()+
316 theme(text=element_text(family="ArialMT", face="bold", size=15))+
317 theme(legend.position="bottom",legend.direction="vertical")+
318 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[3]))
319 print(column3_plot)}
320 ##rename columnname for output tabular file
321 colnames(column3_df)[3] = annotation_colnames[3]
322
323 ## plot 4
324 column4_df = cbind(coord(msidata), msidata\$column4)
325 colnames(column4_df)[3] = "column4"
326
327 if (sum(is.na(column4_df[3])) < nrow(column4_df)){
328 column4_plot = ggplot(column4_df, aes(x=x, y=y, fill=column4))+
329 geom_tile() +
330 coord_fixed()+
331 ggtitle(paste0(annotation_colnames[4]))+
332 theme_bw()+
333 theme(text=element_text(family="ArialMT", face="bold", size=15))+
334 theme(legend.position="bottom",legend.direction="vertical")+
335 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[4]))
336 print(column4_plot)}
337 ##rename columnname for output tabular file
338 colnames(column4_df)[3] = annotation_colnames[4]
339
340 ## plot5
341
342 column5_df = cbind(coord(msidata), msidata\$column5)
343 colnames(column5_df)[3] = "column5"
344 if (sum(is.na(column5_df[3])) < nrow(column5_df)){
345 column5_plot = ggplot(column5_df, aes(x=x, y=y, fill=column5))+
346 geom_tile() +
347 coord_fixed()+
348 ggtitle(paste0(annotation_colnames[5]))+
349 theme_bw()+
350 theme(text=element_text(family="ArialMT", face="bold", size=15))+
351 theme(legend.position="bottom",legend.direction="vertical")+
352 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[5]))
353 print(column5_plot)}
354 ##rename columnname for output tabular file
355 colnames(column5_df)[3] = annotation_colnames[5]
356
240 dev.off() 357 dev.off()
241 358
242 #end if 359 ##################### annotation tabular output ################################
243
244 ####################### optional matrix output #################################
245
246 #if $output_matrix:
247 360
248 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){ 361 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){
249 spectramatrix = spectra(msidata)[] 362 annotation_df_list = list(position_df, column1_df, column2_df, column3_df, column4_df, column5_df)
250 spectramatrix = cbind(mz(msidata),spectramatrix) 363 combined_annotations = Reduce(function(...) merge(..., by=c("x", "y"), all=TRUE), annotation_df_list)
251 newmatrix = rbind(c("mz | spectra", names(pixels(msidata))), spectramatrix) 364 write.table(combined_annotations, file="$annotation_output", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t")
252 write.table(newmatrix, file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
253 }else{ 365 }else{
254 print("file has no features or pixels left") 366 print("No annotation tabular output because file has no features or pixels left")
255 } 367 }
256 368
257 #end if 369 ####################### optional matrix output #################################
370
371 #if $output_matrix:
372
373 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){
374 spectramatrix = spectra(msidata)[]
375 spectramatrix = cbind(mz(msidata),spectramatrix)
376 newmatrix = rbind(c("mz | spectra", names(pixels(msidata))), spectramatrix)
377 write.table(newmatrix, file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
378 }else{
379 print("No intensity matrix output because file has no features or pixels left")
380 }
381
382 #end if
258 383
259 ]]></configfile> 384 ]]></configfile>
260 </configfiles> 385 </configfiles>
261 <inputs> 386 <inputs>
262 <param name="infiles" type="data" multiple="true" format="imzml,rdata,analyze75" 387 <param name="infiles" type="data" multiple="true" format="imzml,rdata,analyze75"
274 <option value="mz" >mz</option> 399 <option value="mz" >mz</option>
275 <option value="ppm" selected="True" >ppm</option> 400 <option value="ppm" selected="True" >ppm</option>
276 </param> 401 </param>
277 </when> 402 </when>
278 </conditional> 403 </conditional>
404 <param name="annotation_files" type="data" multiple="true" format="tabular"
405 label="Pixel annotations as tabular files"
406 help="Tabular files should have the same order as input files"/>
279 <conditional name="combine_conditional"> 407 <conditional name="combine_conditional">
280 <param name="combine_method" type="select" label="Select the way you want to combine multiple files" help="More detailed help can be found in the help section at the bottom"> 408 <param name="combine_method" type="select" label="Select the way you want to combine multiple files" help="More detailed help can be found in the help section at the bottom">
281 <option value="automatic_combine" selected="True" >automatic combination</option> 409 <option value="automatic_combine" selected="True" >automatic combination</option>
282 <option value="xy_shifts">xy shifts by hand</option> 410 <option value="xy_shifts">shift xy coordinates with a tabular file</option>
283 </param> 411 </param>
284 <when value="automatic_combine"/> 412 <when value="automatic_combine"/>
285 <when value="xy_shifts"> 413 <when value="xy_shifts">
286 <param name="coordinates_file" type="data" format="tabular" label="datasetnames, X and y values to shift data before combining" 414 <param name="coordinates_file" type="data" format="tabular" label="datasetnames, x and y values to shift pixel coordinates before combining"
287 help="Tabular file with three columns: 1 for the filename, 1 for the x-coordinate shift and 1 for the y-coordinate shift"/> 415 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."/>
288 <param name="column_x" data_ref="coordinates_file" label="Column with values for shift in x direction" type="data_column"/> 416 <param name="column_x" data_ref="coordinates_file" label="Column with values for shift in x direction" type="data_column"/>
289 <param name="column_y" data_ref="coordinates_file" label="Column with values for shift in y direction" type="data_column"/> 417 <param name="column_y" data_ref="coordinates_file" label="Column with values for shift in y direction" type="data_column"/>
290 <param name="column_names" data_ref="coordinates_file" label="Column with dataset names" type="data_column"/> 418 <param name="column_names" data_ref="coordinates_file" label="Column with dataset names" type="data_column"/>
291 <param name="combination_true" type="boolean" display="radio" truevalue="yes_combi" falsevalue="no_combi" label="Combine datasets" help = "If there are duplicated pixels they will be deleted. If it is not clear if there are duplicated pixels, select No to get an idea about the pixel overlap"/>
292 </when> 419 </when>
293 </conditional> 420 </conditional>
294 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/> 421 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/>
295 </inputs> 422 </inputs>
296 <outputs> 423 <outputs>
297 <data format="rdata" name="msidata_combined" label="MSI_data_combined"/> 424 <data format="rdata" name="msidata_combined" label="MSI_data_combined"/>
298 <data format="pdf" name="combining_qc" from_work_dir="Combined_qc.pdf" label = "Combined_QC"/> 425 <data format="pdf" name="combining_qc" from_work_dir="Combined_qc.pdf" label = "Combined_QC"/>
426 <data format="tabular" name="annotation_output" label="Annotation_tabular"/>
299 <data format="tabular" name="matrixasoutput" label="Combined_matrix"> 427 <data format="tabular" name="matrixasoutput" label="Combined_matrix">
300 <filter>output_matrix</filter> 428 <filter>output_matrix</filter>
301 </data> 429 </data>
302 </outputs> 430 </outputs>
303 <tests> 431 <tests>
304 <test expect_num_outputs="3"> 432 <test expect_num_outputs="4">
305 <param name="infiles" value="msidata_1.RData,msidata_2.RData,msidata_3.RData" ftype="rdata"/> 433 <param name="infiles" value="msidata_1.RData,msidata_2.RData,msidata_3.RData" ftype="rdata"/>
434 <param name="annotation_files" value="annotations_file1.tabular,annotations_file2.tabular,annotations_file3.tabular" ftype="tabular"/>
306 <param name="combine_method" value="xy_shifts"/> 435 <param name="combine_method" value="xy_shifts"/>
307 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/> 436 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/>
308 <param name="column_x" value="1"/> 437 <param name="column_x" value="1"/>
309 <param name="column_y" value="2"/> 438 <param name="column_y" value="2"/>
310 <param name="column_names" value="3"/> 439 <param name="column_names" value="3"/>
311 <param name="combination_true" value="yes_combi"/>
312 <param name="output_matrix" value="True"/> 440 <param name="output_matrix" value="True"/>
313 <output name="matrixasoutput" file="123_combined_matrix.tabular"/> 441 <output name="matrixasoutput" file="123_combined_matrix.tabular"/>
442 <output name="annotation_output" file="123_annotation_output.tabular"/>
314 <output name="msidata_combined" file="123_combined.RData" compare="sim_size" /> 443 <output name="msidata_combined" file="123_combined.RData" compare="sim_size" />
315 <output name="combining_qc" file="123_combined_QC.pdf" compare="sim_size" delta="20000"/> 444 <output name="combining_qc" file="123_combined_QC.pdf" compare="sim_size" delta="20000"/>
316 </test> 445 </test>
317 <test expect_num_outputs="2"> 446 <test expect_num_outputs="4">
318 <param name="infiles" value="msidata_1.RData,msidata_2.RData,msidata_3.RData" ftype="rdata"/>
319 <param name="combine_method" value="xy_shifts"/>
320 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/>
321 <param name="column_x" value="1"/>
322 <param name="column_y" value="2"/>
323 <param name="column_names" value="3"/>
324 <param name="combination_true" value="no_combi"/>
325 <output name="msidata_combined" file="123_no_combi.RData" compare="sim_size" />
326 <output name="combining_qc" file="123_no_combi_QC.pdf" compare="sim_size" delta="20000"/>
327 </test>
328 <test expect_num_outputs="3">
329 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/> 447 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/>
448 <param name="annotation_files" value="annotations_file1.tabular,annotations_file2.tabular" ftype="tabular"/>
330 <param name="combine_method" value="automatic_combine"/> 449 <param name="combine_method" value="automatic_combine"/>
331 <param name="output_matrix" value="True"/> 450 <param name="output_matrix" value="True"/>
332 <output name="matrixasoutput" file="12_combined_matrix.tabular"/> 451 <output name="matrixasoutput" file="12_combined_matrix.tabular"/>
452 <output name="annotation_output" file="12_annotation_output.tabular"/>
333 <output name="msidata_combined" file="12_combined.RData" compare="sim_size" /> 453 <output name="msidata_combined" file="12_combined.RData" compare="sim_size" />
334 <output name="combining_qc" file="12_combined_QC.pdf" compare="sim_size" delta="20000"/> 454 <output name="combining_qc" file="12_combined_QC.pdf" compare="sim_size" delta="20000"/>
335 </test> 455 </test>
336 <test expect_num_outputs="2"> 456 <test expect_num_outputs="3">
337 <param name="infiles" value="msidata_1.RData,123_combined.RData" ftype="rdata"/> 457 <param name="infiles" value="msidata_1.RData,123_combined.RData" ftype="rdata"/>
458 <param name="annotation_files" value="annotations_file1.tabular,123_annotation.tabular" ftype="tabular"/>
338 <param name="combine_method" value="automatic_combine"/> 459 <param name="combine_method" value="automatic_combine"/>
339 <param name="output_matrix" value="False"/> 460 <param name="output_matrix" value="False"/>
461 <output name="annotation_output" file="112_annotation_output.tabular"/>
340 <output name="msidata_combined" file="112_auto_combined.RData" compare="sim_size" /> 462 <output name="msidata_combined" file="112_auto_combined.RData" compare="sim_size" />
341 <output name="combining_qc" file="112_auto_combined_QC.pdf" compare="sim_size" delta="20000"/> 463 <output name="combining_qc" file="112_auto_combined_QC.pdf" compare="sim_size" delta="20000"/>
342 </test> 464 </test>
343 </tests> 465 </tests>
344 <help> 466 <help>
352 474
353 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ 475 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
354 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) 476 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
355 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) 477 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData)
356 478
357 Prerequisite: 479
358 480 Input:
359 - 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) 481
482 - MSI data files with 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)
483 - Tabular files with pixel annotations need to have the x values in the first column, y values in the second column and then up to five annotations in the next columns. The order of the annotations in the columns must be the same for all files (x and y in column 1 and 2; annotation1 in column3, annotation2 in column4,...)
484 - The order and the number of MSI data files and annotation tabular files must be the same
485 - For xy shifts with tabular file: Tabular file with x and y coordinates shift and file name (see below)
360 486
361 Options: 487 Options:
362 488
363 - "automatic combination": files are automatically arranged in a grid, subfiles are named according to input file name 489 - "automatic combination": files are automatically arranged in a grid (duplicated pixels are allowed), subfiles are named according to the input file name
364 - "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 and the file name in a third column). To test if the pixels are correctly shifted use "combine datasets: No". 490 - "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 and the file name in a third column). The xy shift option combines all datasets and removes all duplicated pixels (same x and y coordinates).
365 Combine datasets: Yes - Combines all datasets and removes all duplicated pixels (same x and y coordinates). 491
366 492
367 Output: 493 Output:
368 494
369 - imzML file containing multiple subfiles 495 - single imzML file
370 - pdf that shows the pixel positions of the combined files 496 - pdf that shows the pixel positions and annotations of the combined files
497 - Tabular file with pixel annotations (x,y,column with input file names, up to five annotation columns)
371 - optional: intensity matrix as tabular file (intensities for m/z in rows and pixel in columns) 498 - optional: intensity matrix as tabular file (intensities for m/z in rows and pixel in columns)
372 499
373 500
374 ]]> 501 ]]>
375 </help> 502 </help>