Mercurial > repos > galaxyp > cardinal_segmentations
diff segmentation.xml @ 7:4a2ac25d1063 draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit f986c51abe33c7f622d429a3c4a79ee24b33c1f3"
author | galaxyp |
---|---|
date | Thu, 23 Apr 2020 08:09:32 -0400 |
parents | 9f7d1ec01767 |
children | b591450b3d1c |
line wrap: on
line diff
--- a/segmentation.xml Wed Mar 25 05:43:05 2020 -0400 +++ b/segmentation.xml Thu Apr 23 08:09:32 2020 -0400 @@ -1,12 +1,11 @@ -<tool id="cardinal_segmentations" name="MSI segmentation" version="@VERSION@.3"> +<tool id="cardinal_segmentations" name="MSI segmentation" version="@VERSION@.0"> <description>mass spectrometry imaging spatial clustering</description> <macros> <import>macros.xml</import> </macros> <expand macro="requirements"> <requirement type="package" version="2.3">r-gridextra</requirement> - <requirement type="package" version="0.20_35">r-lattice</requirement> - </expand> + </expand> <command detect_errors="exit_code"> <![CDATA[ @@ -19,17 +18,14 @@ <configfiles> <configfile name="MSI_segmentation"><![CDATA[ - ################################# load libraries and read file ################# library(Cardinal) library(gridExtra) -library(lattice) - +@READING_MSIDATA@ -@READING_MSIDATA_INRAM@ - + msidata = as(msidata, "MSImageSet") ##coercion to MSImageSet ## remove duplicated coordinates msidata <- msidata[,!duplicated(coord(msidata))] @@ -61,21 +57,6 @@ #set $color_string = ','.join(['"%s"' % $color.feature_color for $color in $colours]) colourvector = c($color_string) - ### preparation for images and plots: - #if str($image_type) == "standard_image": - print("standard image") - - strip_input = FALSE - lattice_input = FALSE - - #elif str($image_type) == "lattice_image": - print("lattice image") - - strip_input = strip.custom(bg="lightgrey", par.strip.text=list(col="black", cex=.9)) - lattice_input = TRUE - - #end if - ## set seed to make analysis reproducible set.seed($setseed) @@ -105,11 +86,11 @@ colnames(sd_table)[1] = "Principal components" grid.table(sd_table, rows=NULL) ### images in pdf file - print(image(pca_result, main="PCA image", lattice=lattice_input, strip = strip_input, col=colourvector, ylim=c(maximumy+2, minimumy-2))) + print(image(pca_result, main="PCA image", strip = FALSE, col=colourvector, ylim=c(maximumy+2, minimumy-2))) for (PCs in 1:$segm_cond.pca_ncomp){ - print(image(pca_result, column = c(paste0("PC",PCs)), lattice=lattice_input,strip = strip_input, superpose = FALSE, main=paste0("PC", PCs), col.regions = risk.colors(100), ylim=c(maximumy+2, minimumy-2)))} + print(image(pca_result, column = c(paste0("PC",PCs)),strip = FALSE, superpose = FALSE, main=paste0("PC", PCs), col.regions = risk.colors(100), ylim=c(maximumy+2, minimumy-2)))} ### plots in pdf file - print(plot(pca_result, main="PCA plot", lattice=lattice_input, col= colourvector, strip = strip_input)) + print(plot(pca_result, main="PCA plot", col= colourvector, strip = FALSE)) for (PCs in 1:$segm_cond.pca_ncomp){ print(plot(pca_result, column = c(paste0("PC",PCs)),main=paste0("PC", PCs),strip = FALSE,superpose = FALSE))} @@ -149,8 +130,8 @@ rm(msidata) gc() - print(image(skm, key=TRUE, main="K-means clustering", lattice=lattice_input, strip=strip_input, col= colourvector, layout=c(1,1), ylim=c(maximumy+2, minimumy-2))) - print(plot(skm, main="K-means plot", lattice=lattice_input, col= colourvector, strip=strip_input, layout=c(1,1))) + print(image(skm, key=TRUE, main="K-means clustering", strip=FALSE, col= colourvector, layout=c(1,1), ylim=c(maximumy+2, minimumy-2))) + print(plot(skm, main="K-means plot", col= colourvector, strip=FALSE, layout=c(1,1))) skm_clusters = data.frame(matrix(NA, nrow = pixelcount, ncol = 0)) for (iteration in 1:length(skm@resultData)){ @@ -167,7 +148,7 @@ skm_clusters2 = data.frame(pixel_names, x_coordinates, y_coordinates, skm_clusters) colnames(skm_clusters2) = c("pixel names", "x", "y",names(skm@resultData)) - skm_toplabels = topLabels(skm, n=$segm_cond.kmeans_toplabels) + skm_toplabels = topFeatures(skm, n=$segm_cond.kmeans_toplabels) write.table(skm_toplabels, file="$mzfeatures", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") write.table(skm_clusters2, file="$pixeloutput", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") @@ -188,9 +169,9 @@ ## remove msidata to clean up RAM space rm(msidata) gc() - print(image(ssc, key=TRUE, main="Spatial shrunken centroids", lattice=lattice_input, strip = TRUE, col= colourvector,layout=c(1,1), ylim=c(maximumy+2, minimumy-2))) - print(plot(ssc, main="Spatial shrunken centroids plot", lattice=lattice_input, col= colourvector, strip = TRUE,layout=c(1,1))) - print(plot(ssc, mode = "tstatistics",key = TRUE, lattice=lattice_input, layout = c(1,1), main="t-statistics", col=colourvector)) + print(image(ssc, key=TRUE, main="Spatial shrunken centroids", strip = TRUE, col= colourvector,layout=c(1,1), ylim=c(maximumy+2, minimumy-2))) + print(plot(ssc, main="Spatial shrunken centroids plot", col= colourvector, strip = TRUE,layout=c(1,1))) + print(plot(ssc, mode = "tstatistics",key = TRUE, layout = c(1,1), main="t-statistics", col=colourvector)) plot(summary(ssc), main = "Number of segments") @@ -209,7 +190,7 @@ ssc_classes2 = data.frame(pixel_names, x_coordinates, y_coordinates, ssc_classes) colnames(ssc_classes2) = c("pixel names", "x", "y", names(ssc@resultData)) - ssc_toplabels = topLabels(ssc, n=$segm_cond.centroids_toplabels) + ssc_toplabels = topFeatures(ssc, n=$segm_cond.centroids_toplabels) write.table(ssc_toplabels, file="$mzfeatures", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") write.table(ssc_classes2, file="$pixeloutput", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") @@ -313,8 +294,6 @@ label="Number of toplabels (m/z) which should be written in tabular output"/> </when> </conditional> - <param name="image_type" type="boolean" checked="True" truevalue="standard_image" falsevalue="lattice_image" - label="Standard image" help="No: lattice function is used to display image"/> <param name="svg_pixelimage" type="boolean" label="Export first segmentation image as svg"/> <repeat name="colours" title="Colours for the plots" min="1" max="50"> <param name="feature_color" type="color" label="Colours" value="#ff00ff" help="Numbers of colours should be the same as number of components"> @@ -343,7 +322,6 @@ <test> <expand macro="infile_imzml"/> <param name="segmentationtool" value="pca"/> - <param name="image_type" value="lattice_image"/> <repeat name="colours"> <param name="feature_color" value="#ff00ff"/> </repeat> @@ -353,7 +331,8 @@ <output name="segmentationimages" file="pca_imzml.pdf" compare="sim_size"/> <output name="mzfeatures"> <assert_contents> - <has_text text="300.17" /> + <has_text text="300.1667" /> + <has_text text="300.25" /> <has_text text="-4.234458e-04" /> <has_text text="3.878545e-10" /> <has_n_columns n="3" /> @@ -362,7 +341,7 @@ <output name="pixeloutput" file="scores_pca.tabular"/> </test> <test> - <expand macro="infile_analyze75"/> + <expand macro="infile_imzml"/> <param name="segmentationtool" value="kmeans"/> <param name="kmeans_r" value="1:3"/> <param name="kmeans_k" value="2,3"/> @@ -397,16 +376,38 @@ <repeat name="colours"> <param name="feature_color" value="#B0171F"/> </repeat> - <repeat name="colours"> - <param name="feature_color" value="#FFD700"/> - </repeat> - <repeat name="colours"> - <param name="feature_color" value="#848484"/> - </repeat> <output name="segmentationimages" file="centroids_rdata.pdf" compare="sim_size"/> <output name="mzfeatures" file="toplabels_ssc.tabular"/> <output name="pixeloutput" file="classes_ssc.tabular"/> </test> + <test> + <param name="infile" value="" ftype="imzml"> + <composite_data value="preprocessing_results3.imzml"/> + <composite_data value="preprocessing_results3.ibd"/> + </param> + <conditional name="processed_cond"> + <param name="processed_file" value="processed"/> + <param name="accuracy" value="1"/> + <param name="units" value="mz"/> + </conditional> + <param name="segmentationtool" value="centroids"/> + <param name="centroids_r" value="1"/> + <param name="centroids_k" value="2,3"/> + <param name="centroids_s" value="0,3"/> + <param name="centroids_toplabels" value="100"/> + <repeat name="colours"> + <param name="feature_color" value="#0000FF"/> + </repeat> + <repeat name="colours"> + <param name="feature_color" value="#00C957"/> + </repeat> + <repeat name="colours"> + <param name="feature_color" value="#B0171F"/> + </repeat> + <output name="segmentationimages" file="centroids_proc.pdf" compare="sim_size"/> + <output name="mzfeatures" file="toplabels_proc.tabular"/> + <output name="pixeloutput" file="classes_proc.tabular"/> + </test> </tests> <help> <![CDATA[