annotate msi_combine.xml @ 8:c6564ddf0744 draft default tip

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
author galaxyp
date Tue, 04 Sep 2018 13:42:57 -0400
parents 19d8eee15959
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
1 <tool id="mass_spectrometry_imaging_combine" name="MSI combine" version="1.10.0.6">
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
2 <description>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
3 combine several mass spectrometry imaging datasets into one
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
4 </description>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
5 <requirements>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
6 <requirement type="package" version="1.10.0">bioconductor-cardinal</requirement>
7
19d8eee15959 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5feaf3d0e0da8cef1241fecc1f4d6f81324594e6
galaxyp
parents: 6
diff changeset
7 <requirement type="package" version="3.0.0">r-ggplot2</requirement>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
8 </requirements>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
9 <command detect_errors="exit_code">
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
10 <![CDATA[
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
11 #for $i, $infile in enumerate($infiles):
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
12 #if $infile.ext == 'imzml'
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
13 ln -s '${infile.extra_files_path}/imzml' infile_${i}.imzML &&
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
14 ln -s '${infile.extra_files_path}/ibd' infile_${i}.ibd &&
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
15 #elif $infile.ext == 'analyze75'
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
16 ln -s '${infile.extra_files_path}/hdr' infile_${i}.hdr &&
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
17 ln -s '${infile.extra_files_path}/img' infile_${i}.img &&
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
18 ln -s '${infile.extra_files_path}/t2m' infile_${i}.t2m &&
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
19 #else
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
20 ln -s '$infile' infile_${i}.RData &&
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
21 #end if
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
22 #end for
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
23 #if $annotation_cond.annotation_tabular == 'annotation'
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
24 #for $i, $annotation_file in enumerate($annotation_cond.annotation_files):
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
25 ln -s '$annotation_file' annotation_file_${i}.tabular &&
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
26 #end for
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
27 #end if
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
28
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
29 cat '${msi_combine}' &&
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
30 Rscript '${msi_combine}'
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
31
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
32 ]]>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
33 </command>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
34 <configfiles>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
35 <configfile name="msi_combine"><![CDATA[
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
36
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
37 #import re
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
38
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
39 ################ load libraries and some preparations #################
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
40
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
41 library(Cardinal)
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
42 library(ggplot2)
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
43
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
44 ## read tabular file for xy_shift option
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
45 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
46 input_list = read.delim("$combine_conditional.coordinates_file", header = FALSE,
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
47 stringsAsFactors = FALSE)
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
48 #end if
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
49
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
50 ## function to load RData and store with new variable name
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
51 loadRData <- function(fileName){
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
52 load(fileName)
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
53 get(ls()[ls() != "fileName"])
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
54 }
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
55
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
56 ## preparations for reading files one by one with for loop
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
57 pixel_vector = numeric()
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
58 x_shifts = 0
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
59 y_shifts = 0
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
60 max_y = numeric()
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
61 valid_dataset = logical()
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
62 #set $msidata = []
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
63 #set $pixelcoords = []
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
64 #set $num_infiles = len($infiles)
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
65 all_files = $num_infiles
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
66
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
67
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
68 ############## reading files and changing pixel coordinates ###################
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
69
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
70 #for $i, $infile in enumerate($infiles):
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
71
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
72 ## read and manipulate MSI data
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
73
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
74 #if $infile.ext == 'imzml'
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
75 #if str($processed_cond.processed_file) == "processed":
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
76 msidata_$i <- readImzML('infile_${i}', mass.accuracy=$processed_cond.accuracy, units.accuracy = "$processed_cond.units")
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
77 #else
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
78 msidata_$i <- readImzML('infile_${i}')
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
79 #end if
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
80 #elif $infile.ext == 'analyze75'
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
81 msidata_$i <- readAnalyze('infile_${i}')
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
82 #else
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
83 msidata_$i = loadRData('infile_${i}.RData')
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
84 #end if
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
85
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
86 ## remove duplicated coordinates, otherwise combine will fail
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
87 print(paste0(sum(duplicated(coord(msidata_$i))), " duplicated coordinates were removed from input file"))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
88 msidata_${i} <- msidata_${i}[,!duplicated(coord(msidata_${i}))]
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
89
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
90 ## same name for MSI data files necessary to combine data in one single coordinate system
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
91 sampleNames(msidata_$i) = "msidata"
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
92
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
93
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
94 ## read and process annotation tabular or automatically use name of infile as annotation
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
95
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
96 ## set all pixel annotations to NA, necessary in case files were combined before with different annotations
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
97 msidata_$i\$column1 = rep(NA, ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
98 msidata_$i\$column2 = rep(NA, ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
99 msidata_$i\$column3 = rep(NA, ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
100 msidata_$i\$column4 = rep(NA, ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
101 msidata_$i\$column5 = rep(NA, ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
102 msidata_$i\$combined_sample = rep(NA, ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
103
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
104 #if str($annotation_cond.annotation_tabular) == 'annotation'
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
105 print("annotations")
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
106
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
107 ## read annotation tabular, set first two columns as x and y, merge with coordinates dataframe and order according to pixelorder in msidata
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
108 input_annotation = read.delim("annotation_file_${i}.tabular", header = $annotation_cond.tabular_header, stringsAsFactors = FALSE)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
109
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
110 ## change format x = 1, y = 2 into two columns
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
111 if (class(input_annotation[,1]) == "character"){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
112 annotation_names = colnames(input_annotation[2:ncol(input_annotation)])
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
113 annotation_coordinates = matrix(unlist(strsplit(as.character(input_annotation[,1]), "\\,")), ncol=2, byrow=TRUE)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
114 annotation_coordinates2 = cbind(as.numeric(substring(annotation_coordinates[,1], 5, last = 1000000L)), as.numeric(substring(annotation_coordinates[,2], 5, last = 1000000L)))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
115 input_annotation = cbind(annotation_coordinates2, input_annotation[,-1])
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
116 colnames(input_annotation) = c("x", "y", annotation_names)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
117 }
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
118
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
119 colnames(input_annotation)[1:2] = c("x", "y")
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
120 msidata_coordinates = cbind(coord(msidata_$i)[,1:2], 1:ncol(msidata_$i))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
121 colnames(msidata_coordinates)[3] = "pixel_index"
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
122
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
123 ## only first 5 annotation columns are kept
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
124 if (ncol(input_annotation) > 7){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
125 input_annotation = input_annotation[,1:7]}
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
126
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
127 annotation_df = merge(msidata_coordinates, input_annotation, by=c("x", "y"), all.x=TRUE)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
128 annotation_df_8 = cbind(annotation_df, data.frame(matrix(NA,ncol=8-ncol(annotation_df), nrow=ncol(msidata_$i))))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
129 annotation_df_8_sorted = annotation_df_8[order(annotation_df_8\$pixel_index),]## orders pixel according to msidata
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
130
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
131 ## each annotation column is assigned to the pixel in the pData slot of the MSIdata
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
132 msidata_$i\$column1 = annotation_df_8_sorted[,4]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
133 msidata_$i\$column2 = annotation_df_8_sorted[,5]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
134 msidata_$i\$column3 = annotation_df_8_sorted[,6]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
135 msidata_$i\$column4 = annotation_df_8_sorted[,7]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
136 msidata_$i\$column5 = annotation_df_8_sorted[,8]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
137
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
138 ## extract columnnames from (last) annotation tabular (for QC plot names)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
139 annotation_colnames = colnames(input_annotation)[-c(1,2)]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
140
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
141 #end if
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
142
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
143
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
144 ################### preparation xy shifts ##########################
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
145
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
146 #if str( $combine_conditional.combine_method ) == 'xy_shifts':
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
147
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
148 ## shift coordinates according to input tabular file and store file names
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
149 coord(msidata_$i)\$x = coord(msidata_$i)\$x + input_list[$i+1,$combine_conditional.column_x] ## shifts x coordinates according to tabular file
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
150 coord(msidata_$i)\$y = coord(msidata_$i)\$y + input_list[$i+1,$combine_conditional.column_y] ## shifts y coordinates according to tabular file
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
151 pixel_vector = append(pixel_vector, rep(paste($i+1, input_list[$i+1,$combine_conditional.column_names], sep="_"),times=ncol(msidata_$i))) ## stores file name for each pixel
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
152 msidata_$i\$combined_sample = rep(paste($i+1, input_list[$i+1,$combine_conditional.column_names], sep="_"),times=ncol(msidata_$i))
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
153 pixelcoords_$i = cbind(coord(msidata_$i)[,1:2], rep($i+1,ncol(msidata_$i)))
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
154 #silent $pixelcoords.append('pixelcoords_'+str($i))
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
155 colnames(pixelcoords_$i)[3] = "file_number"
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
156
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
157 ################### preparation automatic combination ##########################
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
158
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
159 #elif str( $combine_conditional.combine_method ) == 'automatic_combine':
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
160
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
161 ## use name of Galaxy inputfile as combined sample annotation
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
162 names_vector = character()
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
163 #set escaped_element_identifier = re.sub('[^\w\-\s\[/]]', '_', str($infile.element_identifier))
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
164 if (sum(spectra(msidata_$i)[],na.rm=TRUE)>0) ## use only valid files
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
165 {
7
19d8eee15959 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5feaf3d0e0da8cef1241fecc1f4d6f81324594e6
galaxyp
parents: 6
diff changeset
166 if (is.null(levels(msidata_$i\$combined_sample)))
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
167 {
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
168 names_vector = append(names_vector, rep(paste($i+1, "$escaped_element_identifier", sep="_"),ncol(msidata_$i)))
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
169 msidata_$i\$combined_sample = as.factor(names_vector)
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
170 }
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
171 }
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
172
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
173 ## Number of input files define grid which is row-wise filled with files
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
174
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
175 coord(msidata_$i)\$x = coord(msidata_$i)\$x - (min(coord(msidata_$i)\$x-1)) + x_shifts
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
176 coord(msidata_$i)\$y = coord(msidata_$i)\$y - (min(coord(msidata_$i)\$y-1)) + y_shifts
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
177 x_shifts = max(coord(msidata_$i)\$x) + 5
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
178 max_y = append(max_y, max(coord(msidata_$i)\$y))
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
179 all_files = $num_infiles
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
180 new_row = ($i+1)/ceiling(sqrt(all_files))
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
181 new_row%%1==0
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
182 if (new_row%%1==0)
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
183 {x_shifts = 0 ### when row is filled: x values start again at zero
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
184 y_shifts = max(max_y) + 5 ### when row is filled: y value increases to start a new row
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
185 max_y = numeric()}
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
186
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
187 #end if
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
188
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
189 ## store files to combine them later and for each file check if it is valid
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
190
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
191 #silent $msidata.append('msidata_'+str($i))
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
192 valid_dataset = append(valid_dataset,
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
193 (ncol(msidata_$i)>0 & nrow(msidata_$i)>0 & sum(spectra(msidata_$i)[], na.rm=TRUE)>0))
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
194
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
195 #end for
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
196
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
197
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
198 ###################### automatic combination ###################################
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
199 ################################################################################
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
200
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
201 #if str( $combine_conditional.combine_method ) == 'automatic_combine':
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
202 print("automatic_combine")
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
203
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
204 ## combine only valid datasets
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
205
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
206 valid_data = list(#echo ','.join($msidata)#)[valid_dataset]
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
207 msidata_combined = do.call(combine, valid_data)
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
208 print("Valid datasets in order of input bottom to top:")
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
209 print(valid_dataset)
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
210
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
211 ## create dataframe with x,y,sample_name and show all pixels in PDF as QC
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
212
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
213 pdf("Combined_qc.pdf", width=15, height=15)
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
214 position_df = cbind(coord(msidata_combined)[,1:2], msidata_combined\$combined_sample)
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
215 colnames(position_df)[3] = "sample_name"
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
216 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
217 geom_tile() +
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
218 coord_fixed()+
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
219 ggtitle("Spatial orientation of combined data (sample names)")+
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
220 theme_bw()+
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
221 theme(text=element_text(family="ArialMT", face="bold", size=15))+
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
222 theme(legend.position="bottom",legend.direction="vertical")+
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
223 guides(fill=guide_legend(ncol=4,byrow=TRUE))
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
224 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean, na.rm=TRUE, na.action="na.pass")
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
225 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
226 for(file_count in 1:nrow(coord_labels))
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
227 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
228 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
229 print(combine_plot)
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
230 dev.off()
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
231
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
232 ## save as (.RData)
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
233
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
234 msidata = msidata_combined
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
235 save(msidata, file="$msidata_combined")
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
236
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
237 ################################## xy shifts ###################################
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
238 ################################################################################
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
239
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
240 #elif str( $combine_conditional.combine_method ) == 'xy_shifts':
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
241 print("xy_shifts")
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
242
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
243 ## in case user made mistake with xy shifts: find duplicated coordinates
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
244 all_coordinates = do.call(rbind, list(#echo ','.join($pixelcoords)#))
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
245 duplicated_coordinates= duplicated(all_coordinates[,1:2])| duplicated(all_coordinates[,1:2], fromLast=TRUE)
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
246 print(paste0("Number of removed duplicated coordinates after combination: ", sum(duplicated_coordinates)/2))
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
247 unique_coordinates = all_coordinates[!duplicated_coordinates,]
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
248
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
249 ## remove duplicated coordinates
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
250 datasetlist = list()
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
251 count = 1
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
252 for (usable_dataset in list(#echo ','.join($msidata)#)){
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
253 pixelsofinterest = pixels(usable_dataset)[names(pixels(usable_dataset)) %in% rownames(unique_coordinates)]
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
254 filtered_dataset = usable_dataset[,pixelsofinterest]
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
255 if (ncol(filtered_dataset) > 0 ){
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
256 datasetlist[[count]] = filtered_dataset}
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
257 count = count +1}
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
258
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
259 msidata_combined = do.call(combine, datasetlist)
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
260
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
261 ## save as (.RData)
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
262
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
263 msidata = msidata_combined
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
264 save(msidata, file="$msidata_combined")
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
265
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
266 ## create x,y,sample_name dataframe for QC pdf
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
267
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
268 position_df = cbind(coord(msidata), msidata\$combined_sample)
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
269 colnames(position_df)[3] = "sample_name"
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
270
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
271 #end if
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
272
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
273
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
274 ################################## outputs ####################################
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
275 ################################################################################
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
276
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
277 ########### QC with pixels and their annotations ################################
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
278
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
279 pdf("Combined_qc.pdf", width=15, height=15)
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
280
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
281 ## combined plot
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
282 combine_plot = ggplot(position_df, aes(x=x, y=y, fill=sample_name))+
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
283 geom_tile() +
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
284 coord_fixed()+
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
285 ggtitle("Spatial orientation of combined data")+
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
286 theme_bw()+
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
287 theme(text=element_text(family="ArialMT", face="bold", size=15))+
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
288 theme(legend.position="bottom",legend.direction="vertical")+
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
289 guides(fill=guide_legend(ncol=5,byrow=TRUE))
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
290 coord_labels = aggregate(cbind(x,y)~sample_name, data=position_df, mean)
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
291 coord_labels\$file_number = gsub( "_.*$", "", coord_labels\$sample_name)
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
292 for(file_count in 1:nrow(coord_labels))
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
293 {combine_plot = combine_plot + annotate("text",x=coord_labels[file_count,"x"],
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
294 y=coord_labels[file_count,"y"],label=toString(coord_labels[file_count,4]))}
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
295 print(combine_plot)
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
296
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
297 #if str($annotation_cond.annotation_tabular) == 'annotation'
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
298
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
299 ## annotation plots
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
300
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
301 ## plot 1
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
302
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
303 column1_df = cbind(coord(msidata), msidata\$column1)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
304 colnames(column1_df)[3] = "column1"
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
305
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
306 if (sum(is.na(column1_df[3])) < nrow(column1_df)){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
307 column1_plot = ggplot(column1_df, aes(x=x, y=y, fill=column1))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
308 geom_tile() +
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
309 coord_fixed()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
310 ggtitle(paste0(annotation_colnames[1]))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
311 theme_bw()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
312 theme(text=element_text(family="ArialMT", face="bold", size=15))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
313 theme(legend.position="bottom",legend.direction="vertical")+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
314 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[1]))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
315 print(column1_plot)}
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
316 ##rename columnname for output tabular file
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
317 colnames(column1_df)[3] = annotation_colnames[1]
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
318
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
319 ## plot 2
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
320 column2_df = cbind(coord(msidata), msidata\$column2)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
321 colnames(column2_df)[3] = "column2"
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
322
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
323 if (sum(is.na(column2_df[3])) < nrow(column2_df)){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
324 column2_plot = ggplot(column2_df, aes(x=x, y=y, fill=column2))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
325 geom_tile() +
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
326 coord_fixed()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
327 ggtitle(paste0(annotation_colnames[2]))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
328 theme_bw()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
329 theme(text=element_text(family="ArialMT", face="bold", size=15))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
330 theme(legend.position="bottom",legend.direction="vertical")+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
331 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[2]))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
332 print(column2_plot)}
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
333 ##rename columnname for output tabular file
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
334 colnames(column2_df)[3] = annotation_colnames[2]
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
335
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
336 ## plot 3
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
337 column3_df = cbind(coord(msidata), msidata\$column3)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
338 colnames(column3_df)[3] = "column3"
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
339 if (sum(is.na(column3_df[3])) < nrow(column3_df)){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
340 column3_plot = ggplot(column3_df, aes(x=x, y=y, fill=column3))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
341 geom_tile() +
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
342 coord_fixed()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
343 ggtitle(paste0(annotation_colnames[3]))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
344 theme_bw()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
345 theme(text=element_text(family="ArialMT", face="bold", size=15))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
346 theme(legend.position="bottom",legend.direction="vertical")+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
347 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[3]))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
348 print(column3_plot)}
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
349 ##rename columnname for output tabular file
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
350 colnames(column3_df)[3] = annotation_colnames[3]
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
351
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
352 ## plot 4
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
353 column4_df = cbind(coord(msidata), msidata\$column4)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
354 colnames(column4_df)[3] = "column4"
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
355
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
356 if (sum(is.na(column4_df[3])) < nrow(column4_df)){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
357 column4_plot = ggplot(column4_df, aes(x=x, y=y, fill=column4))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
358 geom_tile() +
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
359 coord_fixed()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
360 ggtitle(paste0(annotation_colnames[4]))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
361 theme_bw()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
362 theme(text=element_text(family="ArialMT", face="bold", size=15))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
363 theme(legend.position="bottom",legend.direction="vertical")+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
364 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[4]))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
365 print(column4_plot)}
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
366 ##rename columnname for output tabular file
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
367 colnames(column4_df)[3] = annotation_colnames[4]
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
368
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
369 ## plot5
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
370
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
371 column5_df = cbind(coord(msidata), msidata\$column5)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
372 colnames(column5_df)[3] = "column5"
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
373 if (sum(is.na(column5_df[3])) < nrow(column5_df)){
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
374 column5_plot = ggplot(column5_df, aes(x=x, y=y, fill=column5))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
375 geom_tile() +
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
376 coord_fixed()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
377 ggtitle(paste0(annotation_colnames[5]))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
378 theme_bw()+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
379 theme(text=element_text(family="ArialMT", face="bold", size=15))+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
380 theme(legend.position="bottom",legend.direction="vertical")+
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
381 guides(fill=guide_legend(ncol=5,byrow=TRUE, title=annotation_colnames[5]))
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
382 print(column5_plot)}
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
383 ##rename columnname for output tabular file
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
384 colnames(column5_df)[3] = annotation_colnames[5]
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
385
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
386 #end if
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
387
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
388 dev.off()
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
389
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
390 ##################### annotation tabular output ################################
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
391
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
392 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
393
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
394 #if str($annotation_cond.annotation_tabular) == 'no_annotation':
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
395 write.table(position_df, file="$pixel_annotations", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t")
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
396
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
397 #else
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
398 annotation_df_list = list(position_df, column1_df, column2_df, column3_df, column4_df, column5_df)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
399 combined_annotations = Reduce(function(...) merge(..., by=c("x", "y"), all=TRUE), annotation_df_list)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
400 write.table(combined_annotations, file="$pixel_annotations", quote = FALSE, row.names = FALSE, col.names=TRUE, sep = "\t")
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
401
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
402 #end if
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
403
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
404 }else{
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
405 print("No annotation tabular output because file has no features or pixels left")
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
406 }
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
407
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
408 ####################### optional matrix output #################################
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
409
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
410 #if $output_matrix:
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
411
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
412 if (length(features(msidata))> 0 & length(pixels(msidata)) > 0){
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
413 spectramatrix = spectra(msidata)[]
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
414 spectramatrix = cbind(mz(msidata),spectramatrix)
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
415 newmatrix = rbind(c("mz", names(pixels(msidata))), spectramatrix)
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
416 write.table(newmatrix, file="$intensity_matrix", quote = FALSE, row.names = FALSE, col.names=FALSE, sep = "\t")
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
417 }else{
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
418 print("No intensity matrix output because file has no features or pixels left")
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
419 }
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
420
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
421 #end if
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
422
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
423 ]]></configfile>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
424 </configfiles>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
425 <inputs>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
426 <param name="infiles" type="data" multiple="true" format="imzml,rdata,analyze75"
4
d05bd881af3d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 37da74ed68228b16efbdbde776e7c38cc06eb5d5
galaxyp
parents: 3
diff changeset
427 label="MSI data as imzml, analyze7.5 or Cardinal MSImageSet saved as RData"
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
428 help="load imzml and ibd file by uploading composite datatype imzml"/>
5
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
429 <conditional name="processed_cond">
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
430 <param name="processed_file" type="select" label="Is the input file a processed imzML file ">
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
431 <option value="no_processed" selected="True">not a processed imzML</option>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
432 <option value="processed">processed imzML</option>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
433 </param>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
434 <when value="no_processed"/>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
435 <when value="processed">
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
436 <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"/>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
437 <param name="units" display="radio" type="select" label="Unit of the mass accuracy" help="either m/z or ppm">
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
438 <option value="mz" >mz</option>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
439 <option value="ppm" selected="True" >ppm</option>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
440 </param>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
441 </when>
ff91e78b5c5c planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 8087490eb4dcaf4ead0f03eae4126780d21e5503
galaxyp
parents: 4
diff changeset
442 </conditional>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
443 <conditional name="annotation_cond">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
444 <param name="annotation_tabular" type="select" label="Optional annotation of pixels with tabular files">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
445 <option value="no_annotation" selected="True">no annotation</option>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
446 <option value="annotation">pixel annotations</option>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
447 </param>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
448 <when value="no_annotation"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
449 <when value="annotation">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
450 <param name="annotation_files" type="data" multiple="true" format="tabular"
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
451 label="Pixel annotations tabular files"
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
452 help="Same number and order of files as input files. Coordinates in column 1 in format x = 1, y = 1 or first column x values, second column y values. Up to 5 columns with pixel annotations"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
453 <param name="tabular_header" type="boolean" label="Tabular files contain a header line" truevalue="TRUE" falsevalue="FALSE"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
454 </when>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
455 </conditional>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
456 <conditional name="combine_conditional">
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
457 <param name="combine_method" type="select" label="Way of combining multiple files">
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
458 <option value="automatic_combine" selected="True" >automatic combination</option>
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
459 <option value="xy_shifts">shift xy coordinates with a tabular file</option>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
460 </param>
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
461 <when value="automatic_combine"/>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
462 <when value="xy_shifts">
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
463 <param name="coordinates_file" type="data" format="tabular" label="datasetnames, x and y values to shift pixel coordinates before combining"
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
464 help="Tabular file with three columns: 1 for the filename, 1 for the x-coordinate shift and 1 for the y-coordinate shift. Pixels with the same coordinates after shifting will be deleted."/>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
465 <param name="column_x" data_ref="coordinates_file" label="Column with values for shift in x direction" type="data_column"/>
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
466 <param name="column_y" data_ref="coordinates_file" label="Column with values for shift in y direction" type="data_column"/>
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
467 <param name="column_names" data_ref="coordinates_file" label="Column with dataset names" type="data_column"/>
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
468 </when>
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
469 </conditional>
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
470 <param name="output_matrix" type="boolean" display="radio" label="Intensity matrix output"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
471 </inputs>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
472 <outputs>
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
473 <data format="rdata" name="msidata_combined" label="MSI_data_combined"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
474 <data format="pdf" name="QC_overview" from_work_dir="Combined_qc.pdf" label = "Combined_QC"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
475 <data format="tabular" name="pixel_annotations" label="Combined_pixel_annotations"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
476 <data format="tabular" name="intensity_matrix" label="Combined_matrix">
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
477 <filter>output_matrix</filter>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
478 </data>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
479 </outputs>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
480 <tests>
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
481 <test expect_num_outputs="4">
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
482 <param name="infiles" value="msidata_1.RData,msidata_2.RData,msidata_3.RData" ftype="rdata"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
483 <conditional name="annotation_cond">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
484 <param name="annotation_tabular" value="annotation"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
485 <param name="annotation_files" value="annotations_file1.tabular,annotations_file2.tabular,annotations_file3.tabular" ftype="tabular"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
486 <param name="tabular_header" value="TRUE"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
487 </conditional>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
488 <param name="combine_method" value="xy_shifts"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
489 <param name="coordinates_file" ftype="tabular" value="xy_coordinates.tabular"/>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
490 <param name="column_x" value="1"/>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
491 <param name="column_y" value="2"/>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
492 <param name="column_names" value="3"/>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
493 <param name="output_matrix" value="True"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
494 <output name="intensity_matrix" file="123_combined_matrix.tabular"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
495 <output name="pixel_annotations" file="123_annotation_output.tabular"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
496 <output name="msidata_combined" file="123_combined.RData" compare="sim_size" />
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
497 <output name="QC_overview" file="123_combined_QC.pdf" compare="sim_size" delta="2000"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
498 </test>
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
499 <test expect_num_outputs="4">
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
500 <param name="infiles" value="msidata_1.RData,msidata_2.RData" ftype="rdata"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
501 <conditional name="annotation_cond">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
502 <param name="annotation_tabular" value="annotation"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
503 <param name="annotation_files" value="annotations_file1.tabular,annotations_file2.tabular" ftype="tabular"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
504 <param name="tabular_header" value="TRUE"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
505 </conditional>
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
506 <param name="combine_method" value="automatic_combine"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
507 <param name="output_matrix" value="True"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
508 <output name="intensity_matrix" file="12_combined_matrix.tabular"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
509 <output name="pixel_annotations" file="12_annotation_output.tabular"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
510 <output name="msidata_combined" file="12_combined.RData" compare="sim_size" />
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
511 <output name="QC_overview" file="12_combined_QC.pdf" compare="sim_size" delta="2000"/>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
512 </test>
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
513 <test expect_num_outputs="3">
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
514 <param name="infiles" value="msidata_1.RData,123_combined.RData" ftype="rdata"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
515 <conditional name="annotation_cond">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
516 <param name="annotation_tabular" value="annotation"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
517 <param name="annotation_files" value="annotations_file1.tabular,123_annotation.tabular" ftype="tabular"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
518 <param name="tabular_header" value="TRUE"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
519 </conditional>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
520 <param name="combine_method" value="automatic_combine"/>
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
521 <param name="output_matrix" value="False"/>
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
522 <output name="pixel_annotations" file="112_annotation_output.tabular"/>
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
523 <output name="msidata_combined" file="112_auto_combined.RData" compare="sim_size" />
8
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
524 <output name="QC_overview" file="112_auto_combined_QC.pdf" compare="sim_size" delta="2000"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
525 </test>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
526 <test expect_num_outputs="3">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
527 <param name="infiles" value="msidata_2.RData,123_combined.RData" ftype="rdata"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
528 <conditional name="annotation_cond">
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
529 <param name="annotation_tabular" value="no_annotation"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
530 </conditional>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
531 <param name="combine_method" value="automatic_combine"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
532 <param name="output_matrix" value="False"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
533 <output name="pixel_annotations" file="2123_annotation_output.tabular"/>
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
534 <output name="msidata_combined" file="2123_auto_combined.RData" compare="sim_size" />
c6564ddf0744 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit e87eea03505ab1ba067e192bbbcdc6197dc4b42e
galaxyp
parents: 7
diff changeset
535 <output name="QC_overview" file="2123_auto_combined_QC.pdf" compare="sim_size" delta="2000"/>
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
536 </test>
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
537 </tests>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
538 <help>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
539 <![CDATA[
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
540
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
541 Cardinal is an R package that implements statistical & computational tools for analyzing mass spectrometry imaging datasets. `More information on Cardinal <http://cardinalmsi.org//>`_
1
f3f6c32ab690 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit dd64f41874a56c4e2619bf58ae3681d806cf9b3f
galaxyp
parents: 0
diff changeset
542
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
543 This tool uses the Cardinal combine function to combine several mass spectrometry imaging data.
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
544
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
545 Input data: 3 types of input data can be used:
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
546
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
547 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
548 - Analyze7.5 (upload hdr, img and t2m file via the "composite" function)
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
549 - Cardinal "MSImageSet" data (with variable name "msidata", saved as .RData)
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
550
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
551
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
552 Input:
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
553
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
554 - MSI data files with same m/z values (to obtain same m/z values for different files: filtering tool same m/z range and preprocessing tool same binning width)
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
555 - Tabular files with pixel annotations need to have the x values in the first column, y values in the second column and then up to five annotations in the next columns. The order of the annotations in the columns must be the same for all files (x and y in column 1 and 2; annotation1 in column3, annotation2 in column4,...)
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
556 - The order and the number of MSI data files and annotation tabular files must be the same
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
557 - For xy shifts with tabular file: Tabular file with x and y coordinates shift and file name (see below)
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
558
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
559 Options:
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
560
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
561 - "automatic combination": files are automatically arranged in a grid (duplicated pixels are allowed), subfiles are named according to the input file name
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
562 - "xy shifts by hand": each file can be moved in x and y direction according to the users need (define one tabular file in the order in which the files are loaded in the history (bottom to top) and define for each file the x and y coordinates shifts in separate columns and the file name in a third column). The xy shift option combines all datasets and removes all duplicated pixels (same x and y coordinates).
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
563
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
564
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
565 Output:
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
566
6
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
567 - single imzML file
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
568 - pdf that shows the pixel positions and annotations of the combined files
f4aafc565aa3 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 5bceedc3a11c950790692a4c64bbb83d46897bee
galaxyp
parents: 5
diff changeset
569 - Tabular file with pixel annotations (x,y,column with input file names, up to five annotation columns)
3
91bba2486773 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit a7be47698f53eb4f00961192327d93e8989276a7
galaxyp
parents: 2
diff changeset
570 - optional: intensity matrix as tabular file (intensities for m/z in rows and pixel in columns)
2
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
571
00b6c61f5054 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1c808d60243bb1eeda0cd26cb4b0a17ab05de2c0
galaxyp
parents: 1
diff changeset
572
0
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
573 ]]>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
574 </help>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
575 <citations>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
576 <citation type="doi">10.1093/bioinformatics/btv146</citation>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
577 </citations>
9cbcf48bf60a planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/msi_combine commit 1e5a87e56e09f01087844f8d2c95002455b1d89d
galaxyp
parents:
diff changeset
578 </tool>