changeset 15:accf9fb6ea01 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:32:56 +0000
parents f1897eb07081
children 798da6bdff3d
files macros.xml preprocessing.xml test-data/QC_imzml_shortreport.pdf test-data/pixels_test6.tabular test-data/preprocessing_results4.ibd test-data/preprocessing_results4.imzml test-data/preprocessing_results4.imzml.txt test-data/preprocessing_results4.pdf test-data/test1.pdf test-data/test2.pdf test-data/test3.pdf test-data/test4.pdf test-data/test5.pdf test-data/test6.pdf test-data/test6.rdata test-data/test7.pdf test-data/test7.rdata
diffstat 17 files changed, 93 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Wed Dec 23 22:32:19 2020 +0000
+++ b/macros.xml	Sun Aug 29 07:32:56 2021 +0000
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@VERSION@">2.6.0</token>
+    <token name="@VERSION@">2.10.0</token>
 
     <xml name="requirements">
         <requirements>
--- a/preprocessing.xml	Wed Dec 23 22:32:19 2020 +0000
+++ b/preprocessing.xml	Sun Aug 29 07:32:56 2021 +0000
@@ -1,4 +1,4 @@
-<tool id="cardinal_preprocessing" name="MSI preprocessing" version="@VERSION@.2">
+<tool id="cardinal_preprocessing" name="MSI preprocessing" version="@VERSION@.0">
     <description>
         mass spectrometry imaging preprocessing
     </description>
@@ -7,7 +7,7 @@
     </macros>
     <expand macro="requirements">
         <requirement type="package" version="2.3">r-gridextra</requirement>
-        <requirement type="package" version="3.3.2">r-ggplot2</requirement>
+        <requirement type="package" version="3.3.5">r-ggplot2</requirement>
     </expand>
     <command detect_errors="exit_code">
     <![CDATA[
@@ -204,6 +204,35 @@
             vectorofactions = append(vectorofactions, "mz aligned")
             print(plot(msidata, pixel=random_spectra, col="black"))
             title("Spectra after m/z alignment", outer=TRUE, line=0)
+            
+          
+    ############################### Mz recalibration ###########################
+
+        #elif str( $method.methods_conditional.preprocessing_method ) == 'mz_recalibration':
+            print('m/z recalibration')
+            ## M/z recalibration
+
+            reference_mz = read.delim("$method.methods_conditional.mz_tabular", header = $method.methods_conditional.feature_header, stringsAsFactors = FALSE)
+            reference_mz = reference_mz[,$method.methods_conditional.feature_column]
+
+            msidata = mzAlign(msidata, ref=reference_mz, tolerance = $method.methods_conditional.alignment_tol, units = "$method.methods_conditional.alignment_units", quantile = $method.methods_conditional.quantile, span = $method.methods_conditional.span)
+
+            msidata <- process(msidata, BPPARAM=MulticoreParam(workers=number_cpu))
+            
+            ## remove the reference peaks data to allow proper peak alignment afterwards
+            metadata(featureData(msidata))['reference peaks'] <- NULL
+
+            ############################### QC ###########################
+
+            maxfeatures =nrow(msidata)
+            pixelcount = ncol(msidata)
+            minmz = round(min(mz(msidata)), digits=2)
+            maxmz = round(max(mz(msidata)), digits=2)
+            mz_recal = c(minmz, maxmz,maxfeatures, pixelcount)
+            QC_numbers= cbind(QC_numbers, mz_recal)
+            vectorofactions = append(vectorofactions, "mz recalibrated")
+            print(plot(msidata, pixel=random_spectra, col="black"))
+            title("Spectra after m/z recalibration", outer=TRUE, line=0)      
 
 
     ############################### Peak picking ###########################
@@ -456,6 +485,7 @@
                     <option value="Baseline_reduction">Baseline Reduction</option>
                     <option value="Smoothing">Peak smoothing</option>
                     <option value="mz_alignment">m/z alignment</option>
+                    <option value="mz_recalibration">m/z recalibration</option>
                     <option value="Peak_picking">Peak picking</option>
                     <option value="Peak_alignment">Peak alignment</option>
                     <option value="Peak_filtering">Peak filtering</option>
@@ -534,6 +564,26 @@
                     <param name="span" type="float" value="0.75"
                         label="span" help="The smoothing parameter for the local polynomial regression used to determine the warping function."/>
                 </when>
+	        <when value="mz_recalibration">
+		    <param name="alignment_tol" type="text" value="NA"
+		           label="tolerance" help="The tolerance to be used when matching the peaks in the unaligned spectra to the reference spectrum. If this is NA, then automatically guess a tolerance from the data.">
+		       <sanitizer>
+		            <valid initial="string.digits">
+		                <add value="N" />
+		                <add value="A" />
+		            </valid>
+		        </sanitizer>
+		    </param>
+		    <param name="alignment_units" type="select" display="radio" optional="False" label="The units to use for the tolerance.">
+		            <option value="ppm" selected="True">ppm</option>
+		            <option value="mz">m/z</option>
+		    </param>
+		    <expand macro="reading_1_column_mz_tabular" label="Tabular file with m/z features to use for alignment. Only the m/z values from the tabular file will be kept."/>
+		    <param name="quantile" type="float" value="0.2"
+		        label="quantile" help="The top quantile of reference points (peaks detected via local maxima) to use from the reference spectrum."/>
+		    <param name="span" type="float" value="0.75"
+		        label="span" help="The smoothing parameter for the local polynomial regression used to determine the warping function."/>
+		</when>
                 <when value="Peak_picking">
                     <param name="SNR_picking_method" type="float" value="6"
                         label="Signal to noise ratio"
@@ -773,6 +823,16 @@
             </repeat>
             <repeat name="methods">
                 <conditional name="methods_conditional">
+                    <param name="preprocessing_method" value="mz_recalibration"/>                   
+                    <param name="alignment_tol" value="2"/>
+                    <param name="alignment_units" value="ppm"/>
+                    <param name="mz_tabular" value="inputcalibrantfile2.txt" ftype="tabular"/>
+                    <param name="feature_column" value="1"/>
+                    <param name="feature_header" value="TRUE"/>
+                </conditional>
+            </repeat>
+            <repeat name="methods">
+                <conditional name="methods_conditional">
                     <param name="preprocessing_method" value="Mass_binning"/>
                         <param name="bin_width" value="0.1"/>
                         <param name="bin_units" value="mz"/>
Binary file test-data/QC_imzml_shortreport.pdf has changed
--- a/test-data/pixels_test6.tabular	Wed Dec 23 22:32:19 2020 +0000
+++ b/test-data/pixels_test6.tabular	Sun Aug 29 07:32:56 2021 +0000
@@ -1,25 +1,25 @@
-pixel names	x	y	predicted condition
-xy_1_1	1	1	A
-xy_2_1	2	1	A
-xy_3_1	3	1	B
-xy_4_1	4	1	C
-xy_1_2	1	2	C
-xy_2_2	2	2	C
-xy_3_2	3	2	A
-xy_4_2	4	2	A
-xy_1_3	1	3	A
-xy_2_3	2	3	B
-xy_3_3	3	3	C
-xy_4_3	4	3	A
-xy_10_1	10	1	C
-xy_11_1	11	1	C
-xy_12_1	12	1	C
-xy_13_1	13	1	B
-xy_10_2	10	2	C
-xy_11_2	11	2	B
-xy_12_2	12	2	C
-xy_13_2	13	2	C
-xy_10_3	10	3	C
-xy_11_3	11	3	C
-xy_12_3	12	3	B
-xy_13_3	13	3	C
+pixel names	x	y	predicted condition	A	B	C
+xy_1_1	1	1	A	0.434439526064797	0.195646317191818	0.369914156743386
+xy_2_1	2	1	A	0.38219998209377	0.242372158141275	0.375427859764956
+xy_3_1	3	1	B	0.312531499299517	0.385612104162858	0.301856396537625
+xy_4_1	4	1	C	0.393153488582866	0.191107087820634	0.4157394235965
+xy_1_2	1	2	C	0.366986470447772	0.216121568441093	0.416891961111135
+xy_2_2	2	2	C	0.381682206547616	0.213188918797062	0.405128874655322
+xy_3_2	3	2	A	0.376695037169723	0.260689491088564	0.362615471741713
+xy_4_2	4	2	A	0.42305935188829	0.174038449100755	0.402902199010954
+xy_1_3	1	3	A	0.382420991383021	0.249364697048677	0.368214311568302
+xy_2_3	2	3	B	0.272145998315727	0.446525938567718	0.281328063116555
+xy_3_3	3	3	C	0.36296987427851	0.255631013944556	0.381399111776934
+xy_4_3	4	3	A	0.444812272103175	0.132274264153212	0.422913463743613
+xy_10_1	10	1	C	0.376216993893763	0.227584528606788	0.39619847749945
+xy_11_1	11	1	C	0.358430578177403	0.236120068794936	0.405449353027661
+xy_12_1	12	1	C	0.359751662628136	0.218620985552221	0.421627351819643
+xy_13_1	13	1	B	0.101486342705225	0.813997511218961	0.0845161460758142
+xy_10_2	10	2	C	0.354612526523361	0.272635192773437	0.372752280703202
+xy_11_2	11	2	B	0.291635599769993	0.444466545540823	0.263897854689184
+xy_12_2	12	2	C	0.36763798979782	0.203911653614431	0.428450356587749
+xy_13_2	13	2	C	0.344608135177236	0.304026642707691	0.351365222115073
+xy_10_3	10	3	C	0.37046458150651	0.205561286708086	0.423974131785404
+xy_11_3	11	3	C	0.358113833435286	0.262878459144526	0.379007707420187
+xy_12_3	12	3	B	0.180921926305915	0.66902588624642	0.150052187447665
+xy_13_3	13	3	C	0.378266307042675	0.20859472985319	0.413138963104135
Binary file test-data/preprocessing_results4.ibd has changed
--- a/test-data/preprocessing_results4.imzml	Wed Dec 23 22:32:19 2020 +0000
+++ b/test-data/preprocessing_results4.imzml	Sun Aug 29 07:32:56 2021 +0000
@@ -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="48842eaf-40e5-4a3f-831c-2d7a3b7e04b9" />
-			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="2010ba5b7d44695d891cfe3b6674a5699fa610c0" />
+			<cvParam cvRef="IMS" accession="IMS:1000080" name="universally unique identifier" value="04431b64-9f3d-44b4-9e63-81b9e4924aec" />
+			<cvParam cvRef="IMS" accession="IMS:1000091" name="ibd SHA-1" value="38a4fadd32374bdf0e4b2bb7d976f6067d542a29" />
 			<cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value="" />
 		</fileContent>
 	</fileDescription>
@@ -42,7 +42,7 @@
 		</sample>
 	</sampleList>
 	<softwareList count="1">
-		<software id="Cardinal" version="2.6.0">
+		<software id="Cardinal" version="2.10.0">
 			<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
 		</software>
 	</softwareList>
--- a/test-data/preprocessing_results4.imzml.txt	Wed Dec 23 22:32:19 2020 +0000
+++ b/test-data/preprocessing_results4.imzml.txt	Sun Aug 29 07:32:56 2021 +0000
@@ -1,4 +1,4 @@
 imzML file:
 total 84
--rw-rw-r-- 1 meli meli 62696 Oct  5 19:58 ibd
--rw-rw-r-- 1 meli meli 18199 Oct  5 19:58 imzml
+-rw-rw-r-- 1 meli meli 62696 Aug 28 16:41 ibd
+-rw-rw-r-- 1 meli meli 18200 Aug 28 16:41 imzml
Binary file test-data/preprocessing_results4.pdf has changed
Binary file test-data/test1.pdf has changed
Binary file test-data/test2.pdf has changed
Binary file test-data/test3.pdf has changed
Binary file test-data/test4.pdf has changed
Binary file test-data/test5.pdf has changed
Binary file test-data/test6.pdf has changed
Binary file test-data/test6.rdata has changed
Binary file test-data/test7.pdf has changed
Binary file test-data/test7.rdata has changed