Mercurial > repos > galaxyp > msi_filtering
comparison msi_filtering.xml @ 6:bab12ded74a5 draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_filtering commit 5bceedc3a11c950790692a4c64bbb83d46897bee
author | galaxyp |
---|---|
date | Tue, 24 Jul 2018 04:52:54 -0400 |
parents | 3d5ac78fb2b0 |
children | 73b5a754f35c |
comparison
equal
deleted
inserted
replaced
5:3d5ac78fb2b0 | 6:bab12ded74a5 |
---|---|
1 <tool id="mass_spectrometry_imaging_filtering" name="MSI filtering" version="1.10.0.3"> | 1 <tool id="mass_spectrometry_imaging_filtering" name="MSI filtering" version="1.10.0.4"> |
2 <description>tool for filtering mass spectrometry imaging data</description> | 2 <description>tool for filtering mass spectrometry imaging data</description> |
3 <requirements> | 3 <requirements> |
4 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement> | 4 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement> |
5 <requirement type="package" version="2.2.1">r-gridextra</requirement> | 5 <requirement type="package" version="2.2.1">r-gridextra</requirement> |
6 <requirement type="package" version="2.2.1">r-ggplot2</requirement> | |
6 </requirements> | 7 </requirements> |
7 <command detect_errors="exit_code"> | 8 <command detect_errors="exit_code"> |
8 <![CDATA[ | 9 <![CDATA[ |
9 | 10 |
10 #if $infile.ext == 'imzml' | 11 #if $infile.ext == 'imzml' |
30 ################################# load libraries and read file ################# | 31 ################################# load libraries and read file ################# |
31 | 32 |
32 | 33 |
33 library(Cardinal) | 34 library(Cardinal) |
34 library(gridExtra) | 35 library(gridExtra) |
36 library(ggplot2) | |
35 | 37 |
36 | 38 |
37 #if $infile.ext == 'imzml' | 39 #if $infile.ext == 'imzml' |
38 #if str($processed_cond.processed_file) == "processed": | 40 #if str($processed_cond.processed_file) == "processed": |
39 msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units") | 41 msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units") |
45 #else | 47 #else |
46 load('infile.RData') | 48 load('infile.RData') |
47 #end if | 49 #end if |
48 | 50 |
49 | 51 |
50 ########################### optional QC numbers ######################## | 52 ########################### QC numbers ######################## |
51 | |
52 if (sum(spectra(msidata)[]>0, na.rm=TRUE) > 0) | |
53 { | |
54 #if $outputs.outputs_select == "quality_control": | |
55 | 53 |
56 ## Number of features (m/z) | 54 ## Number of features (m/z) |
57 maxfeatures = length(features(msidata)) | 55 maxfeatures = length(features(msidata)) |
58 ## Range m/z | 56 ## Range m/z |
59 minmz = round(min(mz(msidata)), digits=2) | 57 minmz = round(min(mz(msidata)), digits=2) |
78 ## median TIC | 76 ## median TIC |
79 medint = round(median(TICs), digits=2) | 77 medint = round(median(TICs), digits=2) |
80 ## Store features for QC plot | 78 ## Store features for QC plot |
81 featuresinfile = mz(msidata) | 79 featuresinfile = mz(msidata) |
82 | 80 |
83 #end if | 81 ## Next steps will only run if there are more than 0 intensities/pixels/features in the file |
82 | |
83 if (sum(spectra(msidata)[]>0, na.rm=TRUE) > 0) | |
84 { | |
85 | |
86 | |
87 ## prepare dataframe for QC of pixel distribution (will be overwritten in filtering of pixels condition) | |
88 position_df = cbind(coord(msidata)[,1:2], rep("$infile.element_identifier", times=ncol(msidata))) | |
89 | |
84 | 90 |
85 ###################################### Filtering of pixels ##################### | 91 ###################################### Filtering of pixels ##################### |
86 ################################################################################ | 92 ################################################################################ |
87 | 93 |
88 #################### Pixels in the one column format "x=,y=" ##################### | 94 #################### Pixels in the one column format "x=,y=" ##################### |
89 | 95 |
90 #if str($pixels_cond.pixel_filtering) == "single_column": | 96 #if str($pixels_cond.pixel_filtering) == "single_column": |
91 print("single column") | 97 print("single column") |
92 | 98 |
99 ## read tabular file, count number of rows (= number of pixels), count how many pixels are valid | |
93 input_list = read.delim("$pixels_cond.single_pixels", header = FALSE, stringsAsFactors = FALSE) | 100 input_list = read.delim("$pixels_cond.single_pixels", header = FALSE, stringsAsFactors = FALSE) |
94 numberpixels = length(input_list[,$pixels_cond.pixel_column]) | 101 startingrow = $pixels_cond.pixel_header+1 |
95 valid_entries = input_list[,$pixels_cond.pixel_column] %in% names(pixels(msidata)) | 102 numberpixels = length(startingrow:nrow(input_list)) |
103 valid_entries = input_list[startingrow:nrow(input_list),$pixels_cond.pixel_column] %in% names(pixels(msidata)) | |
96 validpixels = sum(valid_entries) | 104 validpixels = sum(valid_entries) |
97 | 105 valid_annotations = input_list[valid_entries,c($pixels_cond.pixel_column, $pixels_cond.annotation_column)] |
106 | |
107 ## for valid pixels: filter file for pixels and create dataframe with x,y,annotation for QC | |
98 if (validpixels != 0){ | 108 if (validpixels != 0){ |
99 pixelsofinterest = pixels(msidata)[names(pixels(msidata)) %in% input_list[valid_entries,$pixels_cond.pixel_column]] | 109 ## filter file for pixels |
110 pixelsofinterest = pixels(msidata)[names(pixels(msidata)) %in% valid_annotations[,1]] | |
100 msidata = msidata[,pixelsofinterest] | 111 msidata = msidata[,pixelsofinterest] |
112 ## position_df for QC | |
113 pixel_coords = coord(msidata)[names(pixels(msidata)) %in% valid_annotations[,1],1:2] | |
114 position_df = cbind(pixel_coords, valid_annotations[,2]) | |
101 }else{ | 115 }else{ |
102 msidata = msidata[,0] | 116 msidata = msidata[,0] |
103 validpixels=0} | 117 validpixels=0} |
104 | 118 |
105 ############ Pixels in two columns format: x and y in different columns ############# | 119 ############ Pixels in two columns format: x and y in different columns ############# |
106 | 120 |
107 #elif str($pixels_cond.pixel_filtering) == "two_columns": | 121 #elif str($pixels_cond.pixel_filtering) == "two_columns": |
108 print("two columns") | 122 print("two columns") |
109 | 123 |
124 ## read tabular file, count number of rows (= number of pixels), extract dataframe with x,y,annotation (for QC), count number of valid pixels | |
110 input_list = read.delim("$pixels_cond.two_columns_pixel", header = FALSE, | 125 input_list = read.delim("$pixels_cond.two_columns_pixel", header = FALSE, |
111 stringsAsFactors = FALSE) | 126 stringsAsFactors = FALSE) |
112 numberpixels = length(input_list[,$pixels_cond.pixel_column_x]) | 127 startingrow = $pixels_cond.pixel_header+1 |
113 | 128 numberpixels = length(startingrow:nrow(input_list)) |
114 inputpixel_x = input_list[,$pixels_cond.pixel_column_x] | 129 inputpixels = input_list[startingrow:nrow(input_list),c($pixels_cond.pixel_column_x, $pixels_cond.pixel_column_y, $pixels_cond.annotation_column_xy)] |
115 inputpixel_y = input_list[,$pixels_cond.pixel_column_y] | 130 colnames(inputpixels) = c("x", "y", "annotation") |
116 inputpixels = cbind(inputpixel_x, inputpixel_y) | 131 position_df = merge(coord(msidata)[,1:2], inputpixels, by=c("x", "y"), all.x=TRUE) |
117 colnames(inputpixels) = c("x", "y") | 132 |
118 valid_rows = merge(inputpixels, coord(msidata)[,1:2]) | 133 validpixels = nrow(position_df) |
119 validpixels = nrow(valid_rows) | 134 |
120 | 135 ## for valid pixels: filter file for pixels |
121 if (validpixels != 0){ | 136 if (validpixels != 0){ |
122 pixelvector = character() | 137 pixelvector = character() |
123 for (pixel in 1:nrow(valid_rows)){ | 138 for (pixel in 1:nrow(position_df)){ |
124 pixelvector[pixel] = paste0("x = ", valid_rows[pixel,1],", ", "y = ", valid_rows[pixel,2])} | 139 pixelvector[pixel] = paste0("x = ", position_df[pixel,1],", ", "y = ", position_df[pixel,2])} |
125 pixelsofinterest= pixels(msidata)[names(pixels(msidata)) %in% pixelvector] | 140 pixelsofinterest= pixels(msidata)[names(pixels(msidata)) %in% pixelvector] |
126 msidata = msidata[,pixelsofinterest] | 141 msidata = msidata[,pixelsofinterest] |
127 }else{ | 142 }else{ |
128 validpixels=0} | 143 validpixels=0} |
129 | 144 |
133 print("pixel range") | 148 print("pixel range") |
134 | 149 |
135 numberpixels = "range" | 150 numberpixels = "range" |
136 validpixels = "range" | 151 validpixels = "range" |
137 | 152 |
138 ## only filter pixels if at least one pixel will be left | 153 ## only filter pixels if at least one pixel will be left |
139 | |
140 if (sum(coord(msidata)\$x <= $pixels_cond.max_x_range & coord(msidata)\$x >= $pixels_cond.min_x_range) > 0 & sum(coord(msidata)\$y <= $pixels_cond.max_y_range & coord(msidata)\$y >= $pixels_cond.min_y_range) > 0){ | 154 if (sum(coord(msidata)\$x <= $pixels_cond.max_x_range & coord(msidata)\$x >= $pixels_cond.min_x_range) > 0 & sum(coord(msidata)\$y <= $pixels_cond.max_y_range & coord(msidata)\$y >= $pixels_cond.min_y_range) > 0){ |
141 | 155 |
142 msidata = msidata[, coord(msidata)\$x <= $pixels_cond.max_x_range & coord(msidata)\$x >= $pixels_cond.min_x_range] | 156 msidata = msidata[, coord(msidata)\$x <= $pixels_cond.max_x_range & coord(msidata)\$x >= $pixels_cond.min_x_range] |
143 msidata = msidata[, coord(msidata)\$y <= $pixels_cond.max_y_range & coord(msidata)\$y >= $pixels_cond.min_y_range] | 157 msidata = msidata[, coord(msidata)\$y <= $pixels_cond.max_y_range & coord(msidata)\$y >= $pixels_cond.min_y_range] |
144 }else{ | 158 }else{ |
151 numberpixels = 0 | 165 numberpixels = 0 |
152 validpixels = 0 | 166 validpixels = 0 |
153 | 167 |
154 #end if | 168 #end if |
155 | 169 |
156 | |
157 }else{ | 170 }else{ |
158 print("Inputfile has no intensities > 0") | 171 print("Inputfile has no intensities > 0") |
159 | |
160 } | 172 } |
161 | 173 |
162 ###################################### filtering of features ###################### | 174 ################################# filtering of features ###################### |
163 ################################################################################## | 175 ############################################################################## |
164 | 176 |
165 ######################## Keep m/z from tabular file ######################### | 177 ####################### Keep m/z from tabular file ######################### |
166 | 178 |
167 if (sum(spectra(msidata)[], na.rm=TRUE) > 0){ | 179 ## feature filtering only when pixels/features/intensities are left |
180 if (sum(spectra(msidata)[], na.rm=TRUE) > 0) | |
181 { | |
168 | 182 |
169 #if str($features_cond.features_filtering) == "features_list": | 183 #if str($features_cond.features_filtering) == "features_list": |
170 print("feature list") | 184 print("feature list") |
171 | 185 |
186 ## read tabular file, define starting row, extract and count valid features | |
172 input_features = read.delim("$inputfeatures", header = FALSE, stringsAsFactors = FALSE) | 187 input_features = read.delim("$inputfeatures", header = FALSE, stringsAsFactors = FALSE) |
173 startingrow = $features_cond.feature_header+1 | 188 startingrow = $features_cond.feature_header+1 |
174 extracted_features = input_features[startingrow:nrow(input_features),$features_cond.feature_column] | 189 extracted_features = input_features[startingrow:nrow(input_features),$features_cond.feature_column] |
175 numberfeatures = length(extracted_features) | 190 numberfeatures = length(extracted_features) |
176 | 191 |
192 ## find out type of tabular file (numeric or character format) | |
177 if (grepl("m/z = ", input_features[startingrow,$features_cond.feature_column])==FALSE){ | 193 if (grepl("m/z = ", input_features[startingrow,$features_cond.feature_column])==FALSE){ |
178 | 194 |
179 ### if input is in numeric format | 195 ### if input is in numeric format |
180 if (class(extracted_features) == "numeric"){ | 196 if (class(extracted_features) == "numeric"){ |
181 ### max digits given in the input file will be used to match m/z | 197 ### max digits given in the input file will be used to match m/z but the maximum is 4 |
182 max_digits = max(nchar(matrix(unlist(strsplit(as.character(extracted_features), "\\.")), ncol=2, byrow=TRUE)[,2])) | 198 max_digits = max(nchar(matrix(unlist(strsplit(as.character(extracted_features), "\\.")), ncol=2, byrow=TRUE)[,2])) |
183 validfeatures = extracted_features %in% round(mz(msidata),max_digits) | 199 if (max_digits >4) |
184 featuresofinterest = features(msidata)[round(mz(msidata), digits = max_digits) %in% extracted_features[validfeatures]] | 200 { |
201 max_digits = 4 | |
202 } | |
203 | |
204 validfeatures = round(extracted_features, max_digits) %in% round(mz(msidata),max_digits) | |
205 featuresofinterest = features(msidata)[round(mz(msidata), digits = max_digits) %in% round(extracted_features[validfeatures], max_digits)] | |
185 validmz = length(unique(featuresofinterest)) | 206 validmz = length(unique(featuresofinterest)) |
186 }else{ | 207 }else{ |
187 validmz = 0 | 208 validmz = 0 |
188 featuresofinterest = 0} | 209 featuresofinterest = 0} |
189 | 210 |
196 | 217 |
197 ### filter msidata for valid features | 218 ### filter msidata for valid features |
198 | 219 |
199 msidata = msidata[featuresofinterest,] | 220 msidata = msidata[featuresofinterest,] |
200 | 221 |
201 ############### features within a given range are kept ######################### | 222 ############### features within a given range are kept ##################### |
202 | 223 |
203 #elif str($features_cond.features_filtering) == "features_range": | 224 #elif str($features_cond.features_filtering) == "features_range": |
204 print("feature range") | 225 print("feature range") |
205 | 226 |
206 numberfeatures = "range" | 227 numberfeatures = "range" |
268 #end if | 289 #end if |
269 | 290 |
270 ## save msidata as Rfile | 291 ## save msidata as Rfile |
271 save(msidata, file="$msidata_filtered") | 292 save(msidata, file="$msidata_filtered") |
272 | 293 |
273 #################### optional QC numbers ####################### | 294 }else{ |
274 | 295 print("Inputfile or file filtered for pixels has no intensities > 0") |
275 #if $outputs.outputs_select == "quality_control": | 296 numberfeatures = NA |
297 validmz = NA | |
298 } | |
299 | |
300 #################### QC numbers ####################### | |
301 | |
276 | 302 |
277 ## Number of features (m/z) | 303 ## Number of features (m/z) |
278 maxfeatures2 = length(features(msidata)) | 304 maxfeatures2 = length(features(msidata)) |
279 ## Range m/z | 305 ## Range m/z |
280 minmz2 = round(min(mz(msidata)), digits=2) | 306 minmz2 = round(min(mz(msidata)), digits=2) |
332 paste0("valid pixels: ", validpixels), | 358 paste0("valid pixels: ", validpixels), |
333 paste0("valid mz: ", validmz)) | 359 paste0("valid mz: ", validmz)) |
334 | 360 |
335 property_df = data.frame(properties, before, filtered) | 361 property_df = data.frame(properties, before, filtered) |
336 | 362 |
337 ############################### optional PDF QC ################################ | 363 ############################### PDF QC ################################ |
364 | |
338 | 365 |
339 pdf("filtertool_QC.pdf", fonts = "Times", pointsize = 12) | 366 pdf("filtertool_QC.pdf", fonts = "Times", pointsize = 12) |
340 plot(0,type='n',axes=FALSE,ann=FALSE) | 367 plot(0,type='n',axes=FALSE,ann=FALSE) |
341 title(main=paste0("Qualitycontrol of filtering tool for file: \n\n", "$infile.display_name")) | 368 title(main=paste0("Qualitycontrol of filtering tool for file: \n\n", "$infile.display_name")) |
342 grid.table(property_df, rows= NULL) | 369 grid.table(property_df, rows= NULL) |
343 | 370 |
344 ### heatmap image as visual pixel control | 371 ## QC report with more than value-table: only when pixels/features/intensities are left |
345 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){ | 372 if (sum(spectra(msidata)[], na.rm=TRUE) > 0) |
346 image(msidata, mz=$outputs.inputmz, plusminus = $outputs.plusminus_dalton, contrast.enhance = "none", | 373 { |
347 main= paste0($outputs.inputmz," ± ", $outputs.plusminus_dalton, " Da"), ylim = c(maximumy2+0.2*maximumy2,minimumy2-0.2*minimumy2)) | 374 ### visual pixel control |
375 | |
376 colnames(position_df)[3] = "annotation_name" | |
377 pixel_image = ggplot(position_df, aes(x=x, y=y, fill=annotation_name))+ | |
378 geom_tile() + | |
379 coord_fixed()+ | |
380 ggtitle("Spatial orientation of combined data")+ | |
381 theme_bw()+ | |
382 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | |
383 theme(legend.position="bottom",legend.direction="vertical")+ | |
384 guides(fill=guide_legend(ncol=4,byrow=TRUE)) | |
385 coord_labels = aggregate(cbind(x,y)~annotation_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass") | |
386 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$annotation_name) | |
387 | |
388 print(pixel_image) | |
348 | 389 |
349 ### control features which are removed | 390 ### control features which are removed |
350 hist(mz(msidata), xlab="m/z", main="Kept m/z values") | 391 hist(mz(msidata), xlab="m/z", main="Kept m/z values") |
351 #if str($features_cond.features_filtering) == "none": | 392 #if str($features_cond.features_filtering) == "none": |
352 print("no difference histogram as no m/z filtering took place") | 393 print("no difference histogram as no m/z filtering took place") |
353 #else: | 394 #else: |
354 | 395 |
355 if (isTRUE(all.equal(featuresinfile, mz(msidata)))){ | 396 if (isTRUE(all.equal(featuresinfile, mz(msidata)))){ |
356 print("No difference in m/z values before and after filtering, no histogram drawn") | 397 print("No difference in m/z values before and after filtering, no histogram drawn") |
357 }else{ | 398 }else{ |
358 hist(setdiff(featuresinfile, mz(msidata)), xlab="m/z", main="Removed m/z values")} | 399 hist(setdiff(featuresinfile, mz(msidata)), xlab="m/z", main="Removed m/z values")} |
359 #end if | 400 #end if |
360 }else{ | |
361 print("file has no features or pixels left")} | |
362 | 401 |
363 dev.off() | 402 dev.off() |
364 | |
365 #end if | |
366 | 403 |
367 ############################### optional intensity matrix ###################### | 404 ############################### optional intensity matrix ###################### |
368 | 405 |
369 #if $output_matrix: | 406 #if $output_matrix: |
370 | 407 |
374 write.table(newmatrix, file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") | 411 write.table(newmatrix, file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") |
375 | 412 |
376 #end if | 413 #end if |
377 | 414 |
378 }else{ | 415 }else{ |
379 print("Inputfile or file filtered for pixels has no intensities > 0") | 416 print("Inputfile or filtered file has no intensities > 0") |
417 dev.off() | |
380 } | 418 } |
381 ]]></configfile> | 419 ]]></configfile> |
382 </configfiles> | 420 </configfiles> |
383 <inputs> | 421 <inputs> |
384 <param name="infile" type="data" format="imzml,rdata,analyze75" | 422 <param name="infile" type="data" format="imzml,rdata,analyze75" |
396 <option value="mz" >mz</option> | 434 <option value="mz" >mz</option> |
397 <option value="ppm" selected="True" >ppm</option> | 435 <option value="ppm" selected="True" >ppm</option> |
398 </param> | 436 </param> |
399 </when> | 437 </when> |
400 </conditional> | 438 </conditional> |
439 | |
401 <conditional name="pixels_cond"> | 440 <conditional name="pixels_cond"> |
402 <param name="pixel_filtering" type="select" label="Select pixel filtering option"> | 441 <param name="pixel_filtering" type="select" label="Select pixel filtering option"> |
403 <option value="none" selected="True">none</option> | 442 <option value="none" selected="True">none</option> |
404 <option value="single_column">tabular file with single column (x = 1, y = 1)</option> | 443 <option value="single_column">tabular file with single column (x = 1, y = 1)</option> |
405 <option value="two_columns">tabular file with separate columns for x and y values</option> | 444 <option value="two_columns">tabular file with separate columns for x and y values</option> |
408 <when value="none"/> | 447 <when value="none"/> |
409 <when value="single_column"> | 448 <when value="single_column"> |
410 <param name="single_pixels" type="data" format="tabular" label="Pixels in single column for filtering of MSI data" | 449 <param name="single_pixels" type="data" format="tabular" label="Pixels in single column for filtering of MSI data" |
411 help="tabular file with pixels of interest in the form x = 1, y = 1"/> | 450 help="tabular file with pixels of interest in the form x = 1, y = 1"/> |
412 <param name="pixel_column" data_ref="single_pixels" label="Column with pixels" type="data_column"/> | 451 <param name="pixel_column" data_ref="single_pixels" label="Column with pixels" type="data_column"/> |
452 <param name="annotation_column" data_ref="single_pixels" label="Column with annotations for each pixel" type="data_column"/> | |
453 <param name="pixel_header" label="Number of header lines to skip" value="0" type="integer"/> | |
413 </when> | 454 </when> |
414 <when value="two_columns"> | 455 <when value="two_columns"> |
415 <param name="two_columns_pixel" type="data" format="tabular" label="Pixels in two columns for filtering of MSI data" | 456 <param name="two_columns_pixel" type="data" format="tabular" label="Pixels in two columns for filtering of MSI data" |
416 help="tabular file with pixels of interest in two separate columns"/> | 457 help="tabular file with pixels of interest in two separate columns"/> |
417 <param name="pixel_column_x" data_ref="two_columns_pixel" label="Column with x values" type="data_column"/> | 458 <param name="pixel_column_x" data_ref="two_columns_pixel" label="Column with x values" type="data_column"/> |
418 <param name="pixel_column_y" data_ref="two_columns_pixel" label="Column with y values" type="data_column"/> | 459 <param name="pixel_column_y" data_ref="two_columns_pixel" label="Column with y values" type="data_column"/> |
460 <param name="annotation_column_xy" data_ref="two_columns_pixel" label="Column with annotations" type="data_column"/> | |
461 <param name="pixel_header" label="Number of header lines to skip" value="0" type="integer"/> | |
419 </when> | 462 </when> |
420 <when value="pixel_range"> | 463 <when value="pixel_range"> |
421 <param name="min_x_range" type="integer" value="0" label="Minimum value for x"/> | 464 <param name="min_x_range" type="integer" value="0" label="Minimum value for x"/> |
422 <param name="max_x_range" type="integer" value="100" label="Maximum value for x"/> | 465 <param name="max_x_range" type="integer" value="100" label="Maximum value for x"/> |
423 <param name="min_y_range" type="integer" value="0" label="Minimum value for y"/> | 466 <param name="min_y_range" type="integer" value="0" label="Minimum value for y"/> |
424 <param name="max_y_range" type="integer" value="100" label="Maximum value for y"/> | 467 <param name="max_y_range" type="integer" value="100" label="Maximum value for y"/> |
425 </when> | 468 </when> |
426 </conditional> | 469 </conditional> |
470 | |
427 <conditional name="features_cond"> | 471 <conditional name="features_cond"> |
428 <param name="features_filtering" type="select" label="Select feature filtering option"> | 472 <param name="features_filtering" type="select" label="Select feature filtering option"> |
429 <option value="none" selected="True">none</option> | 473 <option value="none" selected="True">none</option> |
430 <option value="features_list">keep features (tabular input)</option> | 474 <option value="features_list">keep features (tabular input)</option> |
431 <option value="features_range">keep features within a range (manual input)</option> | 475 <option value="features_range">keep features within a range (manual input)</option> |
448 <param name="removal_plusminus" type="float" value="20" label="Window in which m/z will be removed" help="This value will be added and substracted from the given input value"/> | 492 <param name="removal_plusminus" type="float" value="20" label="Window in which m/z will be removed" help="This value will be added and substracted from the given input value"/> |
449 <param name="units_removal" type="select" display = "radio" optional = "False" label="units"> | 493 <param name="units_removal" type="select" display = "radio" optional = "False" label="units"> |
450 <option value="ppm" selected="True">ppm</option> | 494 <option value="ppm" selected="True">ppm</option> |
451 <option value="Da">Da</option> | 495 <option value="Da">Da</option> |
452 </param> | 496 </param> |
453 </when> | 497 </when> |
454 </conditional> | 498 </conditional> |
455 <conditional name="outputs"> | |
456 <param name="outputs_select" type="select" label="Quality control output"> | |
457 <option value="quality_control" selected="True">yes</option> | |
458 <option value="no_quality_control">no</option> | |
459 </param> | |
460 <when value="quality_control"> | |
461 <param name="inputmz" type="float" value="1296.7" label="M/z for which a heatmap image will be drawn" help="Use a m/z which is still present in all pixels to control if the pixel filtering went well"/> | |
462 <param name="plusminus_dalton" value="0.25" type="float" label="Range for m/z value" help="plusminus m/z window"/> | |
463 </when> | |
464 <when value="no_quality_control"/> | |
465 </conditional> | |
466 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/> | 499 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/> |
467 </inputs> | 500 </inputs> |
501 | |
468 <outputs> | 502 <outputs> |
469 <data format="rdata" name="msidata_filtered" label="$infile.display_name filtered"/> | 503 <data format="rdata" name="msidata_filtered" label="$infile.display_name filtered"/> |
470 <data format="pdf" name="filtering_qc" from_work_dir="filtertool_QC.pdf" label = "$infile.display_name filtered_QC"> | 504 <data format="pdf" name="filtering_qc" from_work_dir="filtertool_QC.pdf" label = "$infile.display_name filtered_QC"/> |
471 <filter>outputs["outputs_select"] == "quality_control"</filter> | |
472 </data> | |
473 <data format="tabular" name="matrixasoutput" label="$infile.display_name filtered_matrix"> | 505 <data format="tabular" name="matrixasoutput" label="$infile.display_name filtered_matrix"> |
474 <filter>output_matrix</filter> | 506 <filter>output_matrix</filter> |
475 </data> | 507 </data> |
476 </outputs> | 508 </outputs> |
477 <tests> | 509 <tests> |
485 <param name="pixel_column" value="1"/> | 517 <param name="pixel_column" value="1"/> |
486 <param name="features_filtering" value="features_list"/> | 518 <param name="features_filtering" value="features_list"/> |
487 <param name="inputfeatures" ftype="tabular" value = "inputfeatures.tabular"/> | 519 <param name="inputfeatures" ftype="tabular" value = "inputfeatures.tabular"/> |
488 <param name="feature_column" value="2"/> | 520 <param name="feature_column" value="2"/> |
489 <param name="feature_header" value="1"/> | 521 <param name="feature_header" value="1"/> |
490 <param name="outputs_select" value="quality_control"/> | |
491 <param name="inputmz" value="328.9"/> | |
492 <param name="plusminus_dalton" value="0.25"/> | |
493 <output name="filtering_qc" file="imzml_filtered.pdf" compare="sim_size" delta="20000"/> | 522 <output name="filtering_qc" file="imzml_filtered.pdf" compare="sim_size" delta="20000"/> |
494 <output name="msidata_filtered" file="imzml_filtered.RData" compare="sim_size" /> | 523 <output name="msidata_filtered" file="imzml_filtered.RData" compare="sim_size" /> |
495 </test> | 524 </test> |
496 <test expect_num_outputs="2"> | 525 <test expect_num_outputs="2"> |
497 <param name="infile" value="" ftype="imzml"> | 526 <param name="infile" value="" ftype="imzml"> |
501 <param name="pixel_filtering" value="pixel_range"/> | 530 <param name="pixel_filtering" value="pixel_range"/> |
502 <param name="min_x_range" value="10"/> | 531 <param name="min_x_range" value="10"/> |
503 <param name="max_x_range" value="20"/> | 532 <param name="max_x_range" value="20"/> |
504 <param name="min_y_range" value="2"/> | 533 <param name="min_y_range" value="2"/> |
505 <param name="max_y_range" value="2"/> | 534 <param name="max_y_range" value="2"/> |
506 <param name="outputs_select" value="quality_control"/> | |
507 <param name="inputmz" value="328.9"/> | |
508 <param name="plusminus_dalton" value="0.25"/> | |
509 <output name="filtering_qc" file="imzml_filtered2.pdf" compare="sim_size" delta="20000"/> | 535 <output name="filtering_qc" file="imzml_filtered2.pdf" compare="sim_size" delta="20000"/> |
510 <output name="msidata_filtered" file="imzml_filtered2.RData" compare="sim_size" /> | 536 <output name="msidata_filtered" file="imzml_filtered2.RData" compare="sim_size" /> |
511 </test> | 537 </test> |
512 <test expect_num_outputs="3"> | 538 <test expect_num_outputs="3"> |
513 <param name="infile" value="" ftype="imzml"> | 539 <param name="infile" value="" ftype="imzml"> |
520 <param name="min_y_range" value="2"/> | 546 <param name="min_y_range" value="2"/> |
521 <param name="max_y_range" value="2"/> | 547 <param name="max_y_range" value="2"/> |
522 <param name="features_filtering" value="features_range"/> | 548 <param name="features_filtering" value="features_range"/> |
523 <param name="min_mz" value="350" /> | 549 <param name="min_mz" value="350" /> |
524 <param name="max_mz" value="500"/> | 550 <param name="max_mz" value="500"/> |
525 <param name="outputs_select" value="quality_control"/> | |
526 <param name="inputmz" value="328.9"/> | |
527 <param name="plusminus_dalton" value="0.25"/> | |
528 <param name="output_matrix" value="True"/> | 551 <param name="output_matrix" value="True"/> |
529 <output name="filtering_qc" file="imzml_filtered3.pdf" compare="sim_size" delta="20000"/> | 552 <output name="filtering_qc" file="imzml_filtered3.pdf" compare="sim_size" delta="20000"/> |
530 <output name="msidata_filtered" file="imzml_filtered3.RData" compare="sim_size" /> | 553 <output name="msidata_filtered" file="imzml_filtered3.RData" compare="sim_size" /> |
531 <output name="matrixasoutput" file="imzml_matrix3.tabular"/> | 554 <output name="matrixasoutput" file="imzml_matrix3.tabular"/> |
532 </test> | 555 </test> |
537 </param> | 560 </param> |
538 <param name="pixel_filtering" value="two_columns"/> | 561 <param name="pixel_filtering" value="two_columns"/> |
539 <param name="two_columns_pixel" ftype="tabular" value = "inputpixels_2column.tabular"/> | 562 <param name="two_columns_pixel" ftype="tabular" value = "inputpixels_2column.tabular"/> |
540 <param name="pixel_column_x" value="1"/> | 563 <param name="pixel_column_x" value="1"/> |
541 <param name="pixel_column_y" value="3"/> | 564 <param name="pixel_column_y" value="3"/> |
565 <param name="annotation_column_xy" value="2"/> | |
542 <param name="features_filtering" value="features_list"/> | 566 <param name="features_filtering" value="features_list"/> |
543 <param name="inputfeatures" ftype="tabular" value = "inputcalibrantfile2.txt"/> | 567 <param name="inputfeatures" ftype="tabular" value = "inputcalibrantfile2.txt"/> |
544 <param name="feature_column" value="1"/> | 568 <param name="feature_column" value="1"/> |
545 <param name="feature_header" value="0"/> | 569 <param name="feature_header" value="0"/> |
546 <param name="outputs_select" value="quality_control"/> | |
547 <param name="inputmz" value="328.9"/> | |
548 <param name="plusminus_dalton" value="0.25"/> | |
549 <output name="filtering_qc" file="imzml_filtered4.pdf" compare="sim_size" delta="20000"/> | 570 <output name="filtering_qc" file="imzml_filtered4.pdf" compare="sim_size" delta="20000"/> |
550 <output name="msidata_filtered" file="imzml_filtered4.RData" compare="sim_size" /> | 571 <output name="msidata_filtered" file="imzml_filtered4.RData" compare="sim_size" /> |
551 </test> | 572 </test> |
552 <test expect_num_outputs="2"> | 573 <test expect_num_outputs="2"> |
553 <param name="infile" value="" ftype="imzml"> | 574 <param name="infile" value="" ftype="imzml"> |
561 <param name="max_y_range" value="20"/> | 582 <param name="max_y_range" value="20"/> |
562 <param name="features_filtering" value="features_list"/> | 583 <param name="features_filtering" value="features_list"/> |
563 <param name="inputfeatures" ftype="tabular" value = "featuresofinterest5.tabular"/> | 584 <param name="inputfeatures" ftype="tabular" value = "featuresofinterest5.tabular"/> |
564 <param name="feature_column" value="1"/> | 585 <param name="feature_column" value="1"/> |
565 <param name="feature_header" value="0"/> | 586 <param name="feature_header" value="0"/> |
566 <param name="outputs_select" value="quality_control"/> | |
567 <param name="inputmz" value="328.9"/> | |
568 <param name="plusminus_dalton" value="0.25"/> | |
569 <output name="filtering_qc" file="imzml_filtered5.pdf" compare="sim_size" delta="20000"/> | 587 <output name="filtering_qc" file="imzml_filtered5.pdf" compare="sim_size" delta="20000"/> |
570 <output name="msidata_filtered" file="imzml_filtered5.RData" compare="sim_size" /> | 588 <output name="msidata_filtered" file="imzml_filtered5.RData" compare="sim_size" /> |
571 </test> | 589 </test> |
572 <test expect_num_outputs="3"> | 590 <test expect_num_outputs="3"> |
573 <param name="infile" value="" ftype="analyze75"> | 591 <param name="infile" value="" ftype="analyze75"> |
579 <param name="single_pixels" ftype="tabular" value = "inputpixels2.tabular"/> | 597 <param name="single_pixels" ftype="tabular" value = "inputpixels2.tabular"/> |
580 <param name="pixel_column" value="1"/> | 598 <param name="pixel_column" value="1"/> |
581 <param name="features_filtering" value="features_list"/> | 599 <param name="features_filtering" value="features_list"/> |
582 <param name="inputfeatures" ftype="tabular" value = "featuresofinterest2.tabular"/> | 600 <param name="inputfeatures" ftype="tabular" value = "featuresofinterest2.tabular"/> |
583 <param name="feature_column" value="1"/> | 601 <param name="feature_column" value="1"/> |
584 <conditional name="outputs"> | |
585 <param name="outputs_select" value="quality_control"/> | |
586 <param name="inputmz" value="1200"/> | |
587 <param name="plusminus_dalton" value="0.25"/> | |
588 </conditional> | |
589 <param name="output_matrix" value="True"/> | 602 <param name="output_matrix" value="True"/> |
590 <output name="filtering_qc" file="analyze_filtered.pdf" compare="sim_size" delta="20000"/> | 603 <output name="filtering_qc" file="analyze_filtered.pdf" compare="sim_size" delta="20000"/> |
591 <output name="msidata_filtered" file="analyze_filtered.RData" compare="sim_size" /> | 604 <output name="msidata_filtered" file="analyze_filtered.RData" compare="sim_size" /> |
592 <output name="matrixasoutput" file="analyze_matrix.tabular"/> | 605 <output name="matrixasoutput" file="analyze_matrix.tabular"/> |
593 </test> | 606 </test> |
595 <param name="infile" value="" ftype="analyze75"> | 608 <param name="infile" value="" ftype="analyze75"> |
596 <composite_data value="Analyze75.hdr"/> | 609 <composite_data value="Analyze75.hdr"/> |
597 <composite_data value="Analyze75.img"/> | 610 <composite_data value="Analyze75.img"/> |
598 <composite_data value="Analyze75.t2m"/> | 611 <composite_data value="Analyze75.t2m"/> |
599 </param> | 612 </param> |
600 <conditional name="outputs"> | |
601 <param name="outputs_select" value="quality_control"/> | |
602 <param name="inputmz" value="1200"/> | |
603 <param name="plusminus_dalton" value="0.25"/> | |
604 </conditional> | |
605 <output name="filtering_qc" file="analyze75_filtered2.pdf" compare="sim_size" delta="20000"/> | 613 <output name="filtering_qc" file="analyze75_filtered2.pdf" compare="sim_size" delta="20000"/> |
606 <output name="msidata_filtered" file="analyze_filteredoutside.RData" compare="sim_size" /> | 614 <output name="msidata_filtered" file="analyze_filteredoutside.RData" compare="sim_size" /> |
607 </test> | 615 </test> |
608 <test expect_num_outputs="2"> | 616 <test expect_num_outputs="3"> |
609 <param name="infile" value="preprocessed.RData" ftype="rdata"/> | 617 <param name="infile" value="preprocessed.RData" ftype="rdata"/> |
610 <conditional name="outputs"> | 618 <conditional name="outputs"> |
611 <param name="outputs_select" value="no_quality_control"/> | 619 <param name="outputs_select" value="no_quality_control"/> |
612 </conditional> | 620 </conditional> |
613 <param name="output_matrix" value="True"/> | 621 <param name="output_matrix" value="True"/> |
614 <output name="matrixasoutput" file="rdata_matrix.tabular"/> | 622 <output name="matrixasoutput" file="rdata_matrix.tabular"/> |
615 <output name="msidata_filtered" file="rdata_notfiltered.RData" compare="sim_size" /> | 623 <output name="msidata_filtered" file="rdata_notfiltered.RData" compare="sim_size" /> |
624 <output name="filtering_qc" file="rdata_notfiltered.pdf" compare="sim_size" /> | |
616 </test> | 625 </test> |
617 </tests> | 626 </tests> |
618 <help> | 627 <help> |
619 <![CDATA[ | 628 <![CDATA[ |
620 | 629 |
629 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) | 638 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) |
630 | 639 |
631 | 640 |
632 Options: | 641 Options: |
633 | 642 |
634 - pixel filtering: can use a tabular file containing x and y coordinates or by defining a range for x and y by hand | 643 - pixel filtering/annotation: either with a tabular file containing x and y coordinates and pixel annotations or by defining a range for x and y by hand (for the latter no annotation is possible) |
635 - m/z feature filtering: can use a tabular file containing m/z of interest or by defining a range for the m/z values (! numeric input will be rounded to 2 digits before matching to m/z!) | 644 - m/z feature filtering: can use a tabular file containing m/z of interest or by defining a range for the m/z values (! numeric input will be rounded to 2 digits before matching to m/z!) |
636 - m/z feature removing: infering m/z such as matrix contaminants can be removed by specifying their m/z in a tabular file and optionally set a window (window in ppm or m/z in which peaks should be removed) | 645 - m/z feature removing: perturbing m/z such as matrix contaminants can be removed by specifying their m/z in a tabular file and optionally set a window (window in ppm or m/z in which peaks should be removed) |
637 | 646 |
638 | 647 |
639 Output: | 648 Output: |
640 | 649 |
641 - imzML file filtered for pixels and/or m/z | 650 - imzML file filtered for pixels and/or m/z |