Mercurial > repos > galaxyp > mass_spectrometry_imaging_segmentations
comparison segmentation_tool.xml @ 2:f66c5789deac draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_segmentation commit ed7d3e6f1a09c78c8f71cc1bdc1a20249767f646
author | galaxyp |
---|---|
date | Sun, 11 Mar 2018 10:39:01 -0400 |
parents | d4158c9955ea |
children | 830c6df59603 |
comparison
equal
deleted
inserted
replaced
1:d4158c9955ea | 2:f66c5789deac |
---|---|
1 <tool id="mass_spectrometry_imaging_segmentations" name="MSI segmentation" version="1.7.0.1"> | 1 <tool id="mass_spectrometry_imaging_segmentations" name="MSI segmentation" version="1.7.0.2"> |
2 <description>tool for spatial clustering</description> | 2 <description>tool for spatial clustering</description> |
3 <requirements> | 3 <requirements> |
4 <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement> | 4 <requirement type="package" version="1.7.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.23-15">r-kernsmooth</requirement> | 6 <requirement type="package" version="2.23-15">r-kernsmooth</requirement> |
178 for (numberofcomponents in 1:$segm_cond.pca_ncomp) | 178 for (numberofcomponents in 1:$segm_cond.pca_ncomp) |
179 {component_vector[numberofcomponents]= paste0("PC", numberofcomponents)} | 179 {component_vector[numberofcomponents]= paste0("PC", numberofcomponents)} |
180 pca = PCA(msidata, ncomp=$segm_cond.pca_ncomp, column = component_vector, superpose = FALSE, | 180 pca = PCA(msidata, ncomp=$segm_cond.pca_ncomp, column = component_vector, superpose = FALSE, |
181 method = "$segm_cond.pca_method", scale = $segm_cond.pca_scale, layout = c(ncomp, 1)) | 181 method = "$segm_cond.pca_method", scale = $segm_cond.pca_scale, layout = c(ncomp, 1)) |
182 | 182 |
183 print(image(pca, main="PCA image", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), contrast.enhance = "$segm_cond.pca_imagecontrast", smooth.image = "$segm_cond.pca_imagesmoothing", col=colourvector, ylim=c(maximumy+2, 0))) | 183 print(image(pca, main="PCA image", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), col=colourvector, ylim=c(maximumy+2, 0))) |
184 print(plot(pca, main="PCA plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)))) | 184 print(plot(pca, main="PCA plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)))) |
185 | 185 |
186 | 186 |
187 pcaloadings = (pca@resultData\$ncomp\$loadings) ### loading for each mz value | 187 pcaloadings = (pca@resultData\$ncomp\$loadings) ### loading for each mz value |
188 pcascores = (pca@resultData\$ncomp\$scores) ### scores for each pixel | 188 pcascores = (pca@resultData\$ncomp\$scores) ### scores for each pixel |
192 | 192 |
193 #elif str( $segm_cond.segmentationtool ) == 'kmeans': | 193 #elif str( $segm_cond.segmentationtool ) == 'kmeans': |
194 print('kmeans') | 194 print('kmeans') |
195 ##k-means | 195 ##k-means |
196 | 196 |
197 skm = spatialKMeans(msidata, r=$segm_cond.kmeans_r, k=$segm_cond.kmeans_k, method="$segm_cond.kmeans_method") | 197 skm = spatialKMeans(msidata, r=c($segm_cond.kmeans_r), k=c($segm_cond.kmeans_k), method="$segm_cond.kmeans_method") |
198 print(image(skm, key=TRUE, main="K-means clustering", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), contrast.enhance = "$segm_cond.kmeans_imagecontrast", col= colourvector, smooth.image = "$segm_cond.kmeans_imagesmoothing", ylim=c(maximumy+2, 0))) | 198 print(image(skm, key=TRUE, main="K-means clustering", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), col= colourvector, ylim=c(maximumy+2, 0), layout=c(1,1))) |
199 print(plot(skm, main="K-means plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)))) | 199 |
200 | 200 print(plot(skm, main="K-means plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), layout=c($segm_cond.kmeans_layout))) |
201 | 201 |
202 skm_clusters = (skm@resultData\$r\$cluster) | 202 |
203 skm_toplabels = topLabels(skm, n=500) | 203 skm_clusters = data.frame(matrix(NA, nrow = pixelcount, ncol = 0)) |
204 for (iteration in 1:length(skm@resultData)){ | |
205 skm_cluster = ((skm@resultData)[[iteration]]\$cluster) | |
206 skm_clusters = cbind(skm_clusters, skm_cluster) } | |
207 colnames(skm_clusters) = names((skm@resultData)) | |
208 | |
209 skm_toplabels = topLabels(skm, n=$segm_cond.kmeans_toplabels) | |
204 | 210 |
205 write.table(skm_toplabels, file="$mzfeatures", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") | 211 write.table(skm_toplabels, file="$mzfeatures", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") |
206 write.table(skm_clusters, file="$pixeloutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") | 212 write.table(skm_clusters, file="$pixeloutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") |
207 | 213 |
208 | 214 |
209 #elif str( $segm_cond.segmentationtool ) == 'centroids': | 215 #elif str( $segm_cond.segmentationtool ) == 'centroids': |
210 print('centroids') | 216 print('centroids') |
211 ##centroids | 217 ##centroids |
212 | 218 |
213 ssc = spatialShrunkenCentroids(msidata, r=$segm_cond.centroids_r, k=$segm_cond.centroids_k, s=$segm_cond.centroids_s, method="$segm_cond.centroids_method") | 219 ssc = spatialShrunkenCentroids(msidata, r=c($segm_cond.centroids_r), k=c($segm_cond.centroids_k), s=c($segm_cond.centroids_s), method="$segm_cond.centroids_method") |
214 print(image(ssc, key=TRUE, main="Spatial shrunken centroids", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), contrast.enhance = "$segm_cond.centroids_imagecontrast", col= colourvector, smooth.image = "$segm_cond.centroids_imagesmoothing", ylim=c(maximumy+2, 0))) | 220 print(image(ssc, key=TRUE, main="Spatial shrunken centroids", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), col= colourvector, ylim=c(maximumy+2, 0),layout=c(1,1))) |
215 print(plot(ssc, main="Spatial shrunken centroids plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)))) | 221 print(plot(ssc, main="Spatial shrunken centroids plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)),layout=c($segm_cond.centroids_layout))) |
216 | 222 |
217 ssc_classes = (ssc@resultData\$r\$classes) | 223 ssc_classes = data.frame(matrix(NA, nrow = pixelcount, ncol = 0)) |
218 ssc_toplabels = topLabels(ssc, n=500) | 224 for (iteration in 1:length(ssc@resultData)){ |
225 ssc_class = ((ssc@resultData)[[iteration]]\$classes) | |
226 ssc_classes = cbind(ssc_classes, ssc_class) } | |
227 colnames(ssc_classes) = names((ssc@resultData)) | |
228 | |
229 ssc_toplabels = topLabels(ssc, n=$segm_cond.centroids_toplabels) | |
219 | 230 |
220 write.table(ssc_toplabels, file="$mzfeatures", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") | 231 write.table(ssc_toplabels, file="$mzfeatures", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") |
221 write.table(ssc_classes, file="$pixeloutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") | 232 write.table(ssc_classes, file="$pixeloutput", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") |
222 | 233 |
223 | 234 |
253 <param name="pca_scale" type="select" display="radio" optional="False" | 264 <param name="pca_scale" type="select" display="radio" optional="False" |
254 label="Shoud the data be scaled first?"> | 265 label="Shoud the data be scaled first?"> |
255 <option value="TRUE">yes</option> | 266 <option value="TRUE">yes</option> |
256 <option value="FALSE" selected="True">no</option> | 267 <option value="FALSE" selected="True">no</option> |
257 </param> | 268 </param> |
258 <param name="pca_imagecontrast" type="select" label="Select a contrast enhancement function." help="The 'histogram' equalization method flatterns the distribution of intensities. The hotspot 'suppression' method uses thresholding to reduce the intensities of hotspots"> | |
259 <option value="none" selected="True">none</option> | |
260 <option value="suppression">suppression</option> | |
261 <option value="histogram">histogram</option> | |
262 </param> | |
263 <param name="pca_imagesmoothing" type="select" label="Select an image smoothing function." help="The 'gaussian' smoothing method smooths images with a simple gaussian kernel. The 'adaptive' method uses bilateral filtering to preserve edges."> | |
264 <option value="none" selected="True">none</option> | |
265 <option value="gaussian">gaussian</option> | |
266 <option value="adaptive">adaptive</option> | |
267 </param> | |
268 </when> | 269 </when> |
269 | 270 |
270 <when value="kmeans"> | 271 <when value="kmeans"> |
271 <param name="kmeans_r" type="text" value="2" | 272 <param name="kmeans_r" type="text" value="2" |
272 label="The spatial neighborhood radius of nearby pixels to consider (r)."/> | 273 label="The spatial neighborhood radius of nearby pixels to consider (r)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> |
273 <param name="kmeans_k" type="text" value="3" | 274 <param name="kmeans_k" type="text" value="3" |
274 label="The number of clusters (k)."/> | 275 label="The number of clusters (k)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> |
275 <param name="kmeans_method" type="select" display="radio" | 276 <param name="kmeans_method" type="select" display="radio" |
276 label="The method to use to calculate the spatial smoothing kernels for the embedding. The 'gaussian' method refers to spatially-aware (SA) clustering, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) clustering."> | 277 label="The method to use to calculate the spatial smoothing kernels for the embedding. The 'gaussian' method refers to spatially-aware (SA) clustering, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) clustering."> |
277 <option value="gaussian">gaussian</option> | 278 <option value="gaussian">gaussian</option> |
278 <option value="adaptive" selected="True">adaptive</option> | 279 <option value="adaptive" selected="True">adaptive</option> |
279 </param> | 280 </param> |
280 <param name="kmeans_imagecontrast" type="select" label="Select a contrast enhancement function." help="The 'histogram' equalization method flatterns the distribution of intensities. The hotspot 'suppression' method uses thresholding to reduce the intensities of hotspots"> | 281 <param name="kmeans_toplabels" type="integer" value="500" |
281 <option value="none" selected="True">none</option> | 282 label="Number of toplabels (masses) which should be written in tabular output"/> |
282 <option value="suppression">suppression</option> | 283 <param name="kmeans_layout" type="text" value="1,1" |
283 <option value="histogram">histogram</option> | 284 label="Number of rows and columns to plot pictures in pdf output" help="e.g. 1,1 means 1 plot per page; 2,3 means 2 rows with 3 plots each = 6 plots per page"/> |
284 </param> | 285 </when> |
285 <param name="kmeans_imagesmoothing" type="select" label="Select an image smoothing function." help="The 'gaussian' smoothing method smooths images with a simple gaussian kernel. The 'adaptive' method uses bilateral filtering to preserve edges."> | |
286 <option value="none" selected="True">none</option> | |
287 <option value="gaussian">gaussian</option> | |
288 <option value="adaptive">adaptive</option> | |
289 </param> | |
290 </when> | |
291 | 286 |
292 <when value="centroids"> | 287 <when value="centroids"> |
293 <param name="centroids_r" type="text" value="2" | 288 <param name="centroids_r" type="text" value="2" |
294 label="The spatial neighborhood radius of nearby pixels to consider (r)."/> | 289 label="The spatial neighborhood radius of nearby pixels to consider (r)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> |
295 <param name="centroids_k" type="text" value="5" | 290 <param name="centroids_k" type="text" value="5" |
296 label="The initial number of clusters (k)."/> | 291 label="The initial number of clusters (k)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> |
297 <param name="centroids_s" type="integer" value="2" | 292 <param name="centroids_s" type="text" value="2" |
298 label="The sparsity thresholding parameter by which to shrink the t-statistics (s)." | 293 label="The sparsity thresholding parameter by which to shrink the t-statistics (s)." |
299 help="As s increases, fewer mass features (m/z values) will be used in the spatial segmentation, and only the informative mass features will be retained."/> | 294 help="As s increases, fewer mass features (m/z values) will be used in the spatial segmentation, and only the informative mass features will be retained. Multiple values are allowed (e.g. 1,2,3 or 2:5)."/> |
300 <param name="centroids_method" type="select" display="radio" label = "The method to use to calculate the spatial smoothing kernels for the embedding. The 'gaussian' method refers to spatially-aware (SA) weights, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) weights."> | 295 <param name="centroids_method" type="select" display="radio" label = "The method to use to calculate the spatial smoothing kernels for the embedding. The 'gaussian' method refers to spatially-aware (SA) weights, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) weights."> |
301 <option value="gaussian" selected="True">gaussian</option> | 296 <option value="gaussian" selected="True">gaussian</option> |
302 <option value="adaptive">adaptive</option> | 297 <option value="adaptive">adaptive</option> |
303 </param> | 298 </param> |
304 <param name="centroids_imagecontrast" type="select" label="Select a contrast enhancement function." help="The 'histogram' equalization method flatterns the distribution of intensities. The hotspot 'suppression' method uses thresholding to reduce the intensities of hotspots"> | 299 <param name="centroids_toplabels" type="integer" value="500" |
305 <option value="none" selected="True">none</option> | 300 label="Number of toplabels (masses) which should be written in tabular output"/> |
306 <option value="suppression">suppression</option> | 301 <param name="centroids_layout" type="text" value="1,1" |
307 <option value="histogram">histogram</option> | 302 label="Number of rows and columns to plot pictures in pdf output" help="e.g. 1,1 means 1 plot per page; 2,3 means 2 rows with 3 plots each = 6 plots per page"/> |
308 </param> | |
309 <param name="centroids_imagesmoothing" type="select" label="Select an image smoothing function." help="The 'gaussian' smoothing method smooths images with a simple gaussian kernel. The 'adaptive' method uses bilateral filtering to preserve edges."> | |
310 <option value="none" selected="True">none</option> | |
311 <option value="gaussian">gaussian</option> | |
312 <option value="adaptive">adaptive</option> | |
313 </param> | |
314 </when> | 303 </when> |
315 </conditional> | 304 </conditional> |
316 <repeat name="colours" title="Colours for the plots" min="1" max="50"> | 305 <repeat name="colours" title="Colours for the plots" min="1" max="50"> |
317 <param name="feature_color" type="color" label="Colours" value="#ff00ff" help="Numbers of columns should be the same as number of components"> | 306 <param name="feature_color" type="color" label="Colours" value="#ff00ff" help="Numbers of columns should be the same as number of components"> |
318 <sanitizer> | 307 <sanitizer> |
350 <composite_data value="Analyze75.hdr" /> | 339 <composite_data value="Analyze75.hdr" /> |
351 <composite_data value="Analyze75.img" /> | 340 <composite_data value="Analyze75.img" /> |
352 <composite_data value="Analyze75.t2m" /> | 341 <composite_data value="Analyze75.t2m" /> |
353 </param> | 342 </param> |
354 <param name="segmentationtool" value="kmeans"/> | 343 <param name="segmentationtool" value="kmeans"/> |
344 <param name="kmeans_r" value="1:3"/> | |
345 <param name="kmeans_k" value="2,3"/> | |
355 <repeat name="colours"> | 346 <repeat name="colours"> |
356 <param name="feature_color" value="#ff00ff"/> | 347 <param name="feature_color" value="#ff00ff"/> |
357 </repeat> | 348 </repeat> |
358 <repeat name="colours"> | 349 <repeat name="colours"> |
359 <param name="feature_color" value="#0000FF"/> | 350 <param name="feature_color" value="#0000FF"/> |
366 <output name="pixeloutput" file="cluster_skm.tabular" compare="sim_size"/> | 357 <output name="pixeloutput" file="cluster_skm.tabular" compare="sim_size"/> |
367 </test> | 358 </test> |
368 <test> | 359 <test> |
369 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> | 360 <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> |
370 <param name="segmentationtool" value="centroids"/> | 361 <param name="segmentationtool" value="centroids"/> |
362 <param name="centroids_r" ftype="text" value="1,2"/> | |
363 <param name="centroids_k" ftype="text" value="5"/> | |
364 <param name="centroids_toplabels" ftype="integer" value="100"/> | |
371 <repeat name="colours"> | 365 <repeat name="colours"> |
372 <param name="feature_color" value="#0000FF"/> | 366 <param name="feature_color" value="#0000FF"/> |
373 </repeat> | 367 </repeat> |
374 <repeat name="colours"> | 368 <repeat name="colours"> |
375 <param name="feature_color" value="#00C957"/> | 369 <param name="feature_color" value="#00C957"/> |