Mercurial > repos > goeckslab > cell_intensity_processing
comparison process_intensities.xml @ 0:34bb79f271fc draft
planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/mti-utils commit 339f5497446066ca76c27460da2eef4f6e0fa36e
author | goeckslab |
---|---|
date | Thu, 29 Sep 2022 16:53:01 +0000 |
parents | |
children | 7f93f472a242 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:34bb79f271fc |
---|---|
1 <tool id="cell_intensity_processing" name="Process single-cell intensities" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> | |
2 <description>Options to correct for exposure time, autofluorescence subtraction, or compute signal-to-background ratio.</description> | |
3 <macros> | |
4 <import>macros.xml</import> | |
5 </macros> | |
6 <expand macro="requirements" /> | |
7 <command detect_errors="aggressive"><![CDATA[ | |
8 | |
9 ln -s '$quant_table' ./quant.csv && | |
10 | |
11 python '$script' | |
12 | |
13 ]]></command> | |
14 <configfiles> | |
15 <configfile name = "script"> | |
16 import os | |
17 import numpy as np | |
18 import pandas as pd | |
19 | |
20 cwd = os.getcwd() | |
21 quant = pd.read_csv(os.path.join(cwd, 'quant.csv'), index_col = 0) | |
22 marker_df = pd.read_csv('$channel_csv') | |
23 | |
24 markers_to_normalize = marker_df['marker_name'].to_list() | |
25 | |
26 for marker in markers_to_normalize: | |
27 | |
28 #if $exp.exposure == 'correct_exposure': | |
29 exp_time = marker_df.loc[marker_df['marker_name'] == marker, '${exp.exp_col}'].values[0] | |
30 quant[marker] = quant[marker] / exp_time | |
31 #end if | |
32 | |
33 #if $AF_method.select_method == 'dont_adjust': | |
34 pass | |
35 #elif $AF_method.select_method == 'subtract': | |
36 current_AF_channel = marker_df.loc[marker_df['marker_name'] == marker, '${AF_method.AF_col}'].values[0] | |
37 if current_AF_channel in markers_to_normalize: | |
38 quant[marker] = quant[marker] - quant[current_AF_channel] | |
39 quant[marker] = np.where(quant[marker] < 0, 0, quant[marker]) | |
40 #elif $AF_method.select_method == 'SBR': | |
41 current_AF_channel = marker_df.loc[marker_df['marker_name'] == marker, '${AF_method.AF_col}'].values[0] | |
42 if current_AF_channel in markers_to_normalize: | |
43 quant[marker] = quant[marker] / quant[current_AF_channel] | |
44 #end if | |
45 | |
46 quant.to_csv(os.path.join(cwd, 'processed_quant.csv')) | |
47 </configfile> | |
48 </configfiles> | |
49 <inputs> | |
50 <param name="quant_table" type="data" format="csv" label="Input quantification table (csv)" /> | |
51 <param name="channel_csv" type="data" format="csv" label="Channel Metadata (csv)" /> | |
52 <conditional name="exp"> | |
53 <param name="exposure" type="select" label="Select whether to divide intensities by exposure times"> | |
54 <option value="dont_correct_exposure">No exposure correction</option> | |
55 <option value="correct_exposure">Exposure correction</option> | |
56 </param> | |
57 <when value="dont_correct_exposure" /> | |
58 <when value="correct_exposure"> | |
59 <param name="exp_col" type="text" value="exposure_time" label="Name of column in markers file containing exposure times" /> | |
60 </when> | |
61 </conditional> | |
62 <conditional name="AF_method"> | |
63 <param name="select_method" type="select" label="Select method of autofluorescence/background adjustment"> | |
64 <option value="dont_adjust">No AF/background adjustment</option> | |
65 <option value="subtract">Autofluorescence subtraction</option> | |
66 <option value="SBR">Signal-to-background ratio</option> | |
67 </param> | |
68 <when value="dont_adjust" /> | |
69 <when value="subtract"> | |
70 <param name="AF_col" type="text" value="AF_channel" label="Name of column in markers file containing respective AF channel for each marker" /> | |
71 </when> | |
72 <when value="SBR"> | |
73 <param name="AF_col" type="text" value="AF_channel" label="Name of column in markers file containing respective AF channel for each marker" /> | |
74 </when> | |
75 </conditional> | |
76 </inputs> | |
77 <outputs> | |
78 <data name="processed_quant" from_work_dir="processed_quant.csv" format="csv"/> | |
79 </outputs> | |
80 <tests> | |
81 <test> | |
82 <param name="quant_table" value="intensities.csv" /> | |
83 <param name="channel_csv" value="intensity_channels.csv" /> | |
84 <conditional name="exp"> | |
85 <param name="exposure" value="correct_exposure" /> | |
86 </conditional> | |
87 <conditional name="AF_method"> | |
88 <param name="select_method" value="SBR" /> | |
89 </conditional> | |
90 <output name="processed_quant" ftype="csv"> | |
91 <assert_contents> | |
92 <has_n_columns n="15" sep="," /> | |
93 <has_n_lines n="15" /> | |
94 </assert_contents> | |
95 </output> | |
96 </test> | |
97 </tests> | |
98 <help><![CDATA[ | |
99 This tool can be used to perform several different common signal processing operations for single-cell mean marker intensities from multiplex | |
100 tissue imaging data. | |
101 | |
102 **Inputs** | |
103 1. Comma-separated feature observation matrix that is generated by **MCQuant** | |
104 2. Comma-separated channel metadata file that maps marker names to exposure times (optional) and respective AF/bg channels (optional) | |
105 | |
106 **Options** | |
107 1. Exposure correction - Divide single-cell intensities by respective exposure time in channel metadata | |
108 2. Background subtraction - Subtract single-cell mmean marker intensities by respective AF/bg channel mean intensity specified in channel metadata | |
109 3. Signal-to-background ratio - Divide single-cell mmean marker intensities by respective AF/bg channel mean intensity specified in channel metadata | |
110 | |
111 **Outputs** | |
112 1. Feature observation matrix with processed intensities for all markers in channel metadata file. | |
113 CellIDs, centroids, and morphological data remain unchanged. | |
114 ]]></help> | |
115 <expand macro="citations" /> | |
116 </tool> |