comparison data_exporter.xml @ 17:56da27be956a draft default tip

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 91e77c139cb3b7c6d67727dc39140dd79355fa0c
author galaxyp
date Thu, 04 Jul 2024 13:34:08 +0000
parents b6a4dd06cde0
children
comparison
equal deleted inserted replaced
16:bb6397b94018 17:56da27be956a
1 <tool id="cardinal_data_exporter" name="MSI data exporter" version="@VERSION@.0"> 1 <tool id="cardinal_data_exporter" name="MSI data exporter" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="22.05">
2 <description> 2 <description>
3 exports imzML and Analyze7.5 to tabular files 3 exports imzML and Analyze7.5 to tabular files
4 </description> 4 </description>
5 <macros> 5 <macros>
6 <import>macros.xml</import> 6 <import>macros.xml</import>
100 ## calculate mean per annotation group 100 ## calculate mean per annotation group
101 sample_matrix = matrix(,ncol=0, nrow=nrow(msidata)) 101 sample_matrix = matrix(,ncol=0, nrow=nrow(msidata))
102 count = 1 102 count = 1
103 for (subsample in levels(msidata\$annotation)){ 103 for (subsample in levels(msidata\$annotation)){
104 subsample_pixels = msidata[,msidata\$annotation == subsample] 104 subsample_pixels = msidata[,msidata\$annotation == subsample]
105 subsample_calc = rowMeans(spectra(subsample_pixels), na.rm=TRUE) 105 subsample_calc = rowMeans(as.matrix(spectra(subsample_pixels)), na.rm=TRUE)
106 sample_matrix = cbind(sample_matrix, subsample_calc) 106 sample_matrix = cbind(sample_matrix, subsample_calc)
107 count = count+1} 107 count = count+1}
108 sample_matrix_mean = cbind(mz_names,sample_matrix) 108 sample_matrix_mean = cbind(mz_names,sample_matrix)
109 sample_matrix_mean = rbind(c("mz_name", levels(msidata\$annotation)), sample_matrix_mean) 109 sample_matrix_mean = rbind(c("mz_name", levels(msidata\$annotation)), sample_matrix_mean)
110 write.table(sample_matrix_mean, file="$summarized_mean", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") 110 write.table(sample_matrix_mean, file="$summarized_mean", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
115 115
116 sample_matrix = matrix(,ncol=0, nrow=nrow(msidata)) 116 sample_matrix = matrix(,ncol=0, nrow=nrow(msidata))
117 count = 1 117 count = 1
118 for (subsample in levels(msidata\$annotation)){ 118 for (subsample in levels(msidata\$annotation)){
119 subsample_pixels = msidata[,msidata\$annotation == subsample] 119 subsample_pixels = msidata[,msidata\$annotation == subsample]
120 subsample_calc = apply(spectra(subsample_pixels),1,median, na.rm=TRUE) 120 subsample_calc = apply(as.matrix(spectra(subsample_pixels)),1,median, na.rm=TRUE)
121 sample_matrix = cbind(sample_matrix, subsample_calc) 121 sample_matrix = cbind(sample_matrix, subsample_calc)
122 count = count+1} 122 count = count+1}
123 sample_matrix_median = cbind(mz_names,sample_matrix) 123 sample_matrix_median = cbind(mz_names,sample_matrix)
124 sample_matrix_median = rbind(c("mz name", levels(msidata\$annotation)), sample_matrix_median) 124 sample_matrix_median = rbind(c("mz name", levels(msidata\$annotation)), sample_matrix_median)
125 write.table(sample_matrix_median, file="$summarized_median", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t") 125 write.table(sample_matrix_median, file="$summarized_median", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
188 188
189 ## filter for m/z window of each calibrant and calculate if sum of peak intensities > 0 189 ## filter for m/z window of each calibrant and calculate if sum of peak intensities > 0
190 190
191 for (mass in 1:length(inputcalibrantmasses)){ 191 for (mass in 1:length(inputcalibrantmasses)){
192 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],] 192 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],]
193 if (nrow(filtered_data) > 1 & sum(spectra(filtered_data),na.rm=TRUE) > 0){ 193 if (nrow(filtered_data) > 1 & sum(as.matrix(spectra(filtered_data)), na.rm=TRUE) > 0){
194 ## intensity of all m/z > 0 194 ## intensity of all m/z > 0
195 intensity_sum = colSums(spectra(filtered_data), na.rm=TRUE) > 0 195 intensity_sum = colSums(as.matrix(spectra(filtered_data)), na.rm=TRUE) > 0
196 196
197 }else if(nrow(filtered_data) == 1 & sum(spectra(filtered_data), na.rm=TRUE) > 0){ 197 }else if(nrow(filtered_data) == 1 & sum(as.matrix(spectra(filtered_data)), na.rm=TRUE) > 0){
198 ## intensity of only m/z > 0 198 ## intensity of only m/z > 0
199 intensity_sum = spectra(filtered_data) > 0 199 intensity_sum = as.matrix(spectra(filtered_data)) > 0
200 }else{ 200 }else{
201 intensity_sum = rep(FALSE, ncol(filtered_data))} 201 intensity_sum = rep(FALSE, ncol(filtered_data))}
202 ## for each pixel add sum of intensities > 0 in the given m/z range 202 ## for each pixel add sum of intensities > 0 in the given m/z range
203 pixelmatrix = rbind(pixelmatrix, intensity_sum) 203 pixelmatrix = rbind(pixelmatrix, intensity_sum)
204 } 204 }
341 <param name="mz_tabular" ftype="tabular" value = "featuresofinterest5.tabular"/> 341 <param name="mz_tabular" ftype="tabular" value = "featuresofinterest5.tabular"/>
342 <param name="feature_column" value="1"/> 342 <param name="feature_column" value="1"/>
343 <param name="feature_header" value="False"/> 343 <param name="feature_header" value="False"/>
344 <param name="plusminus_ppm" value="200"/> 344 <param name="plusminus_ppm" value="200"/>
345 </conditional> 345 </conditional>
346 <output name="feature_output" file="features_out4.tabular"/> 346 <output name="feature_output">
347 <assert_contents>
348 <has_text text="100.120072029209"/>
349 </assert_contents>
350 </output>
347 <output name="pixel_output" file="pixel_out4.tabular"/> 351 <output name="pixel_output" file="pixel_out4.tabular"/>
348 </test> 352 </test>
349 </tests> 353 </tests>
350 <help> 354 <help>
351 <![CDATA[ 355 <![CDATA[