Mercurial > repos > galaxyp > mass_spectrometry_imaging_segmentations
diff segmentation_tool.xml @ 4:aec189b0c64d draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_segmentation commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
author | galaxyp |
---|---|
date | Mon, 28 May 2018 12:39:28 -0400 |
parents | 830c6df59603 |
children | cee9cf693709 |
line wrap: on
line diff
--- a/segmentation_tool.xml Mon Apr 23 17:19:53 2018 -0400 +++ b/segmentation_tool.xml Mon May 28 12:39:28 2018 -0400 @@ -1,21 +1,20 @@ -<tool id="mass_spectrometry_imaging_segmentations" name="MSI segmentation" version="1.7.0.3"> +<tool id="mass_spectrometry_imaging_segmentations" name="MSI segmentation" version="1.10.0.0"> <description>tool for spatial clustering</description> <requirements> - <requirement type="package" version="1.7.0">bioconductor-cardinal</requirement> + <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement> <requirement type="package" version="2.2.1">r-gridextra</requirement> - <requirement type="package" version="2.23-15">r-kernsmooth</requirement> <requirement type="package" version="0.20-35">r-lattice</requirement> </requirements> <command detect_errors="exit_code"> <![CDATA[ #if $infile.ext == 'imzml' - cp '${infile.extra_files_path}/imzml' infile.imzML && - cp '${infile.extra_files_path}/ibd' infile.ibd && + ln -s '${infile.extra_files_path}/imzml' infile.imzML && + ln -s '${infile.extra_files_path}/ibd' infile.ibd && #elif $infile.ext == 'analyze75' - cp '${infile.extra_files_path}/hdr' infile.hdr && - cp '${infile.extra_files_path}/img' infile.img && - cp '${infile.extra_files_path}/t2m' infile.t2m && + ln -s '${infile.extra_files_path}/hdr' infile.hdr && + ln -s '${infile.extra_files_path}/img' infile.img && + ln -s '${infile.extra_files_path}/t2m' infile.t2m && #else ln -s $infile infile.RData && #end if @@ -34,20 +33,19 @@ library(Cardinal) library(gridExtra) -library(KernSmooth) library(lattice) ## Read MALDI Imaging dataset #if $infile.ext == 'imzml' - msidata = readMSIData('infile.imzML') + msidata = readImzML('infile') #elif $infile.ext == 'analyze75' - msidata = readMSIData('infile.hdr') + msidata = readAnalyze('infile') #else load('infile.RData') #end if -###################################### file properties in numbers ###################### +###################################### file properties in numbers ############## ## Number of features (mz) maxfeatures = length(features(msidata)) @@ -145,9 +143,9 @@ property_df = data.frame(properties, values) -######################################## PDF ############################################# -########################################################################################## -########################################################################################## +######################################## PDF ################################### +################################################################################ +################################################################################ pdf("segmentationpdf.pdf", fonts = "Times", pointsize = 12) @@ -180,7 +178,7 @@ pca = PCA(msidata, ncomp=$segm_cond.pca_ncomp, column = component_vector, superpose = FALSE, method = "$segm_cond.pca_method", scale = $segm_cond.pca_scale, layout = c(ncomp, 1)) - 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))) + print(image(pca, main="PCA image", lattice=TRUE, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)), col=colourvector)) print(plot(pca, main="PCA plot", lattice=TRUE, col= colourvector, strip = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)))) @@ -195,7 +193,7 @@ ##k-means skm = spatialKMeans(msidata, r=c($segm_cond.kmeans_r), k=c($segm_cond.kmeans_k), method="$segm_cond.kmeans_method") - 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))) + 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, layout=c(1,1))) 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))) @@ -217,7 +215,7 @@ ##centroids 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") - 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))) + 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,layout=c(1,1))) 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))) ssc_classes = data.frame(matrix(NA, nrow = pixelcount, ncol = 0)) @@ -248,33 +246,33 @@ label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData" help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/> <conditional name="segm_cond"> - <param name="segmentationtool" type="select" label="Select the tool for spatial clustering."> + <param name="segmentationtool" type="select" label="Select the tool for spatial clustering"> <option value="pca" selected="True">pca</option> <option value="kmeans">k-means</option> - <option value="centroids">shrunken centroids</option> + <option value="centroids">spatial shrunken centroids</option> </param> <when value="pca"> <param name="pca_ncomp" type="integer" value="2" - label="The number of principal components to calculate."/> + label="The number of principal components to calculate"/> <param name="pca_method" type="select" - label="The function used to calculate the singular value decomposition."> + label="The function used to calculate the singular value decomposition"> <option value="irlba" selected="True">irlba</option> <option value="svd">svd</option> </param> <param name="pca_scale" type="select" display="radio" optional="False" - label="Shoud the data be scaled first?"> + label="Scaling of data before analysis"> <option value="TRUE">yes</option> <option value="FALSE" selected="True">no</option> </param> - </when> + </when> <when value="kmeans"> <param name="kmeans_r" type="text" value="2" - label="The spatial neighborhood radius of nearby pixels to consider (r)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> + label="The spatial neighborhood radius of nearby pixels to consider (r)" help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> <param name="kmeans_k" type="text" value="3" - label="The number of clusters (k)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> + label="The number of clusters (k)" help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> <param name="kmeans_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) clustering, and 'adaptive' refers to spatially-aware structurally-adaptive (SASA) clustering."> + 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"> <option value="gaussian">gaussian</option> <option value="adaptive" selected="True">adaptive</option> </param> @@ -286,13 +284,13 @@ <when value="centroids"> <param name="centroids_r" type="text" value="2" - label="The spatial neighborhood radius of nearby pixels to consider (r)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> + label="The spatial neighborhood radius of nearby pixels to consider (r)" help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> <param name="centroids_k" type="text" value="5" - label="The initial number of clusters (k)." help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> + label="The initial number of clusters (k)" help="Multiple values are allowed (e.g. 1,2,3 or 2:5)"/> <param name="centroids_s" type="text" value="2" - label="The sparsity thresholding parameter by which to shrink the t-statistics (s)." - 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)."/> - <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."> + label="The sparsity thresholding parameter by which to shrink the t-statistics (s)" + 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)"/> + <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"> <option value="gaussian" selected="True">gaussian</option> <option value="adaptive">adaptive</option> </param> @@ -343,6 +341,7 @@ <param name="segmentationtool" value="kmeans"/> <param name="kmeans_r" value="1:3"/> <param name="kmeans_k" value="2,3"/> + <param name="kmeans_toplabels" value="20"/> <repeat name="colours"> <param name="feature_color" value="#ff00ff"/> </repeat> @@ -352,16 +351,16 @@ <repeat name="colours"> <param name="feature_color" value="#00C957"/> </repeat> - <output name="segmentationimages" file="kmeans_imzml.pdf" compare="sim_size" delta="20000"/> + <output name="segmentationimages" file="kmeans_analyze.pdf" compare="sim_size" delta="20000"/> <output name="mzfeatures" file="toplabels_skm.tabular" compare="sim_size"/> <output name="pixeloutput" file="cluster_skm.tabular" compare="sim_size"/> </test> <test> - <param name="infile" value="preprocessing_results1.RData" ftype="rdata"/> + <param name="infile" value="preprocessed.RData" ftype="rdata"/> <param name="segmentationtool" value="centroids"/> - <param name="centroids_r" ftype="text" value="1,2"/> - <param name="centroids_k" ftype="text" value="5"/> - <param name="centroids_toplabels" ftype="integer" value="100"/> + <param name="centroids_r" value="1,2"/> + <param name="centroids_k" value="5"/> + <param name="centroids_toplabels" value="50"/> <repeat name="colours"> <param name="feature_color" value="#0000FF"/> </repeat> @@ -377,7 +376,7 @@ <repeat name="colours"> <param name="feature_color" value="#848484"/> </repeat> - <output name="segmentationimages" file="centroids_imzml.pdf" compare="sim_size" delta="20000"/> + <output name="segmentationimages" file="centroids_rdata.pdf" compare="sim_size" delta="20000"/> <output name="mzfeatures" file="toplabels_ssc.tabular" compare="sim_size"/> <output name="pixeloutput" file="classes_ssc.tabular" compare="sim_size"/> </test> @@ -385,16 +384,27 @@ <help> <![CDATA[ -Spatially aware segmentation of mass-spectrometry imaging data by unsupervised clustering algorithms. Underlying structures can be identified with the following tools: pca, k-means clustering and spatial shrunken centroids. The spatialShrunkenCentroids method allows the number of segments to decrease according to the data. This allows automatic selection of the number -of clusters. +Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_ + +This tool provides three different Cardinal functions for unsupervised clustering/spatial segmentation of mass-spectrometry imaging data. Input data: 3 types of input data can be used: -- imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <http://ms-imaging.org/wp/introduction/>`_ +- imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData) -The output of this tool contains a pdf with plots from the segmentation tools. +Options: + +- PCA: principal component analysis +- k-means: patially-aware k-means clustering +- spatial shrunken centroids: Allows the number of segments to decrease according to the data. This allows automatic selection of the number of clusters + +Output: + +- Pdf with the heatmaps and plots for the segmentation +- Tabular file with information on masses and pixels: loadings/scores (PCA), toplabels/clusters (k-means), toplabels/classes (spatial shrunken centroids) + ]]> </help> <citations>