Mercurial > repos > galaxyp > cardinal_classification
changeset 9:60a70b5fb67c draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit e499c9124d3fd85a7fc47b95c206ce91a5e3678c-dirty"
line wrap: on
line diff
--- a/classification.xml Wed May 13 17:52:13 2020 +0000 +++ b/classification.xml Tue Nov 03 22:08:53 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)]]
--- a/macros.xml Wed May 13 17:52:13 2020 +0000 +++ b/macros.xml Tue Nov 03 22:08:53 2020 +0000 @@ -1,10 +1,10 @@ <macros> - <token name="@VERSION@">2.4.0</token> + <token name="@VERSION@">2.6.0</token> <xml name="requirements"> <requirements> <requirement type="package" version="@VERSION@">bioconductor-cardinal</requirement> - <requirement type="package" version="3.6.1">r-base</requirement> + <!--requirement type="package" version="3.6.1">r-base</requirement--> <yield/> </requirements> </xml> @@ -117,6 +117,13 @@ <token name="@DATA_PROPERTIES_INRAM@"><![CDATA[ ########################### QC numbers ######################## ## including intensity calculations which need data in RAM + + int_matrix = as.matrix(spectra(msidata)) ## only load once into RAM, then re-use + ## Number of NA in spectra matrix + NAcount = sum(is.na(int_matrix)) + ## replace NA with zero to calculate data properties based on intensity matrix, no change in msidata + int_matrix[is.na(int_matrix)] <- 0 + ## Number of features (mz) maxfeatures = length(features(msidata)) ## Range mz @@ -131,14 +138,12 @@ minimumy = min(coord(msidata)[,2]) maximumy = max(coord(msidata)[,2]) ## Range of intensities - minint = round(min(as.matrix(spectra(msidata)), na.rm=TRUE), digits=2) - maxint = round(max(as.matrix(spectra(msidata)), na.rm=TRUE), digits=2) + minint = round(min(int_matrix), digits=2) + maxint = round(max(int_matrix), digits=2) ## Number of intensities > 0, for if conditions - npeaks= sum(as.matrix(spectra(msidata))>0, na.rm=TRUE) + npeaks= sum(int_matrix>0) ## Number of NA in spectra matrix - NAcount = sum(is.na(spectra(msidata))) - ## Number of NA in spectra matrix - infcount = sum(is.infinite(as.matrix(spectra(msidata)))) + infcount = sum(is.infinite(int_matrix)) ## Number of duplicated coordinates dupl_coord = sum(duplicated(coord(msidata))) properties = c("Number of m/z features", @@ -175,7 +180,7 @@ - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ - Analyze7.5 (upload hdr, img and t2m file via the "composite" function) - - Cardinal "MSImageSet" data saved as .RData + - Cardinal "MSImageSet" or "MSImagingExperiment" saved as .RData ]]></token> <token name="@MZ_TABULAR_INPUT_DESCRIPTION@"><