comparison msi_combine.xml @ 3:91bba2486773 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
author galaxyp
date Mon, 11 Jun 2018 17:33:28 -0400
parents 00b6c61f5054
children d05bd881af3d
comparison
equal deleted inserted replaced
2:00b6c61f5054 3:91bba2486773
1 <tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.0"> 1 <tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.1">
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>
8 </requirements> 8 </requirements>
9 <command detect_errors="exit_code"> 9 <command detect_errors="exit_code">
10 <![CDATA[ 10 <![CDATA[
11 #for $i, $infile in enumerate($infiles): 11 #for $i, $infile in enumerate($infiles):
12 #if $infile.ext == 'imzml' 12 #if $infile.ext == 'imzml'
13 ln -s '${infile.extra_files_path}/imzml' infile.imzML && 13 ln -s '${infile.extra_files_path}/imzml' infile_${i}.imzML &&
14 ln -s '${infile.extra_files_path}/ibd' infile.ibd && 14 ln -s '${infile.extra_files_path}/ibd' infile_${i}.ibd &&
15 #elif $infile.ext == 'analyze75' 15 #elif $infile.ext == 'analyze75'
16 ln -s '${infile.extra_files_path}/hdr' infile.hdr && 16 ln -s '${infile.extra_files_path}/hdr' infile_${i}.hdr &&
17 ln -s '${infile.extra_files_path}/img' infile.img && 17 ln -s '${infile.extra_files_path}/img' infile_${i}.img &&
18 ln -s '${infile.extra_files_path}/t2m' infile.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 cat '${msi_combine}' && 23 cat '${msi_combine}' &&
25 25
26 ]]> 26 ]]>
27 </command> 27 </command>
28 <configfiles> 28 <configfiles>
29 <configfile name="msi_combine"><![CDATA[ 29 <configfile name="msi_combine"><![CDATA[
30
30 #import re 31 #import re
31 ################ load libraries, read rename and combine files ################# 32
33 ################ load libraries and some preparations #################
32 34
33 library(Cardinal) 35 library(Cardinal)
34 library(ggplot2) 36 library(ggplot2)
37
38 ## read tabular file for xy_shift option
35 39
36 #if str( $combine_conditional.combine_method ) == 'xy_shifts': 40 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
37 input_list = read.delim("$combine_conditional.coordinates_file", header = FALSE, 41 input_list = read.delim("$combine_conditional.coordinates_file", header = FALSE,
38 stringsAsFactors = FALSE) 42 stringsAsFactors = FALSE)
39 #end if 43 #end if
44
45 ## load RData and store with new variable name
40 46
41 loadRData <- function(fileName){ 47 loadRData <- function(fileName){
42 #loads an RData file, and returns it 48 #loads an RData file, and returns it
43 load(fileName) 49 load(fileName)
44 get(ls()[ls() != "fileName"]) 50 get(ls()[ls() != "fileName"])
45 } 51 }
46 52
53 ## preparations for reading files one by one with for loop
54
47 pixel_vector = numeric() 55 pixel_vector = numeric()
48 names_vector = character()
49 x_shifts = 0 56 x_shifts = 0
50 y_shifts = 0 57 y_shifts = 0
51 max_y = numeric() 58 max_y = numeric()
52 59 valid_dataset = logical()
53 #set $msidata = [] 60 #set $msidata = []
54 #set $pixelcoords = [] 61 #set $pixelcoords = []
55 #set $num_infiles = len($infiles) 62 #set $num_infiles = len($infiles)
56 all_files = $num_infiles 63 all_files = $num_infiles
64
65
66 ############## reading files and changing pixel coordinates ###################
57 67
58 #for $i, $infile in enumerate($infiles): 68 #for $i, $infile in enumerate($infiles):
59 69
60 #if $infile.ext == 'imzml' 70 #if $infile.ext == 'imzml'
61 msidata_$i <- readImzML('infile_${i}') 71 msidata_$i <- readImzML('infile_${i}')
62 #elif $infile.ext == 'analyze75' 72 #elif $infile.ext == 'analyze75'
63 msidata_$i <- readAnalyze('infile_${i}') 73 msidata_$i <- readAnalyze('infile_${i}')
64 #else 74 #else
65 msidata_$i = loadRData('infile_${i}.RData') 75 msidata_$i = loadRData('infile_${i}.RData')
66 #end if 76 #end if
67 77
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) 78 sampleNames(msidata_$i) = "msidata" ## same name necessary to combine data in one single coordinate system
69 sampleNames(msidata_$i) = "msidata" 79
80 ################### preparation xy shifts ##########################
81
82 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
83
84 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] ## shifts x coordinates according to tabular file
85 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] ## shifts y coordinates according to tabular file
86 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
87
70 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i))) 88 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i)))
71 89 #silent $pixelcoords.append('pixelcoords_'+str($i))
72 #if str( $combine_conditional.combine_method ) == 'xy_shifts': 90 colnames(pixelcoords_$i)[3] = "file_number"
73 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] 91
74 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] 92 ################### preparation automatic combination ##########################
75 pixel_vector = append(pixel_vector, rep(input_list[$i+1,$combine_conditional.column_names],times=ncol(msidata_$i))) 93
76
77 #elif str( $combine_conditional.combine_method ) == 'automatic_combine': 94 #elif str( $combine_conditional.combine_method ) == 'automatic_combine':
78 #set escaped_element_identifier = re.sub('[^\w\-\s\[/]]', '_', str($infile.element_identifier)) 95 names_vector = character()
79 names_vector = append(names_vector, rep(paste($i+1, "$escaped_element_identifier", sep="_"),ncol(msidata_$i))) 96 #set escaped_element_identifier = re.sub('[^\w\-\s\[/]]', '_', str($infile.element_identifier)) ## use name of inputfile from Galaxy
97 if (sum(spectra(msidata_$i))>0) ## use only valid files
98 {
99 if (is.null(levels(msidata_$i\$combined_sample))) ### if the file was not combined before use input file name, otherwise keep combined_sample name which was assigned before
100 {
101 names_vector = append(names_vector, rep(paste($i+1, "$escaped_element_identifier", sep="_"),ncol(msidata_$i)))
102 msidata_$i\$combined_sample = as.factor(names_vector)
103 }
104 }
105
106 ## Number of input files define grid which is row-wise filled with files
107
80 coord(msidata_$i)\$x = coord(msidata_$i)\$x - (min(coord(msidata_$i)\$x-1)) + x_shifts 108 coord(msidata_$i)\$x = coord(msidata_$i)\$x - (min(coord(msidata_$i)\$x-1)) + x_shifts
81 coord(msidata_$i)\$y = coord(msidata_$i)\$y - (min(coord(msidata_$i)\$y-1)) + y_shifts 109 coord(msidata_$i)\$y = coord(msidata_$i)\$y - (min(coord(msidata_$i)\$y-1)) + y_shifts
82 x_shifts = max(coord(msidata_$i)\$x) + $combine_conditional.x_distance 110 x_shifts = max(coord(msidata_$i)\$x) + 5
83 max_y = append(max_y, max(coord(msidata_$i)\$y)) 111 max_y = append(max_y, max(coord(msidata_$i)\$y))
84
85 all_files = $num_infiles 112 all_files = $num_infiles
86 new_row = ($i+1)/ceiling(sqrt(all_files)) 113 new_row = ($i+1)/ceiling(sqrt(all_files))
87 new_row%%1==0 114 new_row%%1==0
88 if (new_row%%1==0) 115 if (new_row%%1==0)
89 {x_shifts = 0 ### x values start again at zero 116 {x_shifts = 0 ### when row is filled: x values start again at zero
90 y_shifts = max(max_y) + $combine_conditional.y_distance 117 y_shifts = max(max_y) + 5 ### when row is filled: y value increases to start a new row
91 max_y = numeric()} 118 max_y = numeric()}
92 119
93 #end if 120 #end if
121
122 ## store files to combine them later and for each file check if it is valid
123
94 #silent $msidata.append('msidata_'+str($i)) 124 #silent $msidata.append('msidata_'+str($i))
95 #silent $pixelcoords.append('pixelcoords_'+str($i)) 125 valid_dataset = append(valid_dataset,
126 (ncol(msidata_$i)>0 & nrow(msidata_$i)>0 & sum(spectra(msidata_$i))>0))
127
96 #end for 128 #end for
97 colnames(pixelcoords_$i)[3] = "file_number" 129
98 130
99 ###################### automatic combination ################################### 131 ###################### automatic combination ###################################
100 ################################################################################ 132 ################################################################################
101 133
102 #if str( $combine_conditional.combine_method ) == 'automatic_combine': 134 #if str( $combine_conditional.combine_method ) == 'automatic_combine':
103 print("automatic_combine") 135 print("automatic_combine")
104 msidata_combined = do.call(combine, list(#echo ','.join($msidata)#)) 136
105 print("combination successful") 137 ## combine only valid datasets
106 sample_names = as.factor(names_vector) 138
107 pData(msidata_combined)\$sample = sample_names 139 valid_data = list(#echo ','.join($msidata)#)[valid_dataset]
108 print("names successful") 140 msidata_combined = do.call(combine, valid_data)
109 141 print("Valid datasets in order of input bottom to top:")
110 ## create PDF to show pixels of each file 142 print(valid_dataset)
111 pdf("combining_qc.pdf", width=15, height=15) 143
112 position_df = cbind(coord(msidata_combined)[,1:2], pData(msidata_combined)\$sample) 144 ## create dataframe with x,y,sample_name and show all pixels in PDF as QC
145
146 pdf("Combined_qc.pdf", width=15, height=15)
147 position_df = cbind(coord(msidata_combined)[,1:2], msidata_combined\$combined_sample)
113 colnames(position_df)[3] = "sample_name" 148 colnames(position_df)[3] = "sample_name"
114 print("position_df")
115
116 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ 149 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
117 geom_tile() + 150 geom_tile() +
118 coord_fixed()+ 151 coord_fixed()+
119 ggtitle("Spatial orientation of combined data")+ 152 ggtitle("Spatial orientation of combined data")+
120 theme_bw()+ 153 theme_bw()+
121 theme(text=element_text(family="ArialMT", face="bold", size=15))+ 154 theme(text=element_text(family="ArialMT", face="bold", size=15))+
122 theme(legend.position="bottom",legend.direction="vertical")+ 155 theme(legend.position="bottom",legend.direction="vertical")+
123 guides(fill=guide_legend(ncol=4,byrow=TRUE)) 156 guides(fill=guide_legend(ncol=4,byrow=TRUE))
124
125
126 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean) 157 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean)
127 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name) 158 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
128 for(file_count in 1:nrow(coord_labels)) 159 for(file_count in 1:nrow(coord_labels))
129 { 160 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
130 combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4])) 161 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
131 }
132
133 print(combine_plot) 162 print(combine_plot)
134 dev.off() 163 dev.off()
135 164
136 ## save as (.RData) 165 ## save as (.RData)
166
137 msidata = msidata_combined 167 msidata = msidata_combined
138 save(msidata, file="$msidata_combined") 168 save(msidata, file="$msidata_combined")
169
170
139 ################################## xy shifts ################################### 171 ################################## xy shifts ###################################
140 ################################################################################ 172 ################################################################################
173
141 #elif str( $combine_conditional.combine_method ) == 'xy_shifts': 174 #elif str( $combine_conditional.combine_method ) == 'xy_shifts':
142 print("xy_shifts") 175 print("xy_shifts")
143 msidata_combined = do.call(combine, list(#echo ','.join($msidata)#)) 176
144 177 #if str($combine_conditional.combination_true) == "yes_combi":
145 ############# replace NA with 0 and rename pixels according to dataset ######### 178 print("combination with xy shifts")
146 179
147 spectra(msidata_combined)[is.na(spectra(msidata_combined))] <- 0 180 msidata_combined = do.call(combine, list(#echo ','.join($msidata)#))
148 print(paste0("Number of NAs which were replaced ",sum(is.na(spectra(msidata_combined))))) 181 sample_names = as.factor(pixel_vector) ## the sample names are assigned to each pixel
149 182 msidata_combined\$combined_sample = sample_names ## sample names are stored in $combined_sample slot
150 sample_names = as.factor(pixel_vector) 183
151 pData(msidata_combined)\$sample = sample_names 184 ## save as (.RData)
152 185
153 ###################################### outputs ################################# 186 msidata = msidata_combined
154 ## save as (.RData) 187 save(msidata, file="$msidata_combined")
155 msidata = msidata_combined 188
156 save(msidata, file="$msidata_combined") 189 ## create x,y,sample_name dataframe for QC pdf
157 190
158 ## create PDF to show pixels of each file 191 position_df = cbind(coord(msidata), msidata\$combined_sample)
159 pdf("combining_qc.pdf") 192 colnames(position_df)[3] = "sample_name"
160 position_df = cbind(coord(msidata), pData(msidata)\$sample) 193
161 colnames(position_df)[3] = "sample_name" 194 #else:
162 195 print("no combination, only testing xy shifts")
196
197 position_df = do.call(rbind, list(#echo ','.join($pixelcoords)#))
198 position_df\$sample_name = as.factor(pixel_vector)
199
200 #end if
201
202 ## create PDF to show all pixels in PDF as QC
203
204 pdf("Combined_qc.pdf", width=15, height=15)
163 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+ 205 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
164 geom_tile() + 206 geom_tile() +
165 coord_fixed()+ 207 coord_fixed()+
166 ggtitle("Spatial orientation of combined data")+ 208 ggtitle("Spatial orientation of combined data")+
167 theme_bw()+ 209 theme_bw()+
168 theme(text=element_text(family="ArialMT", face="bold", size=12)) 210 theme(text=element_text(family="ArialMT", face="bold", size=15))+
169 211 theme(legend.position="bottom",legend.direction="vertical")+
212 guides(fill=guide_legend(ncol=4,byrow=TRUE))
170 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean) 213 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean)
214 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
171 for(file_count in 1:nrow(coord_labels)) 215 for(file_count in 1:nrow(coord_labels))
172 { 216 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
173 combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,"sample_name"])) 217 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
174 }
175
176 print(combine_plot) 218 print(combine_plot)
177
178 dev.off() 219 dev.off()
179 220
180
181 ################################## no shifts ###################################
182 ################################################################################
183 #elif str( $combine_conditional.combine_method ) == 'no_shifts':
184 print("no_shifts")
185 msidata_combined = do.call(combine, list(#echo ','.join($msidata)#))
186
187 ############# replace NA with 0 and rename pixels according to dataset #########
188
189 spectra(msidata_combined)[is.na(spectra(msidata_combined))] <- 0
190 print(paste0("Number of NAs which were replaced ",sum(is.na(spectra(msidata_combined)))))
191
192 ###################################### outputs #################################
193 ## save as (.RData)
194 msidata = msidata_combined
195 save(msidata, file="$msidata_combined")
196
197 ## create PDF to show pixels of each file
198 pdf("combining_qc.pdf")
199 position_df = cbind(coord(msidata), pData(msidata)\$sample)
200 colnames(position_df)[3] = "sample_name"
201
202 ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
203 geom_tile() +
204 coord_fixed()+
205 ggtitle("Spatial orientation of combined data")+
206 theme_bw()+
207 theme(text=element_text(family="ArialMT", face="bold", size=12))
208
209 dev.off()
210
211
212 ################################## no combination ##############################
213 ################################################################################
214 #elif str( $combine_conditional.combine_method ) == 'no_combine':
215 print("no_combine")
216
217 ## create PDF to show pixels of each file
218 pdf("combining_qc.pdf")
219 position_df = do.call(rbind, list(#echo ','.join($pixelcoords)#))
220 position_df[duplicated(position_df[,1:2]),3] = 0
221 position_df\$file_number = as.factor(position_df\$file_number)
222
223 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=file_number))+
224 geom_tile() +
225 coord_fixed()+
226 ggtitle("Spatial orientation before combination")+
227 theme_bw()+
228 theme(text=element_text(family="ArialMT", face="bold", size=12))+
229 theme(panel.grid.major = element_line(colour = "black")) +
230 scale_x_continuous(minor_breaks = seq(min(position_df\$x-50), max(position_df\$x+50, 1))) +
231 scale_y_continuous(minor_breaks = seq(min(position_df\$y-50), max(position_df\$y+50, 1)))
232
233
234 coord_labels = aggregate(cbind(x,y)~file_number, data=position_df, mean)
235 for(file_count in 1:nrow(coord_labels))
236 {
237 combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,"file_number"]))
238 }
239
240 print(combine_plot)
241
242 dev.off()
243 #end if 221 #end if
222
223 ####################### optional matrix output #################################
244 224
245 #if $output_matrix: 225 #if $output_matrix:
246 226
247 if (length(features(msidata_combined))> 0 & length(pixels(msidata_combined)) > 0) 227 if (length(features(msidata_combined))> 0 & length(pixels(msidata_combined)) > 0)
248 { 228 {
262 label="MSI rawdata as imzml, analyze7.5 or Cardinal MSImageSet saved as RData" 242 label="MSI rawdata as imzml, analyze7.5 or Cardinal MSImageSet saved as RData"
263 help="load imzml and ibd file by uploading composite datatype imzml"/> 243 help="load imzml and ibd file by uploading composite datatype imzml"/>
264 <conditional name="combine_conditional"> 244 <conditional name="combine_conditional">
265 <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"> 245 <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">
266 <option value="automatic_combine" selected="True" >automatic combination</option> 246 <option value="automatic_combine" selected="True" >automatic combination</option>
267 <option value="no_shifts" >no coordinates shift</option>
268 <option value="xy_shifts">xy shifts by hand</option> 247 <option value="xy_shifts">xy shifts by hand</option>
269 <option value="no_combine">check pixels before combination</option>
270 </param> 248 </param>
271 <when value="no_shifts"> 249 <when value="automatic_combine"/>
272 </when>
273 <when value="automatic_combine">
274 <param name="x_distance" type="integer" value="10" label="How many pixels in x direction should be between files?"/>
275 <param name="y_distance" type="integer" value="10" label="How many pixels in y direction should be between files?"/>
276 </when>
277 <when value="xy_shifts"> 250 <when value="xy_shifts">
278 <param name="coordinates_file" type="data" format="tabular" label="datasetnames, X and y values to shift data before combining" 251 <param name="coordinates_file" type="data" format="tabular" label="datasetnames, X and y values to shift data before combining"
279 help="Tabular file with three columns: 1 for the filename, 1 for the x-coordinate shift and 1 for the y-coordinate shift"/> 252 help="Tabular file with three columns: 1 for the filename, 1 for the x-coordinate shift and 1 for the y-coordinate shift"/>
280 <param name="column_x" data_ref="coordinates_file" label="Column with values for shift in x direction" type="data_column"/> 253 <param name="column_x" data_ref="coordinates_file" label="Column with values for shift in x direction" type="data_column"/>
281 <param name="column_y" data_ref="coordinates_file" label="Column with values for shift in y direction" type="data_column"/> 254 <param name="column_y" data_ref="coordinates_file" label="Column with values for shift in y direction" type="data_column"/>
282 <param name="column_names" data_ref="coordinates_file" label="Column with dataset names" type="data_column"/> 255 <param name="column_names" data_ref="coordinates_file" label="Column with dataset names" type="data_column"/>
256 <param name="combination_true" type="boolean" display="radio" truevalue="yes_combi" falsevalue="no_combi" label="Combine datasets" help = "Combination only works if x and y-shifts lead to unique pixel positions. If this is unknown use the No option to get an idea about the pixel overlap"/>
283 </when> 257 </when>
284 <when value="no_combine"/>
285 </conditional> 258 </conditional>
286 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/> 259 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/>
287 </inputs> 260 </inputs>
288 <outputs> 261 <outputs>
289 <data format="rdata" name="msidata_combined" label="Combined MSI data"/> 262 <data format="rdata" name="msidata_combined" label="MSI_data_combined"/>
290 <data format="pdf" name="combining_qc" from_work_dir="combining_qc.pdf" label = "Combined image of pixels"/> 263 <data format="pdf" name="combining_qc" from_work_dir="Combined_qc.pdf" label = "Combined_QC"/>
291 <data format="tabular" name="matrixasoutput" label="Combined matrix"> 264 <data format="tabular" name="matrixasoutput" label="Combined_matrix">
292 <filter>output_matrix</filter> 265 <filter>output_matrix</filter>
293 </data> 266 </data>
294 </outputs> 267 </outputs>
295 <tests> 268 <tests>
296 <test expect_num_outputs="3"> 269 <test expect_num_outputs="3">
298 <param name="combine_method" value="xy_shifts"/> 271 <param name="combine_method" value="xy_shifts"/>
299 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/> 272 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/>
300 <param name="column_x" value="1"/> 273 <param name="column_x" value="1"/>
301 <param name="column_y" value="2"/> 274 <param name="column_y" value="2"/>
302 <param name="column_names" value="3"/> 275 <param name="column_names" value="3"/>
276 <param name="combination_true" value="yes_combi"/>
303 <param name="output_matrix" value="True"/> 277 <param name="output_matrix" value="True"/>
304 <output name="matrixasoutput" file="123_combined_matrix.tabular"/> 278 <output name="matrixasoutput" file="123_combined_matrix.tabular"/>
305 <output name="msidata_combined" file="123_combined.RData" compare="sim_size" /> 279 <output name="msidata_combined" file="123_combined.RData" compare="sim_size" />
306 <output name="combining_qc" file="123_combined_QC.pdf" compare="sim_size" delta="20000"/> 280 <output name="combining_qc" file="123_combined_QC.pdf" compare="sim_size" delta="20000"/>
307 </test> 281 </test>
282 <test expect_num_outputs="2">
283 <param name="infiles" value="msidata_1.RData,msidata_2.RData,msidata_3.RData" ftype="rdata"/>
284 <param name="combine_method" value="xy_shifts"/>
285 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/>
286 <param name="column_x" value="1"/>
287 <param name="column_y" value="2"/>
288 <param name="column_names" value="3"/>
289 <param name="combination_true" value="no_combi"/>
290 <output name="msidata_combined" file="123_no_combi.RData" compare="sim_size" />
291 <output name="combining_qc" file="123_no_combi_QC.pdf" compare="sim_size" delta="20000"/>
292 </test>
308 <test expect_num_outputs="3"> 293 <test expect_num_outputs="3">
309 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/> 294 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/>
310 <param name="combine_method" value="no_shifts"/> 295 <param name="combine_method" value="automatic_combine"/>
311 <param name="output_matrix" value="True"/> 296 <param name="output_matrix" value="True"/>
312 <output name="matrixasoutput" file="12_combined_matrix.tabular"/> 297 <output name="matrixasoutput" file="12_combined_matrix.tabular"/>
313 <output name="msidata_combined" file="12_combined.RData" compare="sim_size" /> 298 <output name="msidata_combined" file="12_combined.RData" compare="sim_size" />
314 <output name="combining_qc" file="12_combined_QC.pdf" compare="sim_size" delta="20000"/> 299 <output name="combining_qc" file="12_combined_QC.pdf" compare="sim_size" delta="20000"/>
315 </test> 300 </test>
316 <test expect_num_outputs="3"> 301 <test expect_num_outputs="2">
317 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/> 302 <param name="infiles" value="msidata_1.RData,123_combined.RData" ftype="rdata"/>
318 <param name="combine_method" value="automatic_combine"/> 303 <param name="combine_method" value="automatic_combine"/>
319 <param name="x_distance" value="1"/> 304 <param name="output_matrix" value="False"/>
320 <param name="y_distance" value="1"/> 305 <output name="msidata_combined" file="112_auto_combined.RData" compare="sim_size" />
321 <param name="output_matrix" value="True"/> 306 <output name="combining_qc" file="112_auto_combined_QC.pdf" compare="sim_size" delta="20000"/>
322 <output name="matrixasoutput" file="12_auto_combined_matrix.tabular"/>
323 <output name="msidata_combined" file="12_auto_combined.RData" compare="sim_size" />
324 <output name="combining_qc" file="12_auto_combined_QC.pdf" compare="sim_size" delta="20000"/>
325 </test> 307 </test>
326 </tests> 308 </tests>
327 <help> 309 <help>
328 <![CDATA[ 310 <![CDATA[
329 311
330 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_ 312 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_
331 313
332 This tool uses the Cardinal combine function to combine several mass-spectrometry imaging data. 314 This tool uses the Cardinal combine function to combine several mass spectrometry imaging data.
333 315
334 Input data: 3 types of input data can be used: 316 Input data: 3 types of input data can be used:
335 317
336 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ 318 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
337 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) 319 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
341 323
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) 324 - 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 325
344 Options: 326 Options:
345 327
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 328 - "automatic combination": files are automatically arranged in a grid, 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 329 - "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".
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 330
349 - "check pixels before combination": no combination takes place but a pdf shows the current arrangement of the pixels
350 331
351 Output: 332 Output:
352 333
353 - imzML file containing multiple subfiles 334 - imzML file containing multiple subfiles
354 - pdf that shows the pixel positions of the combined files 335 - 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) 336 - optional: intensity matrix as tabular file (intensities for m/z in rows and pixel in columns)
356 337
357 338
358 ]]> 339 ]]>
359 </help> 340 </help>
360 <citations> 341 <citations>