| Previous changeset 13:b18329a8ac14 (2020-12-23) Next changeset 15:f28ad96b76dc (2021-06-21) |
|
Commit message:
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 888b3e991d0752b694bf480531ce0e5318c2f337-dirty" |
|
modified:
classification.xml test-data/pixels_test6.tabular test-data/test6.pdf test-data/test6.rdata |
| b |
| diff -r b18329a8ac14 -r ece627528a78 classification.xml --- a/classification.xml Wed Dec 23 21:59:28 2020 +0000 +++ b/classification.xml Fri May 07 10:10:35 2021 +0000 |
| [ |
| b'@@ -1,4 +1,4 @@\n-<tool id="cardinal_classification" name="MSI classification" version="@VERSION@.0">\n+<tool id="cardinal_classification" name="MSI classification" version="@VERSION@.1">\n <description>spatial classification of mass spectrometry imaging data</description>\n <macros>\n <import>macros.xml</import>\n@@ -25,7 +25,7 @@\n library(Cardinal)\n library(gridExtra)\n library(ggplot2)\n-\n+library(scales)\n \n @READING_MSIDATA@\n \n@@ -57,7 +57,7 @@\n \n \n ##################### I) numbers and control plots #############################\n-###############################################################################\n+################################################################################\n \n ## table with values\n grid.table(property_df, rows= NULL)\n@@ -67,7 +67,7 @@\n \n opar <- par()\n \n- ######################## II) Training #############################\n+ ######################## II) Training #######################################\n #############################################################################\n #if str( $type_cond.type_method) == "training":\n print("training")\n@@ -90,21 +90,26 @@\n merged_response = merge(msidata_coordinates, y_input, by=c("x", "y"), all.x=TRUE)\n merged_response[is.na(merged_response)] = "NA"\n merged_response = merged_response[order(merged_response\\$pixel_index),]\n- y_vector = as.factor(merged_response[,4])\n+ conditions = as.factor(merged_response[,4])\n+ y_vector = conditions\n \n ## plot of y vector\n \n- position_df = cbind(coord(msidata)[,1:2], y_vector)\n- y_plot = ggplot(position_df, aes(x=x, y=y, fill=y_vector))+\n+ position_df = cbind(coord(msidata)[,1:2], conditions)\n+ y_plot = ggplot(position_df, aes(x=x, y=y, fill=conditions))+\n geom_tile() +\n coord_fixed()+\n- ggtitle("Distribution of the response variable y")+\n- theme_bw()+\n+ ggtitle("Distribution of the conditions")+\n+\t\ttheme_bw()+\n+ theme(\n+\t plot.background = element_blank(),\n+\t panel.grid.major = element_blank(),\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- coord_labels = aggregate(cbind(x,y)~y_vector, data=position_df, mean, na.rm=TRUE, na.action="na.pass")\n- coord_labels\\$file_number = gsub( "_.*$", "", coord_labels\\$y_vector)\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 \n \n@@ -119,7 +124,11 @@\n geom_tile() +\n coord_fixed()+\n ggtitle("Distribution of the fold variable")+\n- theme_bw()+\n+\t theme_bw()+\n+ theme(\n+\t plot.background = element_blank(),\n+\t panel.grid.major = element_blank(),\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@@ -276,7 +285,11 @@\n geom_tile() +\n coord_fixed()+\n ggtitle("Predicted condition for each pixel")+\n- theme_bw()+\n+\t\t\ttheme_bw()+\n+\t\t theme(\n+\t\t plot.background = element_blank(),\n+\t\t panel.grid.major = element_blank(),\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@@ -443,7 +456,11 @@\n'..b'an">gaussian</option>\n <option value="adaptive" selected="True">adaptive</option>\n- </param>\n-\n+ </param> \n </when>\n </conditional>\n \n@@ -862,10 +903,15 @@\n <param name="training_result" type="data" format="rdata" label="Result from previous classification training"/>\n <!--param name="predicted_toplabels" type="integer" value="100"\n label="Number of toplabels (m/z features) which should be written in tabular output"/-->\n+ <param name="classification_type" type="select" display="radio" optional="False" label="Which classification method was used">\n+ \t<option value="PLS_classifier" selected="True" >PLS classifier</option>\n+ \t<option value="OPLS_classifier">OPLS classifier</option>\n+ \t<option value="SSC_classifier">SSC_classifier</option>\n+ \t</param>\n <conditional name="new_y_values_cond">\n- <param name="new_y_values" type="select" label="Should new response values be used">\n- <option value="no_new_response" selected="True">old response should be used</option>\n- <option value="new_response">load new response from tabular file</option>\n+ <param name="new_y_values" type="select" label="Load annotations (optional, but allows accuracy calculations)">\n+ <option value="no_new_response" selected="True">no</option>\n+ <option value="new_response">use annotations</option>\n </param>\n <when value="no_new_response"/>\n <when value="new_response">\n@@ -884,6 +930,12 @@\n <data format="pdf" name="classification_images" from_work_dir="classificationpdf.pdf" label = "${tool.name} on ${on_string}: results"/>\n <data format="tabular" name="mzfeatures" label="${tool.name} on ${on_string}: features"/>\n <data format="tabular" name="pixeloutput" label="${tool.name} on ${on_string}: pixels"/>\n+ <data format="txt" name="best_r" label="${tool.name} on ${on_string}:best r">\n+ <filter>type_cond[\'type_method\'] == \'training\' and type_cond[\'method_cond\'][\'class_method\'] == \'spatialShrunkenCentroids\' and type_cond[\'method_cond\'][\'ssc_analysis_cond\'][\'ssc_method\'] == \'ssc_cvapply\' and type_cond[\'method_cond\'][\'ssc_analysis_cond\'][\'write_best_params\']</filter>\n+ </data>\n+ <data format="txt" name="best_s" label="${tool.name} on ${on_string}:best s">\n+ <filter>type_cond[\'type_method\'] == \'training\' and type_cond[\'method_cond\'][\'class_method\'] == \'spatialShrunkenCentroids\' and type_cond[\'method_cond\'][\'ssc_analysis_cond\'][\'ssc_method\'] == \'ssc_cvapply\' and type_cond[\'method_cond\'][\'ssc_analysis_cond\'][\'write_best_params\']</filter>\n+ </data> \n <data format="rdata" name="classification_rdata" label="${tool.name} on ${on_string}: results.RData">\n <filter>output_rdata</filter>\n </data>\n@@ -1101,8 +1153,9 @@\n - training and prediction\n \n - training can be done with cvapply that uses cross validation to find the best value for s, this requires not only a condition for each spectrum but also a fold (each fold should contain spectra of all conditions)\n- - training with the best value for s gives the top m/z features for each condition and the predicted classification group for each spectrum\n+ - training with the best value for r and s gives the top m/z features for each condition and the predicted classification group for each spectrum\n - training result can be saved as RData file that can be reused for prediction of further samples\n+ - prediction can calculate accuracies when the annotations are known and provided\n \n \n .. image:: $PATH_TO_IMAGES/classification_overview.png\n' |
| b |
| diff -r b18329a8ac14 -r ece627528a78 test-data/pixels_test6.tabular --- a/test-data/pixels_test6.tabular Wed Dec 23 21:59:28 2020 +0000 +++ b/test-data/pixels_test6.tabular Fri May 07 10:10:35 2021 +0000 |
| b |
| @@ -1,25 +1,25 @@ -pixel names x y predicted condition -xy_1_1 1 1 A -xy_2_1 2 1 A -xy_3_1 3 1 B -xy_4_1 4 1 C -xy_1_2 1 2 C -xy_2_2 2 2 C -xy_3_2 3 2 A -xy_4_2 4 2 A -xy_1_3 1 3 A -xy_2_3 2 3 B -xy_3_3 3 3 C -xy_4_3 4 3 A -xy_10_1 10 1 C -xy_11_1 11 1 C -xy_12_1 12 1 C -xy_13_1 13 1 B -xy_10_2 10 2 C -xy_11_2 11 2 B -xy_12_2 12 2 C -xy_13_2 13 2 C -xy_10_3 10 3 C -xy_11_3 11 3 C -xy_12_3 12 3 B -xy_13_3 13 3 C +pixel names x y predicted condition A B C +xy_1_1 1 1 A 0.434439526064797 0.195646317191818 0.369914156743386 +xy_2_1 2 1 A 0.38219998209377 0.242372158141275 0.375427859764956 +xy_3_1 3 1 B 0.312531499299517 0.385612104162858 0.301856396537625 +xy_4_1 4 1 C 0.393153488582866 0.191107087820634 0.4157394235965 +xy_1_2 1 2 C 0.366986470447772 0.216121568441093 0.416891961111135 +xy_2_2 2 2 C 0.381682206547616 0.213188918797062 0.405128874655322 +xy_3_2 3 2 A 0.376695037169723 0.260689491088564 0.362615471741713 +xy_4_2 4 2 A 0.42305935188829 0.174038449100755 0.402902199010954 +xy_1_3 1 3 A 0.382420991383021 0.249364697048677 0.368214311568302 +xy_2_3 2 3 B 0.272145998315727 0.446525938567718 0.281328063116555 +xy_3_3 3 3 C 0.36296987427851 0.255631013944556 0.381399111776934 +xy_4_3 4 3 A 0.444812272103175 0.132274264153212 0.422913463743613 +xy_10_1 10 1 C 0.376216993893763 0.227584528606788 0.39619847749945 +xy_11_1 11 1 C 0.358430578177403 0.236120068794936 0.405449353027661 +xy_12_1 12 1 C 0.359751662628136 0.218620985552221 0.421627351819643 +xy_13_1 13 1 B 0.101486342705225 0.813997511218961 0.0845161460758142 +xy_10_2 10 2 C 0.354612526523361 0.272635192773437 0.372752280703202 +xy_11_2 11 2 B 0.291635599769993 0.444466545540823 0.263897854689184 +xy_12_2 12 2 C 0.36763798979782 0.203911653614431 0.428450356587749 +xy_13_2 13 2 C 0.344608135177236 0.304026642707691 0.351365222115073 +xy_10_3 10 3 C 0.37046458150651 0.205561286708086 0.423974131785404 +xy_11_3 11 3 C 0.358113833435286 0.262878459144526 0.379007707420187 +xy_12_3 12 3 B 0.180921926305915 0.66902588624642 0.150052187447665 +xy_13_3 13 3 C 0.378266307042675 0.20859472985319 0.413138963104135 |
| b |
| diff -r b18329a8ac14 -r ece627528a78 test-data/test6.pdf |
| b |
| Binary file test-data/test6.pdf has changed |
| b |
| diff -r b18329a8ac14 -r ece627528a78 test-data/test6.rdata |
| b |
| Binary file test-data/test6.rdata has changed |