Mercurial > repos > galaxyp > cardinal_preprocessing
changeset 3:f172efe92629 draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/cardinal commit 2c4a1a862900b4efbc30824cbcb798f835b168b2
line wrap: on
line diff
--- a/preprocessing.xml Fri Feb 15 10:22:14 2019 -0500 +++ b/preprocessing.xml Thu Feb 28 09:27:06 2019 -0500 @@ -60,7 +60,13 @@ maxmz = round(max(mz(msidata)), digits=2) QC_numbers= data.frame(inputdata = c(minmz, maxmz,maxfeatures, pixelcount)) vectorofactions = "inputdata" - plot(msidata, pixel = 1:pixelcount, main="Average spectrum of input file") + ## Choose random spectra for QC plots + random_spectra = sample(pixels(msidata), 4, replace=FALSE) + par(mfrow = c(2, 2), oma=c(0,0,2,0)) + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Input spectra", outer=TRUE, line=0) + ############################### Preprocessing steps ########################### ############################################################################### @@ -84,7 +90,10 @@ normalized = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, normalized) vectorofactions = append(vectorofactions, "normalized") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after normalization") + par(mfrow = c(2, 2), oma=c(0,0,2,0)) + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after normalization", outer=TRUE, line=0) ############################### Baseline reduction ########################### @@ -103,7 +112,9 @@ baseline = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, baseline) vectorofactions = append(vectorofactions, "baseline red.") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after baseline reduction") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after baseline reduction", outer=TRUE, line=0) ############################### Smoothing ########################### @@ -136,7 +147,9 @@ smoothed = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, smoothed) vectorofactions = append(vectorofactions, "smoothed") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after smoothing") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after smoothing", outer=TRUE, line=0) ############################### Peak picking ########################### @@ -170,7 +183,9 @@ picked = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, picked) vectorofactions = append(vectorofactions, "picked") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after peak picking") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after peak picking", outer=TRUE, line=0) ############################### Peak alignment ########################### @@ -184,8 +199,8 @@ #elif str( $method.methods_conditional.align_ref_type.align_reference_datatype) == 'align_table': - align_reference_table = read.delim("$method.methods_conditional.align_ref_type.mz_tabular", header = $method.methods_conditional.align_ref_type.align_mass_header, stringsAsFactors = FALSE) - align_reference_column = align_reference_table[,$method.methods_conditional.align_ref_type.align_mass_column] + align_reference_table = read.delim("$method.methods_conditional.align_ref_type.mz_tabular", header = $method.methods_conditional.align_ref_type.feature_header, stringsAsFactors = FALSE) + align_reference_column = align_reference_table[,$method.methods_conditional.align_ref_type.feature_column] align_peak_reference = align_reference_column[align_reference_column>=min(mz(msidata)) & align_reference_column<=max(mz(msidata))] if (length(align_peak_reference) == 0) {align_peak_reference = 0} @@ -217,7 +232,9 @@ aligned = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, aligned) vectorofactions = append(vectorofactions, "aligned") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after alignment") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after alignment", outer=TRUE, line=0) ############################### Peak filtering ########################### @@ -235,7 +252,9 @@ filtered = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, filtered) vectorofactions = append(vectorofactions, "filtered") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after filtering") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after filtering", outer=TRUE, line=0) ############################### Data reduction ########################### @@ -266,8 +285,8 @@ #if str( $method.methods_conditional.methods_for_reduction.ref_type.reference_datatype) == 'table': - reference_table = read.delim("$method.methods_conditional.methods_for_reduction.ref_type.mz_tabular", header = $method.methods_conditional.methods_for_reduction.ref_type.mass_header, stringsAsFactors = FALSE) - reference_column = reference_table[,$method.methods_conditional.methods_for_reduction.ref_type.mass_column] + reference_table = read.delim("$method.methods_conditional.methods_for_reduction.ref_type.mz_tabular", header = $method.methods_conditional.methods_for_reduction.ref_type.feature_header, stringsAsFactors = FALSE) + reference_column = reference_table[,$method.methods_conditional.methods_for_reduction.ref_type.feature_column] peak_reference = reference_column[reference_column>min(mz(msidata)) & reference_column<max(mz(msidata))] #elif str( $method.methods_conditional.methods_for_reduction.ref_type.reference_datatype) == 'msidata_ref': @@ -287,7 +306,9 @@ reduced = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, reduced) vectorofactions = append(vectorofactions, "reduced") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after data reduction") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after data reduction", outer=TRUE, line=0) ############################### Transformation ########################### @@ -328,7 +349,9 @@ transformed = c(minmz, maxmz,maxfeatures, pixelcount) QC_numbers= cbind(QC_numbers, transformed) vectorofactions = append(vectorofactions, "transformed") - plot(msidata, pixel = 1:pixelcount, main="Average spectrum after transformation") + for (random_sample in 1:length(random_spectra)){ + plot(msidata, pixel=random_spectra[random_sample], main=paste0("spectrum ", names(random_spectra)[random_sample]))} + title("Spectra after transformation", outer=TRUE, line=0) #end if #end for @@ -340,6 +363,9 @@ #if str($imzml_output) == "imzml_format": if (nrow(msidata) > 0){ + ## make sure that coordinates are integers + coord(msidata)\$y = as.integer(coord(msidata)\$y) + coord(msidata)\$x = as.integer(coord(msidata)\$x) writeImzML(msidata, "out")} #elif str($imzml_output) == "rdata_format": ## save as (.RData) @@ -443,7 +469,7 @@ label="diff.max" help="Peaks that differ less than this value will be aligned together"/> <param name="units_diffalignment" type="select" display="radio" optional="False" label="units"> <option value="ppm" selected="True">ppm</option> - <option value="Da">m/z</option> + <option value="mz">m/z</option> </param> </when> <when value="DP">
--- a/test-data/preprocessing_results1.imzml Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results1.imzml Thu Feb 28 09:27:06 2019 -0500 @@ -9,8 +9,8 @@ <fileContent> <cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" /> <cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" /> - <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{002DF5BA-0549-44DF-A8BB-27DA3E197EB7}" /> - <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="0379019A6F9D0B55F9217420030633F7163AF9D3" /> + <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{728FBFFE-E6FC-4283-8068-393A66F6BD5C}" /> + <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="375094460F3B80674CB2F541DCD9928B3D61B2FF" /> <cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" /> </fileContent> </fileDescription>
--- a/test-data/preprocessing_results1.imzml.txt Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results1.imzml.txt Thu Feb 28 09:27:06 2019 -0500 @@ -1,4 +1,4 @@ imzML file: total 24 --rw-r--r-- 1 meli meli 96 Feb 12 21:24 ibd --rw-r--r-- 1 meli meli 16714 Feb 12 21:24 imzml +-rw-r--r-- 1 meli meli 96 Feb 24 14:11 ibd +-rw-r--r-- 1 meli meli 16714 Feb 24 14:11 imzml
--- a/test-data/preprocessing_results2.imzml Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results2.imzml Thu Feb 28 09:27:06 2019 -0500 @@ -9,8 +9,8 @@ <fileContent> <cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" /> <cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" /> - <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{84BEACDD-B841-4730-81A0-A19A28C7B48A}" /> - <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="1BC49DCCC566E7A6938CE3DE62090650C2A04798" /> + <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{40F230A1-1893-4A8C-BAE2-A8BBEF24DB20}" /> + <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="417ADF38FBC4D0304A9B75B4C85799137846DD2F" /> <cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" /> </fileContent> </fileDescription>
--- a/test-data/preprocessing_results2.imzml.txt Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results2.imzml.txt Thu Feb 28 09:27:06 2019 -0500 @@ -1,4 +1,4 @@ imzML file: total 80 --rw-r--r-- 1 meli meli 54720 Feb 12 21:25 ibd --rw-r--r-- 1 meli meli 21132 Feb 12 21:25 imzml +-rw-r--r-- 1 meli meli 54720 Feb 24 14:12 ibd +-rw-r--r-- 1 meli meli 21132 Feb 24 14:12 imzml
--- a/test-data/preprocessing_results3.imzml Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results3.imzml Thu Feb 28 09:27:06 2019 -0500 @@ -9,8 +9,8 @@ <fileContent> <cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" /> <cvParam cvRef="MS" accession="MS:1000127" name="centroid spectrum" value="" /> - <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{4C387879-DE12-49A4-878F-6980D6F7C6F0}" /> - <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="94ED775BCF16644D23DACFCA1E62D28D5C755178" /> + <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{D767424F-5E74-45AB-AF1B-0D25244B435B}" /> + <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="445E32981D0B3D08ED2BA74E11500A3A08CDB9B7" /> <cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" /> </fileContent> </fileDescription>
--- a/test-data/preprocessing_results3.imzml.txt Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results3.imzml.txt Thu Feb 28 09:27:06 2019 -0500 @@ -1,4 +1,4 @@ imzML file: total 36 --rw-r--r-- 1 meli meli 14216 Feb 12 21:26 ibd --rw-r--r-- 1 meli meli 16824 Feb 12 21:26 imzml +-rw-r--r-- 1 meli meli 14216 Feb 24 14:12 ibd +-rw-r--r-- 1 meli meli 16824 Feb 24 14:12 imzml
--- a/test-data/preprocessing_results4.imzml Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results4.imzml Thu Feb 28 09:27:06 2019 -0500 @@ -9,8 +9,8 @@ <fileContent> <cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value="" /> <cvParam cvRef="MS" accession="MS:1000128" name="profile spectrum" value="" /> - <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{26018306-9D72-49F5-89CB-68E4DDE0527C}" /> - <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="BA6411EC5A5A59ABE5BD7005F4ED8FCEBA775A8E" /> + <cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="{FE932E04-42E4-4D89-B721-2A6CE83250B6}" /> + <cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="36C7C916C176DD85CBBF4B7FA969C92B9403768D" /> <cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" /> </fileContent> </fileDescription>
--- a/test-data/preprocessing_results4.imzml.txt Fri Feb 15 10:22:14 2019 -0500 +++ b/test-data/preprocessing_results4.imzml.txt Thu Feb 28 09:27:06 2019 -0500 @@ -1,4 +1,4 @@ imzML file: total 28 --rw-r--r-- 1 meli meli 6376 Feb 12 21:29 ibd --rw-r--r-- 1 meli meli 16801 Feb 12 21:29 imzml +-rw-r--r-- 1 meli meli 6376 Feb 24 14:13 ibd +-rw-r--r-- 1 meli meli 16801 Feb 24 14:13 imzml