comparison macros.xml @ 0:d3ca64dafdef draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit badc51fcd74ba0c14cd1ae64d5f524291fa11441"
author galaxyp
date Tue, 22 Feb 2022 20:52:51 +0000
parents
children 8ad8061e18c4
comparison
equal deleted inserted replaced
-1:000000000000 0:d3ca64dafdef
1 <macros>
2 <token name="@VERSION@">2.10.0</token>
3
4 <xml name="requirements">
5 <requirements>
6 <requirement type="package" version="@VERSION@">bioconductor-cardinal</requirement>
7 <!--requirement type="package" version="3.6.1">r-base</requirement-->
8 <yield/>
9 </requirements>
10 </xml>
11
12 <xml name="print_version">
13 <version_command><![CDATA[
14 echo $(R --version | grep version | grep -v GNU)", Cardinal version" $(R --vanilla --slave -e "library(Cardinal); cat(sessionInfo()\$otherPkgs\$Cardinal\$Version)" 2> /dev/null | grep -v -i "WARNING: ")
15 ]]></version_command>
16 </xml>
17
18 <token name="@INPUT_LINKING@"><![CDATA[
19 #if $infile.ext == 'imzml'
20 ln -s '${infile.extra_files_path}/imzml' infile.imzML &&
21 ln -s '${infile.extra_files_path}/ibd' infile.ibd &&
22 #elif $infile.ext == 'analyze75'
23 ln -s '${infile.extra_files_path}/hdr' infile.hdr &&
24 ln -s '${infile.extra_files_path}/img' infile.img &&
25 ln -s '${infile.extra_files_path}/t2m' infile.t2m &&
26 #else
27 ln -s $infile infile.RData &&
28 #end if
29 ]]></token>
30
31
32 <token name="@READING_MSIDATA@"><![CDATA[
33 ## importing MSI data files
34
35 ## read RData files (MSI and other data) independent of filename
36 loadRData <- function(fileName){
37 load(fileName)
38 get(ls()[ls() != "fileName"])
39 }
40
41 #if $infile.ext == 'imzml'
42 #if str($processed_cond.processed_file) == "processed":
43 msidata <- readImzML('infile', resolution=$processed_cond.accuracy, attach.only=TRUE, units = "$processed_cond.units")
44 msidata = collect(msidata, as.matrix=TRUE) ##coercion to continuous
45 centroided(msidata) = $centroids
46 #else
47 msidata <- readImzML('infile', attach.only=TRUE)
48 centroided(msidata) = $centroids
49 #end if
50 #elif $infile.ext == 'analyze75'
51 msidata = readAnalyze('infile', attach.only=TRUE)
52 centroided(msidata) = $centroids
53 #else
54 msidata = loadRData('infile.RData')
55 #end if
56
57 ]]></token>
58
59 <token name="@DATA_PROPERTIES@"><![CDATA[
60 ## Number of features (mz)
61 maxfeatures = length(features(msidata))
62 ## Range mz
63 minmz = round(min(mz(msidata)), digits=2)
64 maxmz = round(max(mz(msidata)), digits=2)
65 ## Number of spectra (pixels)
66 pixelcount = length(pixels(msidata))
67 ## Range x coordinates
68 minimumx = min(coord(msidata)[,1])
69 maximumx = max(coord(msidata)[,1])
70 ## Range y coordinates
71 minimumy = min(coord(msidata)[,2])
72 maximumy = max(coord(msidata)[,2])
73
74
75 properties = c("Number of m/z features",
76 "Range of m/z values",
77 "Number of pixels",
78 "Range of x coordinates",
79 "Range of y coordinates")
80
81 values = c(paste0(maxfeatures),
82 paste0(minmz, " - ", maxmz),
83 paste0(pixelcount),
84 paste0(minimumx, " - ", maximumx),
85 paste0(minimumy, " - ", maximumy))
86
87 property_df = data.frame(properties, values)
88 ]]></token>
89
90 <token name="@READING_MSIDATA_FULLY_COMPATIBLE@"><![CDATA[
91 ## importing MSI data files
92
93 #if $infile.ext == 'imzml'
94 #if str($processed_cond.processed_file) == "processed":
95 msidata <- readImzML('infile', resolution=$processed_cond.accuracy, units = "$processed_cond.units", attach.only=TRUE)
96 centroided(msidata) = $centroids
97 #else
98 msidata <- readImzML('infile', attach.only=TRUE)
99 centroided(msidata) = $centroids
100 #end if
101 #elif $infile.ext == 'analyze75'
102 msidata = readAnalyze('infile', attach.only=TRUE)
103 centroided(msidata) = $centroids
104 #else
105 ## function to read RData files independent of filename
106 loadRData <- function(fileName){
107 load(fileName)
108 get(ls()[ls() != "fileName"])
109 }
110 msidata = loadRData('infile.RData')
111 msidata = as(msidata, "MSImagingExperiment")
112 run(msidata) = "infile"
113 #end if
114
115 ]]></token>
116
117 <token name="@DATA_PROPERTIES_INRAM@"><![CDATA[
118 ########################### QC numbers ########################
119 ## including intensity calculations which need data in RAM
120
121 int_matrix = as.matrix(spectra(msidata)) ## only load once into RAM, then re-use
122 ## Number of NA in spectra matrix
123 NAcount = sum(is.na(int_matrix))
124 ## replace NA with zero to calculate data properties based on intensity matrix, no change in msidata
125 int_matrix[is.na(int_matrix)] <- 0
126
127 ## Number of features (mz)
128 maxfeatures = length(features(msidata))
129 ## Range mz
130 minmz = round(min(mz(msidata)), digits=2)
131 maxmz = round(max(mz(msidata)), digits=2)
132 ## Number of spectra (pixels)
133 pixelcount = length(pixels(msidata))
134 ## Range x coordinates
135 minimumx = min(coord(msidata)[,1])
136 maximumx = max(coord(msidata)[,1])
137 ## Range y coordinates
138 minimumy = min(coord(msidata)[,2])
139 maximumy = max(coord(msidata)[,2])
140 ## Range of intensities
141 minint = round(min(int_matrix), digits=2)
142 maxint = round(max(int_matrix), digits=2)
143 ## Number of intensities > 0, for if conditions
144 npeaks= sum(int_matrix>0)
145 ## Number of NA in spectra matrix
146 infcount = sum(is.infinite(int_matrix))
147 ## Number of duplicated coordinates
148 dupl_coord = sum(duplicated(coord(msidata)))
149 properties = c("Number of m/z features",
150 "Range of m/z values",
151 "Number of pixels",
152 "Range of x coordinates",
153 "Range of y coordinates",
154 "Range of intensities",
155 "Number of NA intensities",
156 "Number of Inf intensities",
157 "Number of duplicated coordinates")
158
159 values = c(paste0(maxfeatures),
160 paste0(minmz, " - ", maxmz),
161 paste0(pixelcount),
162 paste0(minimumx, " - ", maximumx),
163 paste0(minimumy, " - ", maximumy),
164 paste0(minint, " - ", maxint),
165 paste0(NAcount),
166 paste0(infcount),
167 paste0(dupl_coord))
168
169 property_df = data.frame(properties, values)
170 ]]></token>
171
172 <token name="@CARDINAL_DESCRIPTION@"><![CDATA[
173 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets.
174 `More information on Cardinal <http://cardinalmsi.org/>`_
175 ]]></token>
176 <token name="@MSIDATA_INPUT_DESCRIPTION@"><![CDATA[
177 **Input data**
178
179 - MSI data: 3 types of input data can be used:
180
181 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/imzml/>`_
182 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
183 - Cardinal "MSImageSet" or "MSImagingExperiment" saved as .RData
184 ]]></token>
185 <token name="@MZ_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
186 - Optional tabular file with m/z values:
187
188 - One column with numeric m/z values (without empty fields or letters)
189 - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
190 - m/z features outside the m/z range of the input file are ignored
191
192
193 ::
194
195 m/z
196 100.0
197 100.01
198 100.02
199 ...
200 ...
201
202 ]]></token>
203 <token name="@MZ_2COLS_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
204 - Tabular file with m/z values:
205
206 - One column with numeric m/z values (without empty fields or letters), another column with names for the m/z (m/z column can also be used as name)
207 - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
208 - m/z features outside the m/z range of the input file are ignored
209
210
211 ::
212
213 m/z name
214 100.0 analyte1
215 100.01 analyte2
216 100.02 analyte3
217 ...
218 ...
219
220 ]]></token>
221 <token name="@SPECTRA_TABULAR_INPUT_DESCRIPTION@"><![CDATA[
222 - Optional file with pixel coordinates and annotation:
223
224 - Tabular file: One column with x values, one column with y values and one column with annotations
225 - The file is allowed to have any column names as header (in this case set "Tabular file contains a header line" to yes)
226 - Pixel with coordinates outside the coordinates of the input file are ignored
227
228
229 ::
230
231 x_coord y_coord annotation
232 1 1 healthy
233 2 1 healthy
234 3 1 disease
235 ...
236 ...
237 ]]></token>
238
239 <xml name="reading_msidata">
240 <param name="infile" type="data" format="imzml,rdata,analyze75"
241 label="MSI data"
242 help="Input file as imzML (composite upload), Analyze7.5 (composite upload) or Cardinal MSImageSet saved as RData (regular upload)"/>
243 <param name="centroids" type="boolean" label="Centroided input" help="Choose Yes if peak detection has already been done." truevalue="TRUE" falsevalue="FALSE"/>
244 <conditional name="processed_cond">
245 <param name="processed_file" type="select" label="Processed imzML file" help="Choose no if your input is an Analyze7.5 or continuous imzML file">
246 <option value="no_processed" selected="True">no</option>
247 <option value="processed">yes</option>
248 </param>
249 <when value="no_processed"/>
250 <when value="processed">
251 <param name="accuracy" type="float" value="50" label="Mass accuracy to which the m/z values will be binned"/>
252 <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm">
253 <option value="mz" >mz</option>
254 <option value="ppm" selected="True" >ppm</option>
255 </param>
256 </when>
257 </conditional>
258 </xml>
259
260 <xml name="pdf_filename">
261 <param name="filename" type="text" value="" label="Title" help="Will appear in the pdf output, if nothing given it will take the dataset name">
262 <sanitizer invalid_char="">
263 <valid initial="string.ascii_letters,string.digits">
264 <add value="_"/>
265 <add value=" "/>
266 </valid>
267 </sanitizer>
268 </param>
269 </xml>
270
271 <xml name="sanitizer_multiple_digits">
272 <sanitizer invalid_char="">
273 <valid initial="string.digits">
274 <add value=":" />
275 <add value="," />
276 </valid>
277 </sanitizer>
278 </xml>
279
280 <xml name="reading_1_column_mz_tabular" token_label="Tabular file with m/z features">
281 <param name="mz_tabular" type="data" format="tabular" label="@LABEL@" help="Only numeric m/z values are allowed"/>
282 <param name="feature_column" data_ref="mz_tabular" label="Column with features" type="data_column"/>
283 <param name="feature_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
284 </xml>
285
286 <xml name="reading_2_column_mz_tabular" token_optional="false">
287 <param name="calibrant_file" type="data" optional="@OPTIONAL@" format="tabular"
288 label="m/z of interest (e.g. internal Calibrants)" help="one column with m/z values, optional second column with names (m/z values can also be selected as name)"/>
289 <param name="mz_column" data_ref="calibrant_file" optional="@OPTIONAL@" label="Column with m/z values" type="data_column"/>
290 <param name="name_column" data_ref="calibrant_file" optional="@OPTIONAL@" label="Column with name of m/z values" type="data_column"/>
291 <param name="calibrant_header" type="boolean" optional="@OPTIONAL@" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
292 </xml>
293
294 <xml name="reading_pixel_annotations">
295 <param name="annotation_file" type="data" format="tabular" label="Tabular file with pixel coordinates and annotation"
296 help="Tabular file with three columns: x values, y values and pixel annotations"/>
297 <param name="column_x" data_ref="annotation_file" label="Column with x values" type="data_column"/>
298 <param name="column_y" data_ref="annotation_file" label="Column with y values" type="data_column"/>
299 <param name="column_names" data_ref="annotation_file" label="Column with pixel annotations" type="data_column"/>
300 <param name="tabular_header" type="boolean" label="Tabular file contains a header line" truevalue="TRUE" falsevalue="FALSE"/>
301 </xml>
302
303 <xml name="citations">
304 <citations>
305 <citation type="doi">10.1093/bioinformatics/btv146</citation>
306 <citation type="doi">10.1093/gigascience/giz143</citation>
307 </citations>
308 </xml>
309 <xml name="infile_analyze75">
310 <param name="infile" value="" ftype="analyze75">
311 <composite_data value="Analyze75.hdr"/>
312 <composite_data value="Analyze75.img"/>
313 <composite_data value="Analyze75.t2m"/>
314 </param>
315 </xml>
316 <xml name="infile_imzml">
317 <param name="infile" value="" ftype="imzml">
318 <composite_data value="Example_Continuous.imzML"/>
319 <composite_data value="Example_Continuous.ibd"/>
320 </param>
321 </xml>
322 <xml name="processed_infile_imzml">
323 <param name="infile" value="" ftype="imzml">
324 <composite_data value="Example_Processed.imzML"/>
325 <composite_data value="Example_Processed.ibd"/>
326 </param>
327 </xml>
328 </macros>