Repository 'cardinal_classification'
hg clone https://toolshed.g2.bx.psu.edu/repos/galaxyp/cardinal_classification

Changeset 15:f28ad96b76dc (2021-06-21)
Previous changeset 14:ece627528a78 (2021-05-07) Next changeset 16:eddc2ae2db80 (2021-08-29)
Commit message:
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit d0dc9303d449c63a6ffe8fbfe195951d5db9cb89-dirty"
modified:
classification.xml
test-data/test1.pdf
test-data/test2.pdf
test-data/test3.pdf
test-data/test4.pdf
test-data/test5.pdf
test-data/test6.pdf
test-data/test6.rdata
test-data/test7.pdf
test-data/test7.rdata
b
diff -r ece627528a78 -r f28ad96b76dc classification.xml
--- a/classification.xml Fri May 07 10:10:35 2021 +0000
+++ b/classification.xml Mon Jun 21 07:35:58 2021 +0000
[
b'@@ -1,4 +1,4 @@\n-<tool id="cardinal_classification" name="MSI classification" version="@VERSION@.1">\n+<tool id="cardinal_classification" name="MSI classification" version="@VERSION@.2">\n     <description>spatial classification of mass spectrometry imaging data</description>\n     <macros>\n         <import>macros.xml</import>\n@@ -92,6 +92,18 @@\n             merged_response = merged_response[order(merged_response\\$pixel_index),]\n             conditions = as.factor(merged_response[,4])\n             y_vector = conditions\n+            \n+        ## colours selection:\n+\n+\t#if str($colour_conditional.colour_type) == "manual_colour"\n+\t    #set $color_string = \',\'.join([\'"%s"\' % $color.annotation_color for $color in $colour_conditional.colours])\n+\t    colourvector = c($color_string)\n+\n+\t#elif str($colour_conditional.colour_type) == "colourpalette"\n+\t    number_levels = (length(levels(conditions)))\n+\t    colourvector = noquote($colour_conditional.palettes)(number_levels)\n+\n+\t#end if\n \n     ## plot of y vector\n \n@@ -107,7 +119,8 @@\n \t       panel.grid.minor = element_blank())+\n            theme(text=element_text(family="ArialMT", face="bold", size=15))+\n            theme(legend.position="bottom",legend.direction="vertical")+\n-           guides(fill=guide_legend(ncol=4,byrow=TRUE))\n+           guides(fill=guide_legend(ncol=4,byrow=TRUE))+\n+           scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector)\n     coord_labels = aggregate(cbind(x,y)~conditions, data=position_df, mean, na.rm=TRUE, na.action="na.pass")\n     coord_labels\\$file_number = gsub( "_.*$", "", coord_labels\\$conditions)\n     print(y_plot)\n@@ -183,7 +196,7 @@\n                 ## one image for each sample/fold, 4 images per page\n                 minimumy = min(coord(msidata.cv.pls)[,2])\n                 maximumy = max(coord(msidata.cv.pls)[,2])\n-                image(msidata.cv.pls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1))\n+                image(msidata.cv.pls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1), col=colourvector)\n \n                 ## print table with summary in pdf\n                 par(opar)\n@@ -240,7 +253,7 @@\n \n                 ### pls analysis and coefficients plot\n                 msidata.pls <- PLS(msidata, y = y_vector, ncomp = component, scale=$type_cond.method_cond.analysis_cond.pls_scale)\n-                plot(msidata.pls, main="PLS coefficients per m/z")\n+                plot(msidata.pls, main="PLS coefficients per m/z", col=colourvector)\n \n                 ### summary table of PLS\n                 summary_table = summary(msidata.pls)\\$accuracy[[paste0("ncomp = ",component)]]\n@@ -292,7 +305,8 @@\n \t\t       panel.grid.minor = element_blank())+\n                        theme(text=element_text(family="ArialMT", face="bold", size=15))+\n                        theme(legend.position="bottom",legend.direction="vertical")+\n-                       guides(fill=guide_legend(ncol=4,byrow=TRUE))\n+                       guides(fill=guide_legend(ncol=4,byrow=TRUE))+\n+                       scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector)\n                 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass")\n                 coord_labels\\$file_number = gsub( "_.*$", "", coord_labels\\$predicted_classes)\n                 print(prediction_plot)\n@@ -351,7 +365,7 @@\n                 ## one image for each sample/fold, 4 images per page\n                 minimumy = min(coord(msidata.cv.opls)[,2])\n                 maximumy = max(coord(msidata.cv.opls)[,2])\n-                image(msidata.cv.opls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1))\n+                image(msidata.cv.opls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1), col=colourvec'..b'accuracy[[names(prediction@resultData)]]\n \t    summary_table2 = round(as.numeric(summary_table), digits=2)\n@@ -704,7 +720,19 @@\n \n         #else\n             prediction = predict(training_data,msidata)\n+            number_levels = length(levels(training_data\\$y[[1]]))\n         #end if\n+        \n+        ## colours selection:\n+\n+\t#if str($colour_conditional.colour_type) == "manual_colour"\n+\t    #set $color_string = \',\'.join([\'"%s"\' % $color.annotation_color for $color in $colour_conditional.colours])\n+\t    colourvector = c($color_string)\n+\n+\t#elif str($colour_conditional.colour_type) == "colourpalette"\n+\t    colourvector = noquote($colour_conditional.palettes)(number_levels)\n+\n+\t#end if\n \n         ## m/z and pixel information output\n         predicted_classes = data.frame(prediction\\$classes[[1]])\n@@ -730,8 +758,8 @@\n             predicted_classes2 = data.frame(pixel_names, x_coordinates, y_coordinates, predicted_classes, predicted_probabilities)\n             colnames(predicted_classes2) = c("pixel names", "x", "y","predicted condition", levels(prediction\\$classes[[1]]))\n             ## also image modes are specific to SSC\n-            image(prediction, mode="classes", layout=c(1,1), main="Class", col=hue_pal()(length(unique(prediction\\$classes[[1]]))))\n-            image(prediction, mode="probabilities", layout=c(1,1), main="Class probabilities", col=hue_pal()(length(unique(prediction\\$classes[[1]]))))\n+            image(prediction, mode="classes", layout=c(1,1), main="Class", ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy), col=colourvector)\n+            image(prediction, mode="probabilities", layout=c(1,1), main="Class probabilities",ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy), col=colourvector)\n \n \t#else\n         \n@@ -746,7 +774,8 @@\n         \tpanel.grid.minor = element_blank())+\n         \ttheme(text=element_text(family="ArialMT", face="bold", size=15))+\n         \ttheme(legend.position="bottom", legend.direction="vertical")+\n-        \tguides(fill=guide_legend(ncol=4, byrow=TRUE))\n+        \tguides(fill=guide_legend(ncol=4, byrow=TRUE))+\n+        \tscale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector)\n         \tcoord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass")\n         \tcoord_labels\\$file_number = gsub( "_.*\xc2\xa7", "", coord_labels\\$predicted_classes)\n         \tprint(prediction_plot)\n@@ -924,6 +953,33 @@\n                 </conditional>\n             </when>\n         </conditional>\n+        <conditional name="colour_conditional">\n+\t    <param name="colour_type" type="select" label="Choose a colour scheme">\n+\t        <option value="colourpalette" selected="True" >Colour palette</option>\n+\t        <option value="manual_colour">Manual selection</option>\n+\t    </param>\n+\t    <when value="manual_colour">\n+\t       <repeat name="colours" title="Colours for the plots" min="1" max="50">\n+\t       <param name="annotation_color" type="color" label="Colours" value="#ff00ff" help="Numbers of colours should be the same as number of components">\n+\t       <sanitizer>\n+\t           <valid initial="string.letters,string.digits">\n+\t           <add value="#" />\n+\t           </valid>\n+\t       </sanitizer>\n+\t       </param>\n+\t       </repeat>\n+\t    </when>\n+\t    <when value="colourpalette">\n+\t        <param name="palettes" type="select" display="radio" label="Select a colourpalette">\n+\t\t    <option value="hue_pal()" selected="True">hue</option>\n+\t\t    <option value="rainbow">rainbow</option>\n+\t\t    <option value="heat.colors">heat colors</option>\n+\t\t    <option value="terrain.colors">terrain colors</option>\n+\t\t    <option value="topo.colors">topo colors</option>\n+\t\t    <option value="cm.colors">cm colors</option>\n+\t        </param>\n+\t    </when>\n+        </conditional>\n         <param name="output_rdata" type="boolean" label="Results as .RData output" help="Can be used to generate a classification prediction on new data"/>\n     </inputs>\n     <outputs>\n'
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test1.pdf
b
Binary file test-data/test1.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test2.pdf
b
Binary file test-data/test2.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test3.pdf
b
Binary file test-data/test3.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test4.pdf
b
Binary file test-data/test4.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test5.pdf
b
Binary file test-data/test5.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test6.pdf
b
Binary file test-data/test6.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test6.rdata
b
Binary file test-data/test6.rdata has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test7.pdf
b
Binary file test-data/test7.pdf has changed
b
diff -r ece627528a78 -r f28ad96b76dc test-data/test7.rdata
b
Binary file test-data/test7.rdata has changed