# HG changeset patch # User galaxyp # Date 1536082942 14400 # Node ID df8d7f6f210b4a9e5d39ee5699e7d9fefc68e059 # Parent 4d5578b57a7716fe33c3fbcffa3bacc7100924a9 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_preprocessing commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e diff -r 4d5578b57a77 -r df8d7f6f210b msi_preprocessing.xml --- a/msi_preprocessing.xml Wed Aug 22 13:43:04 2018 -0400 +++ b/msi_preprocessing.xml Tue Sep 04 13:42:22 2018 -0400 @@ -1,4 +1,4 @@ - + mass spectrometry imaging preprocessing @@ -103,7 +103,7 @@ print('Baseline_reduction') ##baseline reduction - msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline) + msidata = reduceBaseline(msidata, method="median", blocks=$method.methods_conditional.blocks_baseline, spar=$method.methods_conditional.spar_baseline) ############################### QC ########################### @@ -132,7 +132,7 @@ msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, order = $method.methods_conditional.methods_for_smoothing.order_of_filters) #elif str($method.methods_conditional.methods_for_smoothing.smoothing_method) == 'ma': - print('sgolay smoothing') + print('moving average smoothing') msidata = smoothSignal(msidata, method="$method.methods_conditional.methods_for_smoothing.smoothing_method", window=$method.methods_conditional.window_smoothing, coef = $method.methods_conditional.methods_for_smoothing.coefficients_ma_filter) @@ -156,7 +156,7 @@ ## Peakpicking ## remove duplicated coordinates, otherwise peak picking will fail - print(paste0(sum(duplicated(coord(msidata))), " coordinates were removed")) + print(paste0(sum(duplicated(coord(msidata))), " duplicated coordinates were removed")) msidata <- msidata[,!duplicated(coord(msidata))] #if str( $method.methods_conditional.methods_for_picking.picking_method) == 'adaptive': @@ -364,14 +364,15 @@ sample_matrix = cbind(sample_matrix, subsample_calc) count = count+1 } - rownames(sample_matrix) = mz(msidata) - colnames(sample_matrix) = levels(msidata\$annotation) - write.table(sample_matrix, file="$summarized_output_mean", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") + + sample_matrix_mean = cbind(mz(msidata),sample_matrix) + sample_matrix_mean = rbind(c("mz", levels(msidata\$annotation)), sample_matrix_mean) + write.table(sample_matrix_mean, file="$summarized_mean", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") }else{ - full_sample_calc = as.data.frame(apply(spectra(msidata)[],1,mean, na.rm=TRUE)) - rownames(full_sample_calc) = mz(msidata) - colnames(full_sample_calc) = "$infile.display_name" - write.table(full_sample_calc, file="$summarized_output_mean", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") + full_sample_calc_mean = as.data.frame(apply(spectra(msidata)[],1,mean, na.rm=TRUE)) + full_sample_calc_mean = cbind(mz(msidata),full_sample_calc_mean) + full_sample_calc_mean = rbind(c("mz", "$infile.display_name"), full_sample_calc_mean) + write.table(full_sample_calc_mean, file="$summarized_mean", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") } #end if @@ -391,14 +392,15 @@ count = count+1 } - rownames(sample_matrix) = mz(msidata) - colnames(sample_matrix) = levels(msidata\$annotation) - write.table(sample_matrix, file="$summarized_output_median", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") + sample_matrix_median = cbind(mz(msidata),sample_matrix) + sample_matrix_median = rbind(c("mz", levels(msidata\$annotation)), sample_matrix_median) + write.table(sample_matrix_median, file="$summarized_median", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") }else{ - full_sample_calc = as.data.frame(apply(spectra(msidata)[],1,median, na.rm=TRUE)) - rownames(full_sample_calc) = mz(msidata) - colnames(full_sample_calc) = "$infile.display_name" - write.table(full_sample_calc, file="$summarized_output_median", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") + + full_sample_calc_median = as.data.frame(apply(spectra(msidata)[],1,median, na.rm=TRUE)) + full_sample_calc_median = cbind(mz(msidata),full_sample_calc_median) + full_sample_calc_median = rbind(c("mz", "$infile.display_name"), full_sample_calc_median) + write.table(full_sample_calc_median, file="$summarized_median", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") } #end if @@ -414,15 +416,15 @@ count = count+1 } - rownames(sample_matrix) = mz(msidata) - colnames(sample_matrix) = levels(msidata\$annotation) - write.table(sample_matrix, file="$summarized_output_sd", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") + sample_matrix_sd = cbind(mz(msidata),sample_matrix) + sample_matrix_sd = rbind(c("mz", levels(msidata\$annotation)), sample_matrix_sd) + write.table(sample_matrix_sd, file="$summarized_sd", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") }else{ - full_sample_calc = as.data.frame(apply(spectra(msidata)[],1,sd, na.rm=TRUE)) - rownames(full_sample_calc) = mz(msidata) - colnames(full_sample_calc) = "$infile.display_name" - write.table(full_sample_calc, file="$summarized_output_sd", quote = FALSE, row.names = TRUE, col.names=NA, sep = "\t") + full_sample_calc_sd = as.data.frame(apply(spectra(msidata)[],1,sd, na.rm=TRUE)) + full_sample_calc_sd = cbind(mz(msidata),full_sample_calc_sd) + full_sample_calc_sd = rbind(c("mz", "$infile.display_name"), full_sample_calc_sd) + write.table(full_sample_calc_sd, file="$summarized_sd", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") } #end if print(paste0("Number of NA in output file: ",sum(is.na(spectra(msidata)[])))) @@ -436,8 +438,8 @@ if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){ spectramatrix = spectra(msidata)[] spectramatrix = cbind(mz(msidata),spectramatrix) - newmatrix = rbind(c("mz | spectra", names(pixels(msidata))), spectramatrix) - write.table(newmatrix, file="$matrixasoutput", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") + newmatrix = rbind(c("mz", names(pixels(msidata))), spectramatrix) + write.table(newmatrix, file="$intensity_matrix", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") }else{ print("file has no features or pixels left") } @@ -517,7 +519,7 @@ - + @@ -529,8 +531,12 @@ - + @@ -540,28 +546,28 @@ - + label="The order of the smoothing filter, must be smaller than window size"/> - - - - + @@ -589,7 +595,7 @@ - @@ -598,7 +604,7 @@ - @@ -673,7 +679,7 @@ - + @@ -708,16 +714,16 @@ - + summary_type and "mean" in summary_type - + summary_type and "median" in summary_type - + summary_type and "sd" in summary_type - + output_matrix @@ -737,7 +743,9 @@ + + @@ -748,6 +756,7 @@ + @@ -777,7 +786,7 @@ - + @@ -811,8 +820,8 @@ - - + + @@ -831,6 +840,7 @@ + @@ -848,7 +858,7 @@ - + @@ -872,7 +882,7 @@ - + diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_mean3.txt --- a/test-data/preprocessing_mean3.txt Wed Aug 22 13:43:04 2018 -0400 +++ b/test-data/preprocessing_mean3.txt Tue Sep 04 13:42:22 2018 -0400 @@ -1,4 +1,4 @@ - Uploaded Composite Dataset (analyze75) +mz Uploaded Composite Dataset (analyze75) 1199.55615234375 3.35218415321305 1200.09387207031 1.08671297501661 1200.59020996094 2.15851707603805 diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_median2.txt --- a/test-data/preprocessing_median2.txt Wed Aug 22 13:43:04 2018 -0400 +++ b/test-data/preprocessing_median2.txt Tue Sep 04 13:42:22 2018 -0400 @@ -1,4 +1,4 @@ - File1 File2 NA +mz File1 File2 NA 101.083335876465 0 0.133186891674995 0.266373783349991 101.666664123535 0 0 0 102.166664123535 0 0 0 diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results1.RData Binary file test-data/preprocessing_results1.RData has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results1.pdf Binary file test-data/preprocessing_results1.pdf has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results1.txt --- a/test-data/preprocessing_results1.txt Wed Aug 22 13:43:04 2018 -0400 +++ b/test-data/preprocessing_results1.txt Tue Sep 04 13:42:22 2018 -0400 @@ -1,3 +1,3 @@ -mz | spectra x = 1, y = 1 x = 2, y = 1 x = 3, y = 1 x = 1, y = 2 x = 2, y = 2 x = 3, y = 2 x = 1, y = 3 x = 2, y = 3 x = 3, y = 3 +mz x = 1, y = 1 x = 2, y = 1 x = 3, y = 1 x = 1, y = 2 x = 2, y = 2 x = 3, y = 2 x = 1, y = 3 x = 2, y = 3 x = 3, y = 3 329 8.48069807321137 6.00276368862812 0 0 7.22240715797167 6.68463797360356 0 0 0 345 0 0 4.70593890744759 0 0 0 5.23000350586712 4.17949067812964 5.08555910047608 diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results2.pdf Binary file test-data/preprocessing_results2.pdf has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results3.RData Binary file test-data/preprocessing_results3.RData has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results3.pdf Binary file test-data/preprocessing_results3.pdf has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results4.RData Binary file test-data/preprocessing_results4.RData has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results4.pdf Binary file test-data/preprocessing_results4.pdf has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results4.txt --- a/test-data/preprocessing_results4.txt Wed Aug 22 13:43:04 2018 -0400 +++ b/test-data/preprocessing_results4.txt Tue Sep 04 13:42:22 2018 -0400 @@ -1,4 +1,4 @@ -mz | spectra x = 1, y = 1 x = 2, y = 1 x = 3, y = 1 x = 1, y = 2 x = 2, y = 2 x = 3, y = 2 x = 1, y = 3 x = 2, y = 3 x = 3, y = 3 +mz x = 1, y = 1 x = 2, y = 1 x = 3, y = 1 x = 1, y = 2 x = 2, y = 2 x = 3, y = 2 x = 1, y = 3 x = 2, y = 3 x = 3, y = 3 1199 1.90173968313755 1.13259535967648 2.08382650993109 2.34349737625869 1.33087314662273 2.14468085106383 3.43161925601751 1.32706902782797 2.22480967308554 1200 1.39388874502695 0.970046951574763 1.52152411836238 1.35619061126081 1.10906095551895 1.66382978723404 2.22846006564551 1.19804842790025 1.7089117778773 1201 1.13095882671438 0.99102093971692 1.23623834616944 1.19344773790952 1.05864909390445 1.31063829787234 1.67396061269147 1.07824358511023 1.28168383340797 diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results5.RData Binary file test-data/preprocessing_results5.RData has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_results5.pdf Binary file test-data/preprocessing_results5.pdf has changed diff -r 4d5578b57a77 -r df8d7f6f210b test-data/preprocessing_sd2.txt --- a/test-data/preprocessing_sd2.txt Wed Aug 22 13:43:04 2018 -0400 +++ b/test-data/preprocessing_sd2.txt Tue Sep 04 13:42:22 2018 -0400 @@ -1,4 +1,4 @@ - File1 File2 NA +mz File1 File2 NA 101.083335876465 0.180910895583245 0.284914371691127 0.358878736172051 101.666664123535 0 0 0 102.166664123535 0 0 0