diff classification.xml @ 9:24c000517173 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 6e8b69ee3aff3c93f745a5de11cc9169130f2e5e"
author galaxyp
date Thu, 24 Sep 2020 11:34:50 +0000
parents 277dc652246e
children ece627528a78
line wrap: on
line diff
--- a/classification.xml	Wed May 13 14:00:58 2020 -0400
+++ b/classification.xml	Thu Sep 24 11:34:50 2020 +0000
@@ -1,11 +1,11 @@
-<tool id="cardinal_classification" name="MSI classification" version="@VERSION@.1">
+<tool id="cardinal_classification" name="MSI classification" version="@VERSION@.0">
     <description>spatial classification of mass spectrometry imaging data</description>
     <macros>
         <import>macros.xml</import>
     </macros>
     <expand macro="requirements">
         <requirement type="package" version="2.3">r-gridextra</requirement>
-        <requirement type="package" version="3.2.1">r-ggplot2</requirement>
+        <requirement type="package" version="3.3.2">r-ggplot2</requirement>
     </expand>
     <command detect_errors="exit_code">
     <![CDATA[
@@ -618,7 +618,23 @@
                 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass")
                 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
                 print(prediction_plot)
+                
+                
+               ## image with right and wrong classes: 
+               comparison_df = cbind(prediction_df, y_vector)
+               comparison_df\$correct<- ifelse(comparison_df\$predicted_classes==comparison_df\$y_vector, T, F)
 
+               correctness_plot = ggplot(comparison_df, aes(x=x, y=y, fill=correct))+
+                       geom_tile() +
+                       coord_fixed()+
+                       ggtitle("Correctness of classification")+
+                       theme_bw()+
+                       theme(text=element_text(family="ArialMT", face="bold", size=15))+
+                       theme(legend.position="bottom",legend.direction="vertical")+
+                       guides(fill=guide_legend(ncol=2,byrow=TRUE))
+               ## coord_labels = aggregate(cbind(x,y)~correct, data=comparison_df, mean, na.rm=TRUE, na.action="na.pass")
+                ##coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
+                print(correctness_plot)
 
                 ## optional output as .RData
                 #if $output_rdata:
@@ -690,6 +706,25 @@
         coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass")
         coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
         print(prediction_plot)
+        
+        ## image with right and wrong classes:     
+
+	comparison_df = cbind(prediction_df, new_y_vector)
+	comparison_df\$correct<- as.factor(ifelse(comparison_df\$predicted_classes==comparison_df\$new_y_vector, T, F))
+
+	correctness_plot = ggplot(comparison_df, aes(x=x, y=y, fill=correct))+
+                       geom_tile()+
+                       scale_fill_manual(values = c("TRUE" = "orange","FALSE" = "darkblue"))+
+                       coord_fixed()+
+                       ggtitle("Correctness of classification")+
+                       theme_bw()+
+                       theme(text=element_text(family="ArialMT", face="bold", size=15))+
+                       theme(legend.position="bottom",legend.direction="vertical")+
+                       guides(fill=guide_legend(ncol=2,byrow=TRUE))
+               ## coord_labels = aggregate(cbind(x,y)~correct, data=comparison_df, mean, na.rm=TRUE, na.action="na.pass")
+                ##coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
+        print(correctness_plot)
+                
 
         ## Summary table prediction
         summary_table = summary(prediction)\$accuracy[[names(prediction@resultData)]]