Mercurial > repos > galaxyp > cardinal_classification
comparison classification.xml @ 12:fbcc2ab88045 draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit c8d3adac445b4e08e2724e22d7201bfc38bbf40f"
| author | galaxyp |
|---|---|
| date | Sun, 29 Aug 2021 07:11:53 +0000 |
| parents | 8abcfbb033a1 |
| children | f7a924565c39 |
comparison
equal
deleted
inserted
replaced
| 11:8abcfbb033a1 | 12:fbcc2ab88045 |
|---|---|
| 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.3.2">r-ggplot2</requirement> | 8 <requirement type="package" version="3.3.5">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@ |
| 90 merged_response = merge(msidata_coordinates, y_input, by=c("x", "y"), all.x=TRUE) | 90 merged_response = merge(msidata_coordinates, y_input, by=c("x", "y"), all.x=TRUE) |
| 91 merged_response[is.na(merged_response)] = "NA" | 91 merged_response[is.na(merged_response)] = "NA" |
| 92 merged_response = merged_response[order(merged_response\$pixel_index),] | 92 merged_response = merged_response[order(merged_response\$pixel_index),] |
| 93 conditions = as.factor(merged_response[,4]) | 93 conditions = as.factor(merged_response[,4]) |
| 94 y_vector = conditions | 94 y_vector = conditions |
| 95 | |
| 96 ## colours selection: | |
| 97 | |
| 98 #if str($colour_conditional.colour_type) == "manual_colour" | |
| 99 #set $color_string = ','.join(['"%s"' % $color.annotation_color for $color in $colour_conditional.colours]) | |
| 100 colourvector = c($color_string) | |
| 101 | |
| 102 #elif str($colour_conditional.colour_type) == "colourpalette" | |
| 103 number_levels = (length(levels(conditions))) | |
| 104 colourvector = noquote($colour_conditional.palettes)(number_levels) | |
| 105 | |
| 106 #end if | |
| 95 | 107 |
| 96 ## plot of y vector | 108 ## plot of y vector |
| 97 | 109 |
| 98 position_df = cbind(coord(msidata)[,1:2], conditions) | 110 position_df = cbind(coord(msidata)[,1:2], conditions) |
| 99 y_plot = ggplot(position_df, aes(x=x, y=y, fill=conditions))+ | 111 y_plot = ggplot(position_df, aes(x=x, y=y, fill=conditions))+ |
| 105 plot.background = element_blank(), | 117 plot.background = element_blank(), |
| 106 panel.grid.major = element_blank(), | 118 panel.grid.major = element_blank(), |
| 107 panel.grid.minor = element_blank())+ | 119 panel.grid.minor = element_blank())+ |
| 108 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | 120 theme(text=element_text(family="ArialMT", face="bold", size=15))+ |
| 109 theme(legend.position="bottom",legend.direction="vertical")+ | 121 theme(legend.position="bottom",legend.direction="vertical")+ |
| 110 guides(fill=guide_legend(ncol=4,byrow=TRUE)) | 122 guides(fill=guide_legend(ncol=4,byrow=TRUE))+ |
| 123 scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector) | |
| 111 coord_labels = aggregate(cbind(x,y)~conditions, data=position_df, mean, na.rm=TRUE, na.action="na.pass") | 124 coord_labels = aggregate(cbind(x,y)~conditions, data=position_df, mean, na.rm=TRUE, na.action="na.pass") |
| 112 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$conditions) | 125 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$conditions) |
| 113 print(y_plot) | 126 print(y_plot) |
| 114 | 127 |
| 115 | 128 |
| 181 plot(components, accuracy_vector, ylab = "mean accuracy",type="o", main="Mean accuracy of PLS classification") | 194 plot(components, accuracy_vector, ylab = "mean accuracy",type="o", main="Mean accuracy of PLS classification") |
| 182 ncomp_max = components[which.max(accuracy_vector)] ## find ncomp with max. accuracy | 195 ncomp_max = components[which.max(accuracy_vector)] ## find ncomp with max. accuracy |
| 183 ## one image for each sample/fold, 4 images per page | 196 ## one image for each sample/fold, 4 images per page |
| 184 minimumy = min(coord(msidata.cv.pls)[,2]) | 197 minimumy = min(coord(msidata.cv.pls)[,2]) |
| 185 maximumy = max(coord(msidata.cv.pls)[,2]) | 198 maximumy = max(coord(msidata.cv.pls)[,2]) |
| 186 image(msidata.cv.pls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1)) | 199 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) |
| 187 | 200 |
| 188 ## print table with summary in pdf | 201 ## print table with summary in pdf |
| 189 par(opar) | 202 par(opar) |
| 190 plot(0,type='n',axes=FALSE,ann=FALSE) | 203 plot(0,type='n',axes=FALSE,ann=FALSE) |
| 191 title(main="Summary for the different components\n", adj=0.5) | 204 title(main="Summary for the different components\n", adj=0.5) |
| 238 } | 251 } |
| 239 ) | 252 ) |
| 240 | 253 |
| 241 ### pls analysis and coefficients plot | 254 ### pls analysis and coefficients plot |
| 242 msidata.pls <- PLS(msidata, y = y_vector, ncomp = component, scale=$type_cond.method_cond.analysis_cond.pls_scale) | 255 msidata.pls <- PLS(msidata, y = y_vector, ncomp = component, scale=$type_cond.method_cond.analysis_cond.pls_scale) |
| 243 plot(msidata.pls, main="PLS coefficients per m/z") | 256 plot(msidata.pls, main="PLS coefficients per m/z", col=colourvector) |
| 244 | 257 |
| 245 ### summary table of PLS | 258 ### summary table of PLS |
| 246 summary_table = summary(msidata.pls)\$accuracy[[paste0("ncomp = ",component)]] | 259 summary_table = summary(msidata.pls)\$accuracy[[paste0("ncomp = ",component)]] |
| 247 summary_table2 = round(as.numeric(summary_table), digits=2) | 260 summary_table2 = round(as.numeric(summary_table), digits=2) |
| 248 summary_matrix = matrix(summary_table2, nrow=4, ncol=number_groups) | 261 summary_matrix = matrix(summary_table2, nrow=4, ncol=number_groups) |
| 290 plot.background = element_blank(), | 303 plot.background = element_blank(), |
| 291 panel.grid.major = element_blank(), | 304 panel.grid.major = element_blank(), |
| 292 panel.grid.minor = element_blank())+ | 305 panel.grid.minor = element_blank())+ |
| 293 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | 306 theme(text=element_text(family="ArialMT", face="bold", size=15))+ |
| 294 theme(legend.position="bottom",legend.direction="vertical")+ | 307 theme(legend.position="bottom",legend.direction="vertical")+ |
| 295 guides(fill=guide_legend(ncol=4,byrow=TRUE)) | 308 guides(fill=guide_legend(ncol=4,byrow=TRUE))+ |
| 309 scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector) | |
| 296 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") | 310 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") |
| 297 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes) | 311 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes) |
| 298 print(prediction_plot) | 312 print(prediction_plot) |
| 299 | 313 |
| 300 ### optional output as .RData | 314 ### optional output as .RData |
| 349 plot(components, accuracy_vector, ylab = "mean accuracy", type="o", main="Mean accuracy of OPLS classification") | 363 plot(components, accuracy_vector, ylab = "mean accuracy", type="o", main="Mean accuracy of OPLS classification") |
| 350 ncomp_max = components[which.max(accuracy_vector)] ## find ncomp with max. accuracy | 364 ncomp_max = components[which.max(accuracy_vector)] ## find ncomp with max. accuracy |
| 351 ## one image for each sample/fold, 4 images per page | 365 ## one image for each sample/fold, 4 images per page |
| 352 minimumy = min(coord(msidata.cv.opls)[,2]) | 366 minimumy = min(coord(msidata.cv.opls)[,2]) |
| 353 maximumy = max(coord(msidata.cv.opls)[,2]) | 367 maximumy = max(coord(msidata.cv.opls)[,2]) |
| 354 image(msidata.cv.opls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1)) | 368 image(msidata.cv.opls, model = list(ncomp = ncomp_max),ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout = c(1, 1), col=colourvector) |
| 355 | 369 |
| 356 ## print table with summary in pdf | 370 ## print table with summary in pdf |
| 357 par(opar) | 371 par(opar) |
| 358 plot(0,type='n',axes=FALSE,ann=FALSE) | 372 plot(0,type='n',axes=FALSE,ann=FALSE) |
| 359 title(main="Summary for the different components\n", adj=0.5) | 373 title(main="Summary for the different components\n", adj=0.5) |
| 407 ) | 421 ) |
| 408 | 422 |
| 409 ### opls analysis and coefficients plot | 423 ### opls analysis and coefficients plot |
| 410 msidata.opls <- PLS(msidata, y = y_vector, ncomp = component, scale=$type_cond.method_cond.opls_analysis_cond.opls_scale) | 424 msidata.opls <- PLS(msidata, y = y_vector, ncomp = component, scale=$type_cond.method_cond.opls_analysis_cond.opls_scale) |
| 411 ## to reduce msidata: keep.Xnew = $type_cond.method_cond.opls_analysis_cond.xnew | 425 ## to reduce msidata: keep.Xnew = $type_cond.method_cond.opls_analysis_cond.xnew |
| 412 plot(msidata.opls, main="OPLS coefficients per m/z") | 426 plot(msidata.opls, main="OPLS coefficients per m/z", col=colourvector) |
| 413 | 427 |
| 414 | 428 |
| 415 ### summary table of OPLS | 429 ### summary table of OPLS |
| 416 summary_table = summary(msidata.opls)\$accuracy[[paste0("ncomp = ",component)]] | 430 summary_table = summary(msidata.opls)\$accuracy[[paste0("ncomp = ",component)]] |
| 417 summary_table2 = round(as.numeric(summary_table), digits=2) | 431 summary_table2 = round(as.numeric(summary_table), digits=2) |
| 461 plot.background = element_blank(), | 475 plot.background = element_blank(), |
| 462 panel.grid.major = element_blank(), | 476 panel.grid.major = element_blank(), |
| 463 panel.grid.minor = element_blank())+ | 477 panel.grid.minor = element_blank())+ |
| 464 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | 478 theme(text=element_text(family="ArialMT", face="bold", size=15))+ |
| 465 theme(legend.position="bottom",legend.direction="vertical")+ | 479 theme(legend.position="bottom",legend.direction="vertical")+ |
| 466 guides(fill=guide_legend(ncol=4,byrow=TRUE)) | 480 guides(fill=guide_legend(ncol=4,byrow=TRUE))+ |
| 481 scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector) | |
| 467 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") | 482 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") |
| 468 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes) | 483 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$predicted_classes) |
| 469 print(prediction_plot) | 484 print(prediction_plot) |
| 470 | 485 |
| 471 ## optional output as .RData | 486 ## optional output as .RData |
| 520 best_params = names(msidata.cv.ssc@resultData[[1]][,1])[which.max(accuracy_vector)] ## find parameters with max. accuracy | 535 best_params = names(msidata.cv.ssc@resultData[[1]][,1])[which.max(accuracy_vector)] ## find parameters with max. accuracy |
| 521 r_value = as.numeric(substring(unlist(strsplit(best_params, ","))[1], 4)) | 536 r_value = as.numeric(substring(unlist(strsplit(best_params, ","))[1], 4)) |
| 522 s_value = as.numeric(substring(unlist(strsplit(best_params, ","))[3], 5)) ## remove space | 537 s_value = as.numeric(substring(unlist(strsplit(best_params, ","))[3], 5)) ## remove space |
| 523 minimumy = min(coord(msidata.cv.ssc)[,2]) | 538 minimumy = min(coord(msidata.cv.ssc)[,2]) |
| 524 maximumy = max(coord(msidata.cv.ssc)[,2]) | 539 maximumy = max(coord(msidata.cv.ssc)[,2]) |
| 525 image(msidata.cv.ssc, model = list( r = r_value, s = s_value ), ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout=c(1,1)) | 540 image(msidata.cv.ssc, model = list( r = r_value, s = s_value ), ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy),layout=c(1,1), col=colourvector) |
| 526 | 541 |
| 527 #if $type_cond.method_cond.ssc_analysis_cond.write_best_params: | 542 #if $type_cond.method_cond.ssc_analysis_cond.write_best_params: |
| 528 write.table(r_value, file="$best_r", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") | 543 write.table(r_value, file="$best_r", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") |
| 529 write.table(s_value, file="$best_s", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") | 544 write.table(s_value, file="$best_s", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") |
| 530 #end if | 545 #end if |
| 565 | 580 |
| 566 ## SSC analysis and plot | 581 ## SSC analysis and plot |
| 567 msidata.ssc <- spatialShrunkenCentroids(msidata, y = y_vector, | 582 msidata.ssc <- spatialShrunkenCentroids(msidata, y = y_vector, |
| 568 r = c($type_cond.method_cond.ssc_r), s = c($type_cond.method_cond.ssc_s), method = "$type_cond.method_cond.ssc_kernel_method") | 583 r = c($type_cond.method_cond.ssc_r), s = c($type_cond.method_cond.ssc_s), method = "$type_cond.method_cond.ssc_kernel_method") |
| 569 plot(msidata.ssc, mode = "tstatistics", model = list("r" = c($type_cond.method_cond.ssc_r), "s" = c($type_cond.method_cond.ssc_s)), | 584 plot(msidata.ssc, mode = "tstatistics", model = list("r" = c($type_cond.method_cond.ssc_r), "s" = c($type_cond.method_cond.ssc_s)), |
| 570 col=hue_pal()(length(levels(msidata.ssc\$classes[[1]]))), lwd=2) | 585 col=colourvector, lwd=2) |
| 571 | |
| 572 | |
| 573 | 586 |
| 574 ### summary table SSC | 587 ### summary table SSC |
| 575 ##############summary_table = summary(msidata.ssc) | 588 ##############summary_table = summary(msidata.ssc) |
| 576 | 589 |
| 577 ### stop if multiple values for r and s were used as input | 590 ### stop if multiple values for r and s were used as input |
| 627 ssc_toplabels = topFeatures(msidata.ssc, n=Inf) | 640 ssc_toplabels = topFeatures(msidata.ssc, n=Inf) |
| 628 ssc_toplabels[,6:9] <-round(ssc_toplabels[,6:9],6) | 641 ssc_toplabels[,6:9] <-round(ssc_toplabels[,6:9],6) |
| 629 write.table(ssc_toplabels, file="$mzfeatures", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") | 642 write.table(ssc_toplabels, file="$mzfeatures", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") |
| 630 write.table(ssc_classes2, file="$pixeloutput", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") | 643 write.table(ssc_classes2, file="$pixeloutput", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t") |
| 631 | 644 |
| 632 image(msidata.ssc, model=list(r = c($type_cond.method_cond.ssc_r), s = c($type_cond.method_cond.ssc_s)), | 645 image(msidata.ssc, model=list(r = c($type_cond.method_cond.ssc_r), s = c($type_cond.method_cond.ssc_s)), ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy), |
| 633 col=hue_pal()(length(levels(msidata.ssc\$classes[[1]]))), mode="classes", layout=c(1,1), main="Class Prediction") | 646 col=colourvector, mode="classes", layout=c(1,1), main="Class Prediction") |
| 634 image(msidata.ssc, model=list(r = c($type_cond.method_cond.ssc_r), s = c($type_cond.method_cond.ssc_s)), | 647 image(msidata.ssc, model=list(r = c($type_cond.method_cond.ssc_r), s = c($type_cond.method_cond.ssc_s)), ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy), |
| 635 col=hue_pal()(length(levels(msidata.ssc\$classes[[1]]))), mode="probabilities", layout=c(1,1), main="Class probabilities") | 648 col=colourvector, mode="probabilities", layout=c(1,1), main="Class probabilities") |
| 636 | 649 |
| 637 | 650 |
| 638 ## image with right and wrong classes: | 651 ## image with right and wrong classes: |
| 639 prediction_df = cbind(coord(msidata.ssc)[,1:2], ssc_classes) | 652 prediction_df = cbind(coord(msidata.ssc)[,1:2], ssc_classes) |
| 640 colnames(prediction_df) = c("x", "y", "predicted_classes") | 653 colnames(prediction_df) = c("x", "y", "predicted_classes") |
| 690 merged_response[is.na(merged_response)] = "NA" | 703 merged_response[is.na(merged_response)] = "NA" |
| 691 merged_response = merged_response[order(merged_response\$pixel_index),] | 704 merged_response = merged_response[order(merged_response\$pixel_index),] |
| 692 new_y_vector = as.factor(merged_response[,4]) | 705 new_y_vector = as.factor(merged_response[,4]) |
| 693 prediction = predict(training_data,msidata, newy = new_y_vector) | 706 prediction = predict(training_data,msidata, newy = new_y_vector) |
| 694 | 707 |
| 708 ##numbers of levels for colour selection | |
| 709 number_levels = length(levels(new_y_vector)) | |
| 710 | |
| 695 ## Summary table prediction | 711 ## Summary table prediction |
| 696 summary_table = summary(prediction)\$accuracy[[names(prediction@resultData)]] | 712 summary_table = summary(prediction)\$accuracy[[names(prediction@resultData)]] |
| 697 summary_table2 = round(as.numeric(summary_table), digits=2) | 713 summary_table2 = round(as.numeric(summary_table), digits=2) |
| 698 summary_matrix = matrix(summary_table2, nrow=4, ncol=ncol(summary_table)) | 714 summary_matrix = matrix(summary_table2, nrow=4, ncol=ncol(summary_table)) |
| 699 summary_table3 = cbind(rownames(summary_table), summary_matrix) ## include rownames in table | 715 summary_table3 = cbind(rownames(summary_table), summary_matrix) ## include rownames in table |
| 702 plot(0,type='n',axes=FALSE,ann=FALSE) | 718 plot(0,type='n',axes=FALSE,ann=FALSE) |
| 703 grid.table(summary_table5, rows= NULL) | 719 grid.table(summary_table5, rows= NULL) |
| 704 | 720 |
| 705 #else | 721 #else |
| 706 prediction = predict(training_data,msidata) | 722 prediction = predict(training_data,msidata) |
| 723 number_levels = length(levels(training_data\$y[[1]])) | |
| 707 #end if | 724 #end if |
| 725 | |
| 726 ## colours selection: | |
| 727 | |
| 728 #if str($colour_conditional.colour_type) == "manual_colour" | |
| 729 #set $color_string = ','.join(['"%s"' % $color.annotation_color for $color in $colour_conditional.colours]) | |
| 730 colourvector = c($color_string) | |
| 731 | |
| 732 #elif str($colour_conditional.colour_type) == "colourpalette" | |
| 733 colourvector = noquote($colour_conditional.palettes)(number_levels) | |
| 734 | |
| 735 #end if | |
| 708 | 736 |
| 709 ## m/z and pixel information output | 737 ## m/z and pixel information output |
| 710 predicted_classes = data.frame(prediction\$classes[[1]]) | 738 predicted_classes = data.frame(prediction\$classes[[1]]) |
| 711 pixel_names = gsub(", y = ", "_", names(pixels(msidata))) | 739 pixel_names = gsub(", y = ", "_", names(pixels(msidata))) |
| 712 pixel_names = gsub(" = ", "y_", pixel_names) | 740 pixel_names = gsub(" = ", "y_", pixel_names) |
| 728 ## this seems to work only for SSC, therefore overwrite tables | 756 ## this seems to work only for SSC, therefore overwrite tables |
| 729 predicted_probabilities = data.frame(prediction\$probabilities[[1]]) | 757 predicted_probabilities = data.frame(prediction\$probabilities[[1]]) |
| 730 predicted_classes2 = data.frame(pixel_names, x_coordinates, y_coordinates, predicted_classes, predicted_probabilities) | 758 predicted_classes2 = data.frame(pixel_names, x_coordinates, y_coordinates, predicted_classes, predicted_probabilities) |
| 731 colnames(predicted_classes2) = c("pixel names", "x", "y","predicted condition", levels(prediction\$classes[[1]])) | 759 colnames(predicted_classes2) = c("pixel names", "x", "y","predicted condition", levels(prediction\$classes[[1]])) |
| 732 ## also image modes are specific to SSC | 760 ## also image modes are specific to SSC |
| 733 image(prediction, mode="classes", layout=c(1,1), main="Class", col=hue_pal()(length(unique(prediction\$classes[[1]])))) | 761 image(prediction, mode="classes", layout=c(1,1), main="Class", ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy), col=colourvector) |
| 734 image(prediction, mode="probabilities", layout=c(1,1), main="Class probabilities", col=hue_pal()(length(unique(prediction\$classes[[1]])))) | 762 image(prediction, mode="probabilities", layout=c(1,1), main="Class probabilities",ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy), col=colourvector) |
| 735 | 763 |
| 736 #else | 764 #else |
| 737 | 765 |
| 738 prediction_plot = ggplot(prediction_df, aes(x=x, y=y, fill=predicted_classes))+ | 766 prediction_plot = ggplot(prediction_df, aes(x=x, y=y, fill=predicted_classes))+ |
| 739 geom_tile()+ | 767 geom_tile()+ |
| 744 plot.background = element_blank(), | 772 plot.background = element_blank(), |
| 745 panel.grid.major = element_blank(), | 773 panel.grid.major = element_blank(), |
| 746 panel.grid.minor = element_blank())+ | 774 panel.grid.minor = element_blank())+ |
| 747 theme(text=element_text(family="ArialMT", face="bold", size=15))+ | 775 theme(text=element_text(family="ArialMT", face="bold", size=15))+ |
| 748 theme(legend.position="bottom", legend.direction="vertical")+ | 776 theme(legend.position="bottom", legend.direction="vertical")+ |
| 749 guides(fill=guide_legend(ncol=4, byrow=TRUE)) | 777 guides(fill=guide_legend(ncol=4, byrow=TRUE))+ |
| 778 scale_discrete_manual(aesthetics = c("colour", "fill"), values = colourvector) | |
| 750 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") | 779 coord_labels = aggregate(cbind(x,y)~predicted_classes, data=prediction_df, mean, na.rm=TRUE, na.action="na.pass") |
| 751 coord_labels\$file_number = gsub( "_.*§", "", coord_labels\$predicted_classes) | 780 coord_labels\$file_number = gsub( "_.*§", "", coord_labels\$predicted_classes) |
| 752 print(prediction_plot) | 781 print(prediction_plot) |
| 753 #end if | 782 #end if |
| 754 | 783 |
| 921 <param name="column_new_response" data_ref="new_response_file" label="Column with new response values" type="data_column"/> | 950 <param name="column_new_response" data_ref="new_response_file" label="Column with new response values" type="data_column"/> |
| 922 <param name="new_tabular_header" type="boolean" label="Tabular files contain a header line" truevalue="TRUE" falsevalue="FALSE"/> | 951 <param name="new_tabular_header" type="boolean" label="Tabular files contain a header line" truevalue="TRUE" falsevalue="FALSE"/> |
| 923 </when> | 952 </when> |
| 924 </conditional> | 953 </conditional> |
| 925 </when> | 954 </when> |
| 955 </conditional> | |
| 956 <conditional name="colour_conditional"> | |
| 957 <param name="colour_type" type="select" label="Choose a colour scheme"> | |
| 958 <option value="colourpalette" selected="True" >Colour palette</option> | |
| 959 <option value="manual_colour">Manual selection</option> | |
| 960 </param> | |
| 961 <when value="manual_colour"> | |
| 962 <repeat name="colours" title="Colours for the plots" min="1" max="50"> | |
| 963 <param name="annotation_color" type="color" label="Colours" value="#ff00ff" help="Numbers of colours should be the same as number of components"> | |
| 964 <sanitizer> | |
| 965 <valid initial="string.letters,string.digits"> | |
| 966 <add value="#" /> | |
| 967 </valid> | |
| 968 </sanitizer> | |
| 969 </param> | |
| 970 </repeat> | |
| 971 </when> | |
| 972 <when value="colourpalette"> | |
| 973 <param name="palettes" type="select" display="radio" label="Select a colourpalette"> | |
| 974 <option value="hue_pal()" selected="True">hue</option> | |
| 975 <option value="rainbow">rainbow</option> | |
| 976 <option value="heat.colors">heat colors</option> | |
| 977 <option value="terrain.colors">terrain colors</option> | |
| 978 <option value="topo.colors">topo colors</option> | |
| 979 <option value="cm.colors">cm colors</option> | |
| 980 </param> | |
| 981 </when> | |
| 926 </conditional> | 982 </conditional> |
| 927 <param name="output_rdata" type="boolean" label="Results as .RData output" help="Can be used to generate a classification prediction on new data"/> | 983 <param name="output_rdata" type="boolean" label="Results as .RData output" help="Can be used to generate a classification prediction on new data"/> |
| 928 </inputs> | 984 </inputs> |
| 929 <outputs> | 985 <outputs> |
| 930 <data format="pdf" name="classification_images" from_work_dir="classificationpdf.pdf" label = "${tool.name} on ${on_string}: results"/> | 986 <data format="pdf" name="classification_images" from_work_dir="classificationpdf.pdf" label = "${tool.name} on ${on_string}: results"/> |
