comparison 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
comparison
equal deleted inserted replaced
8:277dc652246e 9:24c000517173
1 <tool id="cardinal_classification" name="MSI classification" version="@VERSION@.1"> 1 <tool id="cardinal_classification" name="MSI classification" version="@VERSION@.0">
2 <description>spatial classification of mass spectrometry imaging data</description> 2 <description>spatial classification of mass spectrometry imaging data</description>
3 <macros> 3 <macros>
4 <import>macros.xml</import> 4 <import>macros.xml</import>
5 </macros> 5 </macros>
6 <expand macro="requirements"> 6 <expand macro="requirements">
7 <requirement type="package" version="2.3">r-gridextra</requirement> 7 <requirement type="package" version="2.3">r-gridextra</requirement>
8 <requirement type="package" version="3.2.1">r-ggplot2</requirement> 8 <requirement type="package" version="3.3.2">r-ggplot2</requirement>
9 </expand> 9 </expand>
10 <command detect_errors="exit_code"> 10 <command detect_errors="exit_code">
11 <![CDATA[ 11 <![CDATA[
12 12
13 @INPUT_LINKING@ 13 @INPUT_LINKING@
616 theme(legend.position="bottom",legend.direction="vertical")+ 616 theme(legend.position="bottom",legend.direction="vertical")+
617 guides(fill=guide_legend(ncol=4,byrow=TRUE)) 617 guides(fill=guide_legend(ncol=4,byrow=TRUE))
618 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") 618 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass")
619 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes) 619 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
620 print(prediction_plot) 620 print(prediction_plot)
621 621
622
623 ## image with right and wrong classes:
624 comparison_df = cbind(prediction_df, y_vector)
625 comparison_df\$correct<- ifelse(comparison_df\$predicted_classes==comparison_df\$y_vector, T, F)
626
627 correctness_plot = ggplot(comparison_df, aes(x=x, y=y, fill=correct))+
628 geom_tile() +
629 coord_fixed()+
630 ggtitle("Correctness of classification")+
631 theme_bw()+
632 theme(text=element_text(family="ArialMT", face="bold", size=15))+
633 theme(legend.position="bottom",legend.direction="vertical")+
634 guides(fill=guide_legend(ncol=2,byrow=TRUE))
635 ## coord_labels = aggregate(cbind(x,y)~correct, data=comparison_df, mean, na.rm=TRUE, na.action="na.pass")
636 ##coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
637 print(correctness_plot)
622 638
623 ## optional output as .RData 639 ## optional output as .RData
624 #if $output_rdata: 640 #if $output_rdata:
625 save(msidata.ssc, file="$classification_rdata") 641 save(msidata.ssc, file="$classification_rdata")
626 #end if 642 #end if
688 theme(legend.position="bottom",legend.direction="vertical")+ 704 theme(legend.position="bottom",legend.direction="vertical")+
689 guides(fill=guide_legend(ncol=4,byrow=TRUE)) 705 guides(fill=guide_legend(ncol=4,byrow=TRUE))
690 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") 706 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass")
691 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes) 707 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
692 print(prediction_plot) 708 print(prediction_plot)
709
710 ## image with right and wrong classes:
711
712 comparison_df = cbind(prediction_df, new_y_vector)
713 comparison_df\$correct<- as.factor(ifelse(comparison_df\$predicted_classes==comparison_df\$new_y_vector, T, F))
714
715 correctness_plot = ggplot(comparison_df, aes(x=x, y=y, fill=correct))+
716 geom_tile()+
717 scale_fill_manual(values = c("TRUE" = "orange","FALSE" = "darkblue"))+
718 coord_fixed()+
719 ggtitle("Correctness of classification")+
720 theme_bw()+
721 theme(text=element_text(family="ArialMT", face="bold", size=15))+
722 theme(legend.position="bottom",legend.direction="vertical")+
723 guides(fill=guide_legend(ncol=2,byrow=TRUE))
724 ## coord_labels = aggregate(cbind(x,y)~correct, data=comparison_df, mean, na.rm=TRUE, na.action="na.pass")
725 ##coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes)
726 print(correctness_plot)
727
693 728
694 ## Summary table prediction 729 ## Summary table prediction
695 summary_table = summary(prediction)\$accuracy[[names(prediction@resultData)]] 730 summary_table = summary(prediction)\$accuracy[[names(prediction@resultData)]]
696 summary_table2 = round(as.numeric(summary_table), digits=2) 731 summary_table2 = round(as.numeric(summary_table), digits=2)
697 summary_matrix = matrix(summary_table2, nrow=4, ncol=ncol(summary_table)) 732 summary_matrix = matrix(summary_table2, nrow=4, ncol=ncol(summary_table))