annotate msi_qualitycontrol.xml @ 13:88e12d270e35 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
author galaxyp
date Fri, 06 Jul 2018 14:14:09 -0400
parents c43a7821c030
children 7c7c39b9ec4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
1 <tool id="mass_spectrometry_imaging_qc" name="MSI Qualitycontrol" version="1.10.0.4">
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
2 <description>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
3 mass spectrometry imaging QC
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
4 </description>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
5 <requirements>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
6 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
7 <requirement type="package" version="2.2.1">r-ggplot2</requirement>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
8 <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
9 <requirement type="package" version="2.2.1">r-gridextra</requirement>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
10 <requirement type="package" version="2.23_15">r-kernsmooth</requirement>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
11 <requirement type="package" version="0.5.0">r-scales</requirement>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
12 </requirements>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
13 <command detect_errors="exit_code">
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
14 <![CDATA[
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
15 #if $infile.ext == 'imzml'
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
16 ln -s '${infile.extra_files_path}/imzml' infile.imzML &&
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
17 ln -s '${infile.extra_files_path}/ibd' infile.ibd &&
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
18 #elif $infile.ext == 'analyze75'
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
19 ln -s '${infile.extra_files_path}/hdr' infile.hdr &&
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
20 ln -s '${infile.extra_files_path}/img' infile.img &&
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
21 ln -s '${infile.extra_files_path}/t2m' infile.t2m &&
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
22 #else
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
23 ln -s '$infile' infile.RData &&
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
24 #end if
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
25 cat '${cardinal_qualitycontrol_script}' &&
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
26 Rscript '${cardinal_qualitycontrol_script}'
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
27 ]]>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
28 </command>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
29 <configfiles>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
30 <configfile name="cardinal_qualitycontrol_script"><![CDATA[
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
31
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
32 ################################# load libraries and read file #################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
33
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
34 library(Cardinal)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
35 library(ggplot2)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
36 library(RColorBrewer)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
37 library(gridExtra)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
38 library(KernSmooth)
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
39 library(scales)
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
40
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
41
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
42 #if $infile.ext == 'imzml'
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
43 #if str($processed_cond.processed_file) == "processed":
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
44 msidata <- readImzML('infile', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units")
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
45 #else
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
46 msidata <- readImzML('infile')
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
47 #end if
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
48 #elif $infile.ext == 'analyze75'
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
49 msidata = readAnalyze('infile')
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
50 #else
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
51 load('infile.RData')
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
52 #end if
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
53
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
54 ## create full matrix to make processed imzML files compatible with segmentation
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
55 iData(msidata) <- iData(msidata)[]
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
56
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
57 ## remove duplicated coordinates
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
58 print(paste0(sum(duplicated(coord(msidata))), " duplicated coordinates were removed"))
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
59 msidata <- msidata[,!duplicated(coord(msidata))]
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
60
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
61 ###################################### file properties in numbers ######################
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
62
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
63 ## Number of features (m/z)
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
64 maxfeatures = length(features(msidata))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
65 ## Range m/z
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
66 minmz = round(min(mz(msidata)), digits=2)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
67 maxmz = round(max(mz(msidata)), digits=2)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
68 ## Number of spectra (pixels)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
69 pixelcount = length(pixels(msidata))
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
70 ## Range x coordinates
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
71 minimumx = min(coord(msidata)[,1])
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
72 maximumx = max(coord(msidata)[,1])
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
73 ## Range y coordinates
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
74 minimumy = min(coord(msidata)[,2])
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
75 maximumy = max(coord(msidata)[,2])
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
76 ## Range of intensities
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
77 minint = round(min(spectra(msidata)[], na.rm=TRUE), digits=2)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
78 maxint = round(max(spectra(msidata)[], na.rm=TRUE), digits=2)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
79 medint = round(median(spectra(msidata)[], na.rm=TRUE), digits=2)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
80 ## Number of intensities > 0
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
81 npeaks= sum(spectra(msidata)[]>0, na.rm=TRUE)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
82 ## Spectra multiplied with m/z (potential number of peaks)
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
83 numpeaks = ncol(spectra(msidata)[])*nrow(spectra(msidata)[])
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
84 ## Percentage of intensities > 0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
85 percpeaks = round(npeaks/numpeaks*100, digits=2)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
86 ## Number of empty TICs
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
87 TICs = colSums(spectra(msidata)[], na.rm=TRUE)
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
88 NumemptyTIC = sum(TICs == 0)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
89 ## Median TIC
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
90 medTIC = round(median(TICs), digits=2)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
91 ## Median peaks per spectrum
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
92 medpeaks = median(colSums(spectra(msidata)[]>0, na.rm=TRUE), na.rm=TRUE)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
93 print(cor(TICs,colSums(spectra(msidata)[]>0), method="pearson"))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
94
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
95 ## Processing informations
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
96 processinginfo = processingData(msidata)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
97 centroidedinfo = processinginfo@centroided
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
98
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
99 ## if TRUE write processinginfo if FALSE write FALSE
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
100
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
101 ## normalization
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
102 if (length(processinginfo@normalization) == 0) {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
103 normalizationinfo='FALSE'
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
104 } else {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
105 normalizationinfo=processinginfo@normalization
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
106 }
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
107 ## smoothing
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
108 if (length(processinginfo@smoothing) == 0) {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
109 smoothinginfo='FALSE'
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
110 } else {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
111 smoothinginfo=processinginfo@smoothing
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
112 }
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
113 ## baseline
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
114 if (length(processinginfo@baselineReduction) == 0) {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
115 baselinereductioninfo='FALSE'
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
116 } else {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
117 baselinereductioninfo=processinginfo@baselineReduction
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
118 }
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
119 ## peak picking
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
120 if (length(processinginfo@peakPicking) == 0) {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
121 peakpickinginfo='FALSE'
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
122 } else {
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
123 peakpickinginfo=processinginfo@peakPicking
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
124 }
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
125
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
126 ############## Read and filter tabular file with m/z ###########################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
127
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
128 ### reading calibrant file:
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
129
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
130 #if $calibrant_file:
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
131
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
132 calibrant_list = read.delim("$calibrant_file", header = FALSE, na.strings=c("","NA"), stringsAsFactors = FALSE)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
133 if (ncol(calibrant_list) == 1)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
134 {calibrant_list = cbind(calibrant_list, calibrant_list)} ## if there is just one column dublicate it to have a names column
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
135
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
136 ### calculate how many input calibrant m/z are valid:
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
137
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
138 inputcalibrants = calibrant_list[calibrant_list[,1]>minmz & calibrant_list[,1]<maxmz,]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
139 number_calibrants_in = length(calibrant_list[,1])
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
140 number_calibrants_valid = length(inputcalibrants[,1])
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
141
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
142 #else
5
ac786240ef07 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit ed7d3e6f1a09c78c8f71cc1bdc1a20249767f646
galaxyp
parents: 4
diff changeset
143
ac786240ef07 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit ed7d3e6f1a09c78c8f71cc1bdc1a20249767f646
galaxyp
parents: 4
diff changeset
144 inputcalibrants = as.data.frame(matrix(, nrow = 0, ncol = 2))
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
145 number_calibrants_in = 0
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
146 number_calibrants_valid = 0
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
147
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
148 #end if
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
149
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
150 ## rename input dataframe and extract m/z
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
151 colnames(inputcalibrants) = c("m/z", "name")
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
152 inputcalibrantmasses = inputcalibrants[,1]
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
153
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
154
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
155 ######################################## PDF #############################################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
156 ##########################################################################################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
157 ##########################################################################################
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
158
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
159 pdf("qualitycontrol.pdf", fonts = "Times", pointsize = 12)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
160 plot(0,type='n',axes=FALSE,ann=FALSE)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
161
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
162 ## if no filename is given, name of file in Galaxy history is used
5
ac786240ef07 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit ed7d3e6f1a09c78c8f71cc1bdc1a20249767f646
galaxyp
parents: 4
diff changeset
163
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
164 #if not $filename:
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
165 #set $filename = $infile.display_name
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
166 #end if
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
167
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
168 title(main=paste("$filename"))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
169
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
170 ################# I) file properties in numbers ################################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
171 ################################################################################
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
172 print("properties in numbers")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
173
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
174 properties = c("Number of m/z features",
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
175 "Range of m/z values",
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
176 "Number of pixels",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
177 "Range of x coordinates",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
178 "Range of y coordinates",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
179 "Range of intensities",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
180 "Median of intensities",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
181 "Intensities > 0",
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
182 "Number of empty spectra",
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
183 "Median TIC",
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
184 "Median # peaks per spectrum",
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
185 "Normalization",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
186 "Smoothing",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
187 "Baseline reduction",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
188 "Peak picking",
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
189 "Centroided",
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
190 paste0("calibrants (#valid/#input) in \n", "$calibrant_file.display_name"))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
191
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
192 values = c(paste0(maxfeatures),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
193 paste0(minmz, " - ", maxmz),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
194 paste0(pixelcount),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
195 paste0(minimumx, " - ", maximumx),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
196 paste0(minimumy, " - ", maximumy),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
197 paste0(minint, " - ", maxint),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
198 paste0(medint),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
199 paste0(percpeaks, " %"),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
200 paste0(NumemptyTIC),
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
201 paste0(medTIC),
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
202 paste0(medpeaks),
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
203 paste0(normalizationinfo),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
204 paste0(smoothinginfo),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
205 paste0(baselinereductioninfo),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
206 paste0(peakpickinginfo),
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
207 paste0(centroidedinfo),
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
208 paste0(number_calibrants_valid, " / ", number_calibrants_in))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
209
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
210 property_df = data.frame(properties, values)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
211
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
212 grid.table(property_df, rows= NULL)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
213
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
214 ####################### II) x-y images #######################################
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
215 ##############################################################################
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
216 print("x-y images")
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
217
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
218 ## only do plots for file with intensity peaks
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
219 if (npeaks > 0){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
220 ## function for density plots
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
221 plot_colorByDensity = function(x1,x2,
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
222 ylim=c(min(x2),max(x2)),
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
223 xlim=c(min(x1),max(x1)),
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
224 xlab="",ylab="",main=""){
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
225 df = data.frame(x1,x2)
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
226 x = densCols(x1,x2, colramp=colorRampPalette(c("black", "white")))
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
227 df\$dens = col2rgb(x)[1,] + 1L
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
228 cols = colorRampPalette(c("#000099", "#00FEFF", "#45FE4F","#FCFF00", "#FF9400", "#FF3100"))(256)
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
229 df\$col = cols[df\$dens]
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
230 plot(x2~x1, data=df[order(df\$dens),], ylim=ylim,xlim=xlim,pch=20,col=col,
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
231 cex=1,xlab=xlab,ylab=ylab,las=1, main=main)}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
232
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
233 abline_vector= -100000 ## will be filled for samples in case data is combined
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
234
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
235 ## start list for optional spectrum values output
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
236 spectrum_list = list()
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
237 list_count = 1
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
238
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
239 ################### 0) overview for combined data ###########################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
240
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
241 ### only for previously combined data, same plot as in combine QC pdf
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
242
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
243 if (!is.null(levels(msidata\$combined_sample))){
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
244 number_combined = length(levels(msidata\$combined_sample))
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
245
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
246 ## the more combined_samples a file has the smaller will be the legend
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
247 if (number_combined<20){
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
248 legend_size = 10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
249 cex_boxplot = 1
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
250 }else if (number_combined>20 && number_combined<40){
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
251 legend_size = 9
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
252 cex_boxplot = 0.8
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
253 }else if (number_combined>40 && number_combined<60){
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
254 legend_size = 8
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
255 cex_boxplot = 0.6
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
256 }else if (number_combined>60 && number_combined<100){
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
257 legend_size = 7
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
258 cex_boxplot = 0.5
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
259 }else{
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
260 legend_size = 6
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
261 cex_boxplot = 0.3
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
262 }
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
263
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
264 position_df = cbind(coord(msidata)[,1:2], msidata\$combined_sample)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
265 colnames(position_df)[3] = "sample_name"
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
266
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
267 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
268 geom_tile() +
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
269 coord_fixed()+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
270 ggtitle("Spatial orientation of combined data")+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
271 theme_bw()+
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
272 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
273 theme(text=element_text(family="ArialMT", face="bold", size=12))+
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
274 theme(legend.position="bottom",legend.direction="vertical")+
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
275 theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = legend_size))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
276 guides(fill=guide_legend(ncol=5,byrow=TRUE))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
277 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
278 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
279 for(file_count in 1:nrow(coord_labels))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
280 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
281 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
282
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
283 print(combine_plot)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
284
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
285 ### find max pixelnumber per subsample to later draw ablines
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
286 pixel_name_df = data.frame(pixels(msidata), msidata\$combined_sample)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
287 colnames(pixel_name_df) = c("pixel_number", "pixel_name")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
288 last_pixel = aggregate(pixel_number~pixel_name, data = pixel_name_df, max)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
289 pixel_vector = last_pixel[,2]
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
290 abline_vector = pixel_vector[1:number_combined-1]
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
291 print(abline_vector)
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
292 }
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
293
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
294 ################### 1) Pixel order image ###################################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
295
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
296 pixelnumber = 1:pixelcount
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
297 pixelxyarray=cbind(coord(msidata)[,1:2],pixelnumber)
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
298
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
299 print(ggplot(pixelxyarray, aes(x=x, y=y, fill=pixelnumber))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
300 geom_tile() + coord_fixed()+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
301 ggtitle("Pixel order") + theme_bw()+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
302 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
303 theme(text=element_text(family="ArialMT", face="bold", size=12))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
304 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange"),
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
305 space = "Lab", na.value = "black", name = "Pixel\nnumber"))
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
306
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
307 ################ 2) Number of calibrants per spectrum ######################
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
308
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
309 ## matrix with calibrants in columns and in rows if there is peak intensity in range or not
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
310 pixelmatrix = matrix(ncol=ncol(msidata), nrow = 0)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
311
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
312 ## plot only possible when there is at least one valid calibrant
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
313 if (length(inputcalibrantmasses) != 0){
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
314
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
315 ## calculate plusminus values in m/z for each calibrant
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
316 plusminusvalues = rep($plusminus_ppm/1000000, length(inputcalibrantmasses))*inputcalibrantmasses
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
317
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
318 ## filter for m/z window of each calibrant and calculate if sum of peak intensities > 0
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
319 for (mass in 1:length(inputcalibrantmasses)){
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
320
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
321 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],]
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
322
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
323 if (nrow(filtered_data) > 1 & sum(spectra(filtered_data)[],na.rm=TRUE) > 0){
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
324
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
325 ## intensity of all m/z > 0
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
326 intensity_sum = colSums(spectra(filtered_data)[], na.rm=TRUE) > 0
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
327
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
328 }else if(nrow(filtered_data) == 1 & sum(spectra(filtered_data)[], na.rm=TRUE) > 0){
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
329
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
330 ## intensity of only m/z > 0
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
331 intensity_sum = spectra(filtered_data)[] > 0
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
332
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
333 }else{
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
334 intensity_sum = rep(FALSE, ncol(filtered_data))}
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
335
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
336 ## for each pixel add sum of intensity in the given m/z range
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
337 pixelmatrix = rbind(pixelmatrix, intensity_sum)
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
338 }
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
339
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
340 ## for each pixel count TRUE (each calibrant m/z range with intensity > 0 is TRUE)
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
341 countvector= as.factor(colSums(pixelmatrix, na.rm=TRUE))
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
342 countdf= cbind(coord(msidata)[,1:2], countvector) ## add pixel coordinates to counts
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
343 mycolours = c("black","grey", "darkblue", "blue", "green" , "red", "yellow", "magenta", "olivedrab1", "lightseagreen")
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
344
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
345 print(ggplot(countdf, aes(x=x, y=y, fill=countvector))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
346 geom_tile() + coord_fixed() +
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
347 ggtitle(paste0("Number of calibrants per pixel (±",$plusminus_ppm, " ppm)")) +
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
348 theme_bw() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
349 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
350 theme(text=element_text(family="ArialMT", face="bold", size=12))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
351 scale_fill_manual(values = mycolours[1:length(countvector)],
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
352 na.value = "black", name = "# calibrants"))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
353
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
354 ## append list for optional tabular output with spectrum values
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
355 colnames(countdf)[3] = "Number of Calibrants"
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
356 spectrum_list[[list_count]] = countdf
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
357 list_count = list_count+1
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
358
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
359 }else{print("2) The inputcalibrant m/z were not provided or outside the m/z range")}
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
360
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
361 ########################## 3) fold change image ###########################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
362
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
363 #if $calibrantratio:
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
364 #for $foldchanges in $calibrantratio:
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
365 mass1 = $foldchanges.mass1
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
366 mass2 = $foldchanges.mass2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
367 distance = $foldchanges.distance
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
368
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
369 ### if user did not write a label use input m/z as label
3
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
370 #if not str($foldchanges.filenameratioplot).strip():
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
371 #set $label = "Fold change %s Da / %s Da" % ($foldchanges.mass1, $foldchanges.mass2)
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
372 #else:
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
373 #set $label = $foldchanges.filenameratioplot
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
374 #end if
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
375
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
376 ### filter msidata for given m/z range (for both input m/z)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
377 filtered_data1 = msidata[mz(msidata) >= mass1-distance & mz(msidata) <= mass1+distance,]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
378 filtered_data2 = msidata[mz(msidata) >= mass2-distance & mz(msidata) <= mass2+distance,]
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
379
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
380 ### find m/z in the two given ranges with the highest mean intensity
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
381 ### this two m/z will be used to calculate the fold change (red line in plot)
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
382 maxmassrow1 = rowMeans(spectra(filtered_data1), na.rm=TRUE)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
383 maxmass1 = mz(filtered_data1)[which.max(maxmassrow1)]
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
384 maxmassrow2 = rowMeans(spectra(filtered_data2), na.rm=TRUE)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
385 maxmass2 = mz(filtered_data2)[which.max(maxmassrow2)]
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
386
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
387 ### plot legend: chosen value in blue, distance in blue, max m/z in red
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
388 ### m/z range for each plot (fixed range of 5 Da)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
389 ### xlim does not work because it does not adjust for the max. intensities within the range
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
390 mzdown1 = features(msidata, mz = mass1-2)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
391 mzup1 = features(msidata, mz = mass1+3)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
392 mzdown2 = features(msidata, mz = mass2-2)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
393 mzup2 = features(msidata, mz = mass2+3)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
394
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
395 ### plot for first m/z
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
396 par(mfrow=c(2,1), oma=c(0,0,2,0))
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
397 plot(msidata[mzdown1:mzup1,], pixel = 1:pixelcount, main=paste0("average spectrum ", mass1, " Da"))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
398 abline(v=c(mass1-distance, mass1, mass1+distance), col="blue",lty=c(3,6,3))
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
399 abline(v=maxmass1, col="red", lty=5)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
400
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
401 ### plot for second m/z
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
402 plot(msidata[mzdown2:mzup2,], pixel = 1:pixelcount, main= paste0("average spectrum ", mass2, " Da"))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
403 abline(v=c(mass2-distance, mass2, mass2+distance), col="blue", lty=c(3,6,3))
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
404 abline(v=maxmass2, col="red", lty=5)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
405 title("Control of fold change plot", outer=TRUE)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
406
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
407 ### filter spectra for max m/z to have two vectors, which can be divided
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
408 ### plot spatial distribution of fold change
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
409 ### only possible when there are intensities > 0 in both given m/z ranges
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
410
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
411 if (length(maxmass1)>0&length(maxmass2)>0){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
412 mass1vector = spectra(msidata)[features(msidata, mz = maxmass1),]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
413 mass2vector = spectra(msidata)[features(msidata, mz = maxmass2),]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
414 foldchange= log2(mass1vector/mass2vector)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
415 fcmatrix = cbind(foldchange, coord(msidata)[,1:2])
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
416
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
417 print(ggplot(fcmatrix, aes(x=x, y=y, fill=foldchange), colour=colo)+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
418 geom_tile() + coord_fixed()+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
419 ggtitle("$label")+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
420 theme_bw()+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
421 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
422 theme(text=element_text(family="ArialMT", face="bold", size=12))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
423 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
424 ,space = "Lab", na.value = "black", name ="FC"))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
425 }else{
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
426 plot(0,type='n',axes=FALSE,ann=FALSE)
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
427 title(main=paste("At least one m/z range did not contain any intensity > 0,\n therefore no foldchange plot could be drawn"))}
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
428
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
429 #end for
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
430 #end if
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
431
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
432 #################### 4) m/z heatmaps #######################################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
433
3
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
434 par(mfrow=c(1,1), mar=c(5.1, 4.1, 4.1, 2.1), mgp=c(3, 1, 0), las=0)
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
435 if (length(inputcalibrants[,1]) != 0){
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
436 for (mass in 1:length(inputcalibrants[,1])){
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
437
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
438
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
439 image(msidata, mz=inputcalibrants[,1][mass], plusminus=plusminusvalues[mass],
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
440 main= paste0(inputcalibrants[,2][mass], ": ", round(inputcalibrants[,1][mass], digits = 2)," (±",$plusminus_ppm, " ppm)"),
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
441 contrast.enhance = "histogram", ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy))
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
442 }
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
443 } else {print("4) The input peptide and calibrant m/z were not provided or outside the m/z range")}
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
444
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
445 #################### 5) Number of peaks per pixel - image ##################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
446
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
447 ## here every intensity value > 0 counts as pixel
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
448 peaksperpixel = colSums(spectra(msidata)[]> 0, na.rm=TRUE)
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
449 peakscoordarray=cbind(coord(msidata)[,1:2], peaksperpixel)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
450
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
451 print(ggplot(peakscoordarray, aes(x=x, y=y, fill=peaksperpixel), colour=colo)+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
452 geom_tile() + coord_fixed() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
453 ggtitle("Number of peaks per spectrum")+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
454 theme_bw() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
455 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
456 theme(text=element_text(family="ArialMT", face="bold", size=12))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
457 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
458 ,space = "Lab", na.value = "black", name = "# peaks"))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
459
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
460 ## append list for optional tabular output with spectrum values
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
461 colnames(peakscoordarray)[3] = "Number of Peaks"
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
462 spectrum_list[[list_count]] = peakscoordarray
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
463 list_count = list_count+1
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
464
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
465 ############################### 6) TIC image ###############################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
466
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
467 TICcoordarray=cbind(coord(msidata)[,1:2], TICs)
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
468 colo = colorRampPalette(
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
469 c("blue", "cyan", "green", "yellow","red"))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
470 print(ggplot(TICcoordarray, aes(x=x, y=y, fill=TICs), colour=colo)+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
471 geom_tile() + coord_fixed() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
472 ggtitle("Total Ion Chromatogram")+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
473 theme_bw() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
474 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
475 theme(text=element_text(family="ArialMT", face="bold", size=12))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
476 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
477 ,space = "Lab", na.value = "black", name = "TIC"))
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
478
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
479 ## append list for optional tabular output with spectrum values
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
480 colnames(TICcoordarray)[3] = "TIC per spectrum"
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
481 spectrum_list[[list_count]] = TICcoordarray
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
482 list_count = list_count+1
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
483
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
484 ############################### 7) Most abundant m/z image #################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
485
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
486 highestmz = apply(spectra(msidata)[],2,which.max)
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
487 highestmz_matrix = cbind(coord(msidata)[,1:2],mz(msidata)[highestmz])
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
488 colnames(highestmz_matrix)[3] = "highestmzinDa"
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
489
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
490 print(ggplot(highestmz_matrix, aes(x=x, y=y, fill=highestmzinDa))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
491 geom_tile() + coord_fixed() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
492 ggtitle("Most abundant m/z in each spectrum")+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
493 theme_bw() +
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
494 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
495 scale_fill_gradientn(colours = c("blue", "purple" , "red","orange"), space = "Lab", na.value = "black", name = "m/z",
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
496 limits=c(min(highestmz_matrix\$highestmzinDa), max(highestmz_matrix\$highestmzinDa)))+
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
497 theme(text=element_text(family="ArialMT", face="bold", size=12)))
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
498
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
499 ## append list for optional tabular output with spectrum values
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
500 colnames(highestmz_matrix)[3] = "Most abundant m/z"
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
501 spectrum_list[[list_count]] = highestmz_matrix
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
502
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
503 ## tabular output of spectra values
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
504
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
505 #if $pixel_output:
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
506 print("pixel list")
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
507 pixel_df = Reduce(function(...) merge(..., by=c("x", "y"), all=T), spectrum_list)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
508 write.table(pixel_df, file="$pixel_tabular_output", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t")
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
509 #end if
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
510
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
511 ########################## 8) optional pca image for two components #################
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
512
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
513 #if $do_pca:
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
514
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
515 pca = PCA(msidata, ncomp=2)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
516 par(mfrow = c(2,1))
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
517 plot(pca, col=c("black", "darkgrey"), main="PCA for two components")
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
518 image(pca, col=c("black", "white"), strip=FALSE, ylim= c(maximumy+0.2*maximumy,minimumy-0.2*minimumy))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
519
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
520 #end if
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
521
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
522 ################## III) properties over spectra index ##########
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
523 ##############################################################################
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
524 print("properties over pixels")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
525 par(mfrow = c(2,1), mar=c(5,6,4,2))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
526
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
527 ########################## 9) number of peaks per spectrum #################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
528 ## 9a) scatterplot
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
529 plot_colorByDensity(pixels(msidata), peaksperpixel, ylab = "", xlab = "", main="Number of peaks per spectrum")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
530 title(xlab="Spectra index", line=3)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
531 title(ylab="Number of peaks", line=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
532 abline(v=abline_vector, lty = 3)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
533
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
534 ## 9b) histogram
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
535
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
536 hist(peaksperpixel, main="", las=1, xlab = "Number of peaks per spectrum", ylab="")
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
537 title(main="Number of peaks per spectrum", line=2)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
538 title(ylab="Frequency = # spectra", line=4)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
539 abline(v=median(peaksperpixel), col="blue")
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
540
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
541 ## 9c) additional histogram to show subsample contributions
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
542 ## only when samples were combined before (combined_sample)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
543 if (!is.null(levels(msidata\$combined_sample))){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
544
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
545 df_9 = data.frame(peaksperpixel, msidata\$combined_sample)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
546 colnames(df_9) = c("Npeaks", "sample_name")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
547
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
548 hist_9 = ggplot(df_9, aes(x=Npeaks, fill=sample_name)) +
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
549 geom_histogram()+ theme_bw()+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
550 theme(text=element_text(family="ArialMT", face="bold", size=12))+
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
551 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
552 theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = legend_size))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
553 theme(legend.position="bottom",legend.direction="vertical")+
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
554 labs(title="Number of peaks per spectrum and sample", x="Number of peaks per spectrum", y = "Frequency = # spectra") +
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
555 guides(fill=guide_legend(ncol=5,byrow=TRUE))+
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
556 geom_vline(xintercept = median(peaksperpixel), size = 1, colour = "black",linetype = "dashed")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
557 print(hist_9)}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
558
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
559 ########################## 10) TIC per spectrum ###########################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
560
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
561 ## 10a)density scatterplot
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
562 par(mfrow = c(2,1), mar=c(5,6,4,2))
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
563 plot_colorByDensity(pixels(msidata), TICs, ylab = "", xlab = "", main="TIC per spectrum")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
564 title(xlab="Spectra index", line=3)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
565 title(ylab = "Total ion chromatogram intensity", line=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
566 abline(v=abline_vector, lty = 3)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
567
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
568 ## 10b) histogram
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
569 hist(log(TICs), main="", las=1, xlab = "log(TIC per spectrum)", ylab="")
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
570 title(main= "TIC per spectrum", line=2)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
571 title(ylab="Frequency = # spectra", line=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
572 abline(v=median(log(TICs[TICs>0])), col="blue")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
573
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
574 ## 10c) additional histogram to show subsample contributions
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
575 ## only when samples were combined before (combined_sample)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
576 if (!is.null(levels(msidata\$combined_sample))){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
577 df_10 = data.frame(log(TICs), msidata\$combined_sample)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
578 colnames(df_10) = c("TICs", "sample_name")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
579
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
580 hist_10 = ggplot(df_10, aes(x=TICs, fill=sample_name)) +
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
581 geom_histogram()+ theme_bw()+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
582 theme(text=element_text(family="ArialMT", face="bold", size=12))+
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
583 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
584 theme(legend.position="bottom",legend.direction="vertical")+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
585 theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = legend_size))+
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
586 labs(title="TIC per spectrum and sample", x="log(TIC per spectrum)", y = "Frequency = # spectra") +
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
587 guides(fill=guide_legend(ncol=5,byrow=TRUE))+
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
588 geom_vline(xintercept = median(log(TICs[TICs>0])), size = 1, colour = "black",linetype = "dashed")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
589 print(hist_10)}
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
590
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
591 ################################## IV) properties over m/z ####################
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
592 ############################################################################
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
593 print("propverties over m/z")
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
594
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
595 ########################## 11) Histogram on m/z values #####################
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
596
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
597 par(mfrow = c(1, 1), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
598 hist(mz(msidata), xlab = "m/z", main="Histogram of m/z values")
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
599
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
600 ########################## 12) Number of peaks per m/z #####################
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
601
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
602 peakspermz = rowSums(spectra(msidata)[] > 0 )
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
603
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
604 par(mfrow = c(2,1), mar=c(5,6,4,4.5))
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
605 ## 12a) scatterplot
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
606 plot_colorByDensity(mz(msidata),peakspermz, main= "Number of peaks per m/z", ylab ="")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
607 title(xlab="m/z", line=2.5)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
608 title(ylab = "Number of peaks", line=4)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
609 axis(4, at=pretty(peakspermz),labels=as.character(round((pretty(peakspermz)/pixelcount*100), digits=1)), las=1)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
610 mtext("Coverage of spectra [%]", 4, line=3, adj=1)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
611
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
612 ## 12b) histogram
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
613 hist(peakspermz, main="", las=1, ylab="", xlab="")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
614 title(ylab = "Frequency", line=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
615 title(main="Number of peaks per m/z", xlab = "Number of peaks per m/z", line=2)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
616 abline(v=median(peakspermz), col="blue")
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
617
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
618 ########################## 13) Sum of intensities per m/z ##################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
619
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
620 ## Sum of all intensities for each m/z (like TIC, but for m/z instead of pixel)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
621 mzTIC = rowSums(spectra(msidata)[]) ## calculate intensity sum for each m/z
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
622
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
623 par(mfrow = c(2,1), mar=c(5,6,4,2))
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
624 ## 13a) scatterplot
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
625 plot_colorByDensity(mz(msidata),mzTIC, main= "Sum of intensities per m/z", ylab ="")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
626 title(xlab="m/z", line=2.5)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
627 title(ylab="Intensity sum", line=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
628
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
629 ## 13b) histogram
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
630 hist(log(mzTIC), main="", xlab = "", las=1, ylab="")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
631 title(main="Sum of intensities per m/z", line=2, ylab="")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
632 title(xlab = "log (sum of intensities per m/z)")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
633 title(ylab = "Frequency", line=4)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
634 abline(v=median(log(mzTIC[mzTIC>0])), col="blue")
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
635
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
636 ################################## V) intensity plots ########################
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
637 ############################################################################
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
638 print("intensity plots")
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
639 ########################## 14) Intensity distribution ######################
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
640
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
641 par(mfrow = c(2,1), mar=c(5,6,4,2))
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
642
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
643 ## 14a) Median intensity over spectra
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
644 medianint_spectra = apply(spectra(msidata), 2, median)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
645 plot(medianint_spectra, main="Median intensity per spectrum",las=1, xlab="Spectra index", ylab="")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
646 title(ylab="Median spectrum intensity", line=4)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
647 abline(v=abline_vector, lty = 3)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
648
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
649 ## 14b) histogram:
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
650 hist(log2(spectra(msidata)[]), main="", xlab = "", ylab="", las=1)
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
651 title(main="Log2-transformed intensities", line=2)
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
652 title(xlab="log2 intensities")
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
653 title(ylab="Frequency", line=4)
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
654 abline(v=median(log2(spectra(msidata)[(spectra(msidata)>0)])), col="blue")
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
655
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
656 ## 14c) histogram to show subsample contribution
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
657 ## only for previously combined samples
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
658 if (!is.null(levels(msidata\$combined_sample))){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
659
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
660 df_13 = data.frame(matrix(,ncol=2, nrow=0))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
661 for (subsample in levels(msidata\$combined_sample)){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
662 log2_int_subsample = log2(spectra(msidata)[,msidata\$combined_sample==subsample])
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
663 df_subsample = data.frame(as.numeric(log2_int_subsample))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
664 df_subsample\$sample_name = subsample
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
665 df_13 = rbind(df_13, df_subsample)}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
666 df_13\$sample_name = as.factor(df_13\$sample_name)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
667 colnames(df_13) = c("logint", "sample_name")
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
668
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
669 hist_13 = ggplot(df_13, aes(x=logint, fill=sample_name)) +
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
670 geom_histogram()+ theme_bw()+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
671 theme(text=element_text(family="ArialMT", face="bold", size=12))+
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
672 labs(title="Log2-transformed intensities per sample", x="log2 intensities", y = "Frequency") +
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
673 theme(plot.title = element_text(hjust = 0.5))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
674 theme(legend.position="bottom",legend.direction="vertical")+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
675 theme(legend.key.size = unit(0.2, "line"), legend.text = element_text(size = legend_size))+
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
676 guides(fill=guide_legend(ncol=5,byrow=TRUE))+
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
677 geom_vline(xintercept = median(log2(spectra(msidata)[(spectra(msidata)>0)])), size = 1, colour = "black",linetype = "dashed")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
678 print(hist_13)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
679
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
680 ## 14d) boxplots to visualize in a different way the intensity distributions
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
681 par(mfrow = c(1,1), cex.axis=1.3, cex.lab=1.3, mar=c(13.1,4.1,5.1,2.1))
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
682
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
683 mean_matrix = matrix(,ncol=0, nrow = nrow(msidata))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
684 for (subsample in levels(msidata\$combined_sample)){
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
685 mean_mz_sample = rowMeans(spectra(msidata)[,msidata\$combined_sample==subsample])
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
686 mean_matrix = cbind(mean_matrix, mean_mz_sample)}
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
687
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
688 boxplot(log2(mean_matrix), ylab = "log2 mean intensity per m/z", main="Mean intensities per m/z and sample", xaxt = "n")
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
689 (axis(1, at = c(1:number_combined), labels=levels(msidata\$combined_sample), cex.axis=cex_boxplot, las=2))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
690 }
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
691
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
692 ################################## VI) Mass spectra and m/z accuracy ########################
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
693 ############################################################################
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
694 print("Mass spectra and m/z accuracy")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
695
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
696 ############################ 15) Mass spectra ##############################
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
697
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
698 par(mfrow = c(2, 2), cex.axis=1, cex.lab=1, mar=c(5.1,4.1,4.1,2.1))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
699 pixels_for_plot = c(round(length(pixelnumber)/2, , digits=0), round(length(pixelnumber)/4, , digits=0), round(length(pixelnumber)/4*3, , digits=0))
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
700 plot(msidata, pixel = 1:length(pixelnumber), main= "Average spectrum")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
701 plot(msidata, pixel = pixels_for_plot[1], main=paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[1],1:2])))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
702 plot(msidata, pixel = pixels_for_plot[2], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[2],1:2])))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
703 plot(msidata, pixel = pixels_for_plot[3], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[3],1:2])))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
704
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
705 ################### 16) Zoomed in mass spectra for calibrants ##############
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
706
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
707 count = 1
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
708 differencevector = numeric()
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
709 differencevector2 = vector()
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
710
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
711 if (length(inputcalibrantmasses) != 0){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
712
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
713 ### calculate plusminus values in m/z for each calibrant, this is used for all following plots
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
714 plusminusvalues = rep($plusminus_ppm/1000000, length(inputcalibrantmasses)) * inputcalibrantmasses
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
715
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
716 for (mass in 1:length(inputcalibrantmasses)){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
717
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
718 ### define the plot window with xmin und xmax
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
719 minmasspixel = features(msidata, mz=inputcalibrantmasses[mass]-1)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
720 maxmasspixel = features(msidata, mz=inputcalibrantmasses[mass]+3)
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
721
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
722 ### find m/z with the highest mean intensity in m/z range (red line in plot 16) and calculate ppm difference for plot 17
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
723 filtered_data = msidata[mz(msidata) >= inputcalibrantmasses[mass]-plusminusvalues[mass] & mz(msidata) <= inputcalibrantmasses[mass]+plusminusvalues[mass],]
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
724
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
725 if (nrow(filtered_data) > 0 & sum(spectra(filtered_data)) > 0){
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
726 maxmassrow = rowMeans(spectra(filtered_data)) ## for each m/z average intensity is calculated
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
727 maxvalue = mz(filtered_data)[which.max(maxmassrow)] ### m/z with highest average intensity in m/z range
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
728 mzdifference = maxvalue - inputcalibrantmasses[mass] ### difference: theoretical value - closest m/z value
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
729 ppmdifference = mzdifference/inputcalibrantmasses[mass]*1000000 ### calculate ppm for accuracy measurement
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
730 }else{
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
731 ppmdifference = NA
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
732 maxvalue = NA}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
733 differencevector[mass] = round(ppmdifference, digits=2)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
734
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
735 ### find m/z closest to inputcalibrant and calculate ppm difference for plot 18
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
736 mznumber = features(msidata, mz = inputcalibrantmasses[mass]) ### gives featurenumber which is closest to given m/z
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
737 mzvalue = mz(msidata)[mznumber] ### gives closest m/z
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
738 mzdifference2 = mzvalue - inputcalibrantmasses[mass]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
739 ppmdifference2 = mzdifference2/inputcalibrantmasses[mass]*1000000
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
740 differencevector2[mass] = round(ppmdifference2, digits=2)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
741
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
742 par(mfrow = c(2, 2), oma=c(0,0,2,0))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
743 plot(msidata[minmasspixel:maxmasspixel,], pixel = 1:length(pixelnumber), main= "average spectrum")
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
744 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="blue", lty=c(3,5,3))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
745 abline(v=c(maxvalue), col="red", lty=2)
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
746 abline(v=c(mzvalue), col="green2", lty=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
747 plot(msidata[minmasspixel:maxmasspixel,], pixel = pixels_for_plot[1], main=paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[1],1:2])))
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
748 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="blue", lty=c(3,5,3))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
749 abline(v=c(maxvalue), col="red", lty=2)
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
750 abline(v=c(mzvalue), col="green2", lty=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
751 plot(msidata[minmasspixel:maxmasspixel,], pixel = pixels_for_plot[2], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[2],1:2])))
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
752 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="blue", lty=c(3,5,3))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
753 abline(v=c(maxvalue), col="red", lty=2)
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
754 abline(v=c(mzvalue), col="green2", lty=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
755 plot(msidata[minmasspixel:maxmasspixel,], pixel = pixels_for_plot[3], main= paste0("Spectrum at ", rownames(coord(msidata)[pixels_for_plot[3],1:2])))
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
756 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="blue", lty=c(3,5,3))
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
757 abline(v=c(maxvalue), col="red", lty=2)
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
758 abline(v=c(mzvalue), col="green2", lty=4)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
759 title(paste0("theor. m/z: ", inputcalibrants[count,1]), col.main="blue", outer=TRUE, line=0, adj=0.074)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
760 title(paste0("most abundant m/z: ", round(maxvalue, digits=4)), col.main="red", outer=TRUE, line=0, adj=0.49)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
761 title(paste0("closest m/z: ", round(mzvalue, digits=4)), col.main="green2", outer=TRUE, line=0, adj=0.93)
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
762
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
763 ### 16b) one large extra plot with different colours for different samples (for combined_sample only)
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
764
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
765 if (!is.null(levels(msidata\$combined_sample))){
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
766 if (number_combined < 10){
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
767 key_zoomed = TRUE
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
768 }else{key_zoomed = FALSE}
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
769 par(mfrow = c(1, 1))
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
770 plot(msidata[minmasspixel:maxmasspixel,], pixel=1:ncol(msidata),main="Average spectrum per sample",
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
771 pixel.groups=msidata\$combined_sample, key=key_zoomed, col=hue_pal()(number_combined),superpose=TRUE)
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
772 abline(v=c(inputcalibrantmasses[mass] -plusminusvalues[count], inputcalibrantmasses[mass] ,inputcalibrantmasses[mass] +plusminusvalues[count]), col="black", lty=c(3,1,3))
12
c43a7821c030 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a0cadd9fe40da0094dc87bbf5e06a323973a0b42
galaxyp
parents: 11
diff changeset
773 }
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
774 count=count+1
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
775 }
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
776
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
777 ######### 17) ppm difference input calibrant m/z and m/z with max intensity in given m/z range#########
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
778
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
779 ### plot the ppm difference calculated above: theor. m/z value to highest m/z value:
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
780
7
b86a66dd1a16 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 6
diff changeset
781 calibrant_names = as.character(inputcalibrants[,2])
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
782 diff_df = data.frame(differencevector, calibrant_names)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
783
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
784 if (sum(is.na(diff_df[,1])) == nrow(diff_df)){
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
785 plot(0,type='n',axes=FALSE,ann=FALSE)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
786 title(main=paste("plot 17: no peaks in the chosen region, repeat with higher ppm range")) ## here klammer weggenommen...
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
787 }else{
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
788
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
789 diff_plot1=ggplot(data=diff_df, aes(x=calibrant_names, y=differencevector)) + geom_bar(stat="identity", fill = "darkgray") + theme_minimal() +
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
790 labs(title="Average m/z error (max. average intensity vs. theor. calibrant m/z)", x="calibrants", y = "Average m/z error in ppm")+
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
791 theme(plot.title = element_text(hjust = 0.5, size=14))+theme(text=element_text(family="ArialMT", face="bold", size=16))+
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
792 geom_text(aes(label=differencevector), vjust=-0.3, size=5.5, col="blue") +
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
793 theme(axis.text.x = element_text(angle = 90, hjust = 1, size=16))
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
794
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
795 print(diff_plot1)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
796 }
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
797
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
798 ######### 18) ppm difference input calibrant m/z and closest m/z ###########
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
799
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
800 ### plot the ppm difference calculated above theor. m/z value to closest m/z value:
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
801
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
802 differencevector2 = round(differencevector2, digits=2)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
803 calibrant_names = as.character(inputcalibrants[,2])
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
804 diff_df = data.frame(differencevector2, calibrant_names)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
805
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
806 diff_plot2=ggplot(data=diff_df, aes(x=calibrant_names, y=differencevector2)) + geom_bar(stat="identity", fill = "darkgray") + theme_minimal() +
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
807 labs(title="Average m/z error (closest measured m/z vs. theor. calibrant m/z)", x="calibrants", y = "Average m/z error in ppm")+
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
808 theme(plot.title = element_text(hjust = 0.5, size=16))+theme(text=element_text(family="ArialMT", face="bold", size=16))+
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
809 geom_text(aes(label=differencevector2), vjust=-0.3, size=5.5, col="blue")+
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
810 theme(axis.text.x = element_text(angle = 90, hjust = 1, size=16))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
811
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
812 print(diff_plot2)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
813
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
814
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
815 #################### 19) ppm difference over pixels #####################
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
816
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
817 par(mfrow = c(1,1))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
818 mycolours = c("darkgrey", "darkblue", "blue", "green" , "red", "orange", "yellow", "magenta", "olivedrab1", "lightseagreen")
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
819 count = 1
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
820 ppm_df = as.data.frame(matrix(,ncol=0, nrow = ncol(msidata)))
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
821 for (calibrant in inputcalibrantmasses){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
822 ### find m/z with the highest mean intensity in m/z range, if no m/z in the range, all ppm differences will be NA
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
823 filtered_data = msidata[mz(msidata) >= calibrant-plusminusvalues[count] & mz(msidata) <= calibrant+plusminusvalues[count],]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
824
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
825 if (nrow(filtered_data) > 0){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
826 ### filtered for m/z range, now go through it pixel by pixel to find max peak in each spectrum
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
827 ppm_vector = numeric()
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
828 for (pixel_count in 1:ncol(filtered_data)){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
829 mz_max = mz(filtered_data)[which.max(spectra(filtered_data)[,pixel_count])]
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
830
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
831 mzdiff = mz_max - calibrant
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
832 ppmdiff = mzdiff/calibrant*1000000
6
5c63fe03ed9e planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 06c2b45d8644b1d7fc01622a5c59dcbf8886d0f1
galaxyp
parents: 5
diff changeset
833
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
834 ### if maximum intensity in m/z range was 0 set ppm diff to NA (not shown in plot)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
835 if (max(spectra(filtered_data)[,pixel_count]) == 0){
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
836 ppmdiff = NA}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
837 ppm_vector[pixel_count] = ppmdiff}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
838 }else{ppm_vector = rep(NA, ncol(msidata))}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
839
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
840 ppm_df = cbind(ppm_df, ppm_vector)
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
841 count=count+1}
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
842
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
843 if (sum(is.na(ppm_df)) == ncol(ppm_df)*nrow(ppm_df)){
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
844 plot(0,type='n',axes=FALSE,ann=FALSE)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
845 title(main=paste("plot 19: no peaks in the chosen region, repeat with higher ppm range"))
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
846 }else{
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
847
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
848 ### plot ppm differences over pixels (spectra index)
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
849
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
850 par(mar=c(4.1, 4.1, 4.1, 7.5))
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
851 plot(0,0,type="n", ylim=c(min(ppm_df, na.rm=TRUE),max(ppm_df, na.rm=TRUE)), xlim = c(1,ncol(filtered_data)),xlab = "Spectra index", ylab = "m/z difference in ppm", main="Difference m/z with max. average intensity vs. theor. m/z\n(per spectrum)")
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
852
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
853 for (each_cal in 1:ncol(ppm_df)){
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
854 lines(ppm_df[,each_cal], col=mycolours[each_cal], type="p")}
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
855 legend("topright", inset=c(-0.25,0), xpd = TRUE, bty="n", legend=inputcalibrantmasses, col=mycolours[1:ncol(ppm_df)],lty=1)
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
856 abline(v=abline_vector, lty = 3)}
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
857
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
858 }else{print("plot 16+17+18+19) The inputcalibrant m/z were not provided or outside the m/z range")}
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
859 }else{
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
860 print("inputfile has no intensities > 0")
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
861 }
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
862 dev.off()
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
863
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
864
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
865
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
866 ]]></configfile>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
867 </configfiles>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
868 <inputs>
3
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
869 <param name="infile" type="data" format="imzml,rdata,analyze75" label="Inputfile as imzML, Analyze7.5 or Cardinal MSImageSet saved as RData"
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
870 help="Upload composite datatype imzml (ibd+imzML) or analyze75 (hdr+img+t2m) or regular upload .RData (Cardinal MSImageSet)"/>
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
871 <conditional name="processed_cond">
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
872 <param name="processed_file" type="select" label="Is the input file a processed imzML file ">
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
873 <option value="no_processed" selected="True">not a processed imzML</option>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
874 <option value="processed">processed imzML</option>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
875 </param>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
876 <when value="no_processed"/>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
877 <when value="processed">
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
878 <param name="accuracy" type="float" value="50" label="Mass accuracy to which the m/z values will be binned" help="This should be set to the native accuracy of the mass spectrometer, if known"/>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
879 <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm">
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
880 <option value="mz" >mz</option>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
881 <option value="ppm" selected="True" >ppm</option>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
882 </param>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
883 </when>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
884 </conditional>
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
885 <param name="filename" type="text" value="" optional="true" label="Title" help="will appear as header in the quality report, if nothing given input dataset name is used"/>
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
886 <param name="calibrant_file" type="data" optional="true" format="tabular"
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
887 label="File with internal calibrants" help="first column: m/z, second column: name (optional), tabular file"/>
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
888 <param name="plusminus_ppm" value="50" type="float" label="ppm range" help="Will be added in both directions to input calibrant m/z"/>
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
889 <param name="do_pca" type="boolean" display="radio" label="PCA with 2 components"/>
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
890 <repeat name="calibrantratio" title="Plot fold change of two m/z" min="0" max="10">
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
891 <param name="mass1" value="1111" type="float" label="M/z 1" help="First m/z"/>
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
892 <param name="mass2" value="2222" type="float" label="M/z 2" help="Second m/z"/>
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
893 <param name="distance" value="0.25" type="float" label="M/z range" help="Plusminus m/z window added to input m/z. In both m/z ranges the maximum intensity is used to calculate the fold change"/>
3
f6aa0cff777c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit 9f8984da558d0a307fed3ff3af9313829d2e5baa
galaxyp
parents: 2
diff changeset
894 <param name="filenameratioplot" type="text" optional="true" label="Title" help="Optional title for fold change plot."/>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
895 </repeat>
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
896 <param name="pixel_output" type="boolean" display="radio" label="Tabular output with spectra information"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
897 </inputs>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
898 <outputs>
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
899 <data format="pdf" name="plots" from_work_dir="qualitycontrol.pdf" label = "$infile.display_name QC_report"/>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
900 <data format="tabular" name="pixel_tabular_output" label="$infile.display_name spectra information">
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
901 <filter>pixel_output</filter>
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
902 </data>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
903 </outputs>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
904 <tests>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
905 <test expect_num_outputs="2">
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
906 <param name="infile" value="" ftype="imzml">
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
907 <composite_data value="Example_Processed.imzML"/>
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
908 <composite_data value="Example_Processed.ibd"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
909 </param>
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
910 <conditional name="processed_cond">
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
911 <param name="processed_file" value="processed"/>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
912 <param name="accuracy" value="200"/>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
913 <param name="units" value="ppm"/>
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
914 </conditional>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
915 <param name="calibrant_file" value="inputcalibrantfile1.txt"/>
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
916 <param name="plusminus_ppm" value="100"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
917 <param name="filename" value="Testfile_imzml"/>
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
918 <param name="do_pca" value="True"/>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
919 <repeat name="calibrantratio">
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
920 <param name="mass1" value="328.9"/>
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
921 <param name="mass2" value="398.8"/>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
922 <param name="distance" value="0.25"/>
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
923 <param name="filenameratioplot" value = "Ratio of mass1 (328.9) / mass2 (398.8)"/>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
924 </repeat>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
925 <param name="pixel_output" value="True"/>
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
926 <output name="pixel_tabular_output" file="spectra_info_imzml.txt"/>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
927 <output name="plots" file="QC_imzml.pdf" compare="sim_size" delta="20000"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
928 </test>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
929 <test expect_num_outputs="1">
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
930 <param name="infile" value="" ftype="analyze75">
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
931 <composite_data value="Analyze75.hdr"/>
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
932 <composite_data value="Analyze75.img"/>
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
933 <composite_data value="Analyze75.t2m"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
934 </param>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
935 <param name="calibrant_file" value="inputcalibrantfile2.txt"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
936 <param name="filename" value="Testfile_analyze75"/>
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
937 <param name="do_pca" value="True"/>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
938 <output name="plots" file="QC_analyze75.pdf" compare="sim_size" delta="20000"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
939 </test>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
940 <test expect_num_outputs="2">
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
941 <param name="infile" value="123_combined.RData" ftype="rdata"/>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
942 <param name="filename" value="Testfile_rdata"/>
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
943 <param name="do_pca" value="True"/>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
944 <param name="pixel_output" value="True"/>
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
945 <output name="pixel_tabular_output" file="spectra_info_123_combi.txt"/>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
946 <output name="plots" file="QC_rdata.pdf" compare="sim_size" delta="20000"/>
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
947 </test>
10
3eee933c27cf planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 9
diff changeset
948 <test expect_num_outputs="1">
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
949 <param name="infile" value="empty_spectra.rdata" ftype="rdata"/>
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
950 <param name="calibrant_file" value="inputcalibrantfile2.txt"/>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
951 <param name="filename" value="Testfile_rdata"/>
13
88e12d270e35 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 12
diff changeset
952 <param name="do_pca" value="False"/>
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
953 <output name="plots" file="QC_empty_spectra.pdf" compare="sim_size" delta="20000"/>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
954 </test>
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
955 </tests>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
956 <help>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
957 <![CDATA[
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
958 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
959
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
960 This tool uses Cardinal to read files and create a quality control report with descriptive plots for mass spectrometry imaging data.
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
961
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
962 Input data: 3 types of input data can be used:
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
963
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
964 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
965 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
966 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData)
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
967
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
968 Options:
4
fef8bd551236 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit edbf2a6cb50fb04d0db56a7557a64e3bb7a0806a
galaxyp
parents: 3
diff changeset
969
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
970 - internal calibrants are used for m/z heatmaps (x-y grid), heatmap of number of calibrants per spectrum (x-y grid), zoomed in mass spectra, m/z accuracy
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
971 - optional fold change plot: draws a heatmap (x-y grid) for the fold change of two m/z (log2(intensity ratio))
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
972
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
973 Output:
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
974
9
963c7ec00141 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 8
diff changeset
975 - quality control report as pdf with key numbers and descriptive plots describing the mass spectrometry imaging data
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
976 - optional spectra information as tabular file with numbers of calibrants (needs valid calibrants), numbers of peaks, TIC and most abundant m/z in each spectrum
8
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
977
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
978 Tip:
52ef77866de8 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 7
diff changeset
979
11
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
980 - For additional m/z heatmaps use the MSI ion images tool and to plot more mass spectra use the MSI mass spectra tool.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
981
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
982 ----------------------------------------------------------------------------------------------------------------------------------------------------
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
983
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
984 Overview of the QC report plots:
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
985
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
986 - (comb): this plots will only be drawn if several files were combined into one file with the msi_combine tool
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
987 - (cal): this plots will only be drawn if a tabular file with at least one valid calibrant m/z is provided
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
988 - (FC): this plots will only be drawn if the optional fold change image is selected
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
989 - Vertical lines in histograms represent median values. In density scatter plots the colour changes from blue to green, yellow and red the more points are overlayed.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
990
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
991 - Overview of file properties: Numbers and ranges for m/z features and pixels are given. Median and range across all intensity values are provided. Intensities > 0 gives the percentage of m/z-pixel pairs with an intensity above zero. The number of empty spectra (TIC = 0), the median number of peaks (intensities > 0) per spectra as well as the median TIC (total ion chromatogram) are given. The processing status of the file is provided as well as the number of valid calibrants from the provided tabular file.> 0 (Intensities > 0).
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
992
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
993 x-y images (pixel/spectra information):
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
994
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
995 - (comb) Spatial orientation of combined data: All pixels of a combined file have the same colour.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
996 - Pixel order: Shows the order of the pixels in the provided file. Depending on the instrument this can represent the acquisition order.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
997 - (cal) Number of calibrants per pixel: In every spectrum the calibrant m/z window (calibrant m/z plusminus 'ppm range') is searched for peaks (intensity > 0). Calibrants are considered present in a spectrum when they have at least one peak in their m/z window.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
998 - (FC) Control of fold change plot: For both input m/z a zoomed in average spectrum is drawn with the input m/z as blue dashed line, the m/z range as blue dotted lines and the maximum intensity in the m/z window with a red line.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
999 - (FC) Fold change image: For each spectrum the intensities of the two optimal m/z features (red lines in control plots) are divided and log2 transformed to obtain the fold change, which is then plotted as a heatmap.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1000 - (cal) Intensity heatmaps for the m/z value that is closest to the calibrant m/z. The intensities are averaged within the calibrant m/z window (ppm range).
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1001 - Number of peaks per spectrum: For each spectrum the number of m/z values with intensity > 0 is calculated and plotted as heatmap.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1002 - Total ion chromatogram: For each spectrum all intensities are summed up to obtain the TIC which is plotted as heatmap.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1003 - Most abundant m/z in each spectrum: For each spectrum the m/z value with the highest intensity is plotted.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1004 - PCA for two components: Result of a principal component analysis (PCA) for two components is given. The loading plot depicts the contribution of each m/z value and the x-y image represents the differences between the pixels.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1005
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1006 Properties over spectra/pixels:
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1007
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1008 - Number of peaks per spectrum: Scatter plot and histogram showing the number of intensities > 0 for each spectrum. Dotted lines in the scatter plot separate spectra of combined samples.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1009 - (comb) Number of peaks per spectrum and sample: Same histogram as in plot before but with colours to show the contribution of each combined sample.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1010 - TIC per spectrum: Scatter plot and histogram showing the sum of all intensities per spectrum (TIC). Dotted lines in the scatter plot separate spectra of combined samples.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1011 - (comb) TIC per spectrum and sample: Same histogram as in plot before but with colours to show the contribution of each combined sample.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1012
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1013 Properties over m/z features:
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1014
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1015 - Histogram of m/z values: Histogram of all m/z values (complete m/z axis)
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1016 - Number of peaks per m/z: Scatter plot and histogram giving the number of intensities > 0 for each m/z.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1017 - Sum of intensities per m/z: Scatter plot and histogram of the sum of all intensities per m/z.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1018
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1019 Intensity plots:
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1020
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1021 - Median intensity per spectrum: Scatter plot in which each point represents the median intensity for one spectrum. Dotted lines in the scatter plot separate spectra of combined samples.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1022 - Log2-transformed intensities: Histogram of log2-transformed intensities.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1023 - (comb) log2-transformed intensities per sample: Same histogram as before but with colours to show the contribution of each combined sample.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1024 - (comb) Mean intensities per m/z and sample: For all pixels of a sample the mean intensity for each m/z is calculated and shown as boxplot.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1025
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1026 Mass spectra and m/z accuracy:
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1027
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1028 - Mass spectra over the full m/z range: First plot shows the average intensities over all spectra. The other three mass spectra are from single pixels (spectra).
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1029 - (cal) For each calibrant four zoomed in mass spectrum are drawn: The first shows the average intensities over all spectra and the other three are single mass spectra. The theoretical calibrant m/z (taken from the input file) is represented by the dashed blue line. The dotted blue lines show the given ppm range. The green line is the m/z value that is closest to the theoretical calibrant and the red line is the m/z with the highest average intensity in the m/z window.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1030 - (comb) Average spectrum per sample: For each calibrant a zoomed in mass spectrum is plotted this time with the average intensities for each combined sample separately.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1031 - (cal) Difference m/z with max. average intensity vs. theor. calibrant m/z: The difference in ppm between the m/z with the highest average intensity and the theoretical m/z are plotted for each calibrant. This corresponds to the difference between the dashed blue line and the red line in the zoomed in mass spectra.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1032 - (cal) Difference closest measured m/z vs. theor. calibrant m/z: The difference in ppm between the closest m/z value and the theoretical m/z values are plotted for each calibrant. This corresponds to the difference between the dashed blue line and the green line in the zoomed in mass spectra.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1033 - (cal) Difference m/z with max. average intensity vs. theor. m/z (per spectrum): For each spectrum the ppm difference between the m/z with the highest average intensity and the theoretical m/z are plotted. The calibrants have different plotting colours. Dashed lines separate spectra of combined samples.
30d0aabb1b46 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_qualitycontrol commit 6d877681b6188999b4f5abb1843b420078b71b92
galaxyp
parents: 10
diff changeset
1034
0
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1035
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1036 ]]>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1037 </help>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1038 <citations>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1039 <citation type="doi">10.1093/bioinformatics/btv146</citation>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1040 </citations>
845073d506a8 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit fa798afa023eea1cb183c14d0242721b2c696c21
galaxyp
parents:
diff changeset
1041 </tool>
2
1ccbda92b76b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/msi_qualitycontrol commit a8eebad4ad469908f64c25e1e2c705eb637e3cae
galaxyp
parents: 1
diff changeset
1042