comparison deconvolve.xml @ 0:4f6d716e5da2 draft

planemo upload for repository https://github.com/goeckslab/tools-st/tree/main/tools/bayesTME commit 26edd05a863adac97cb54a9fb2ae5613ce95df50
author goeckslab
date Wed, 03 Dec 2025 19:49:22 +0000
parents
children 8139addbe3c3
comparison
equal deleted inserted replaced
-1:000000000000 0:4f6d716e5da2
1 <tool id="bayestme_deconvolve" name="BayesTME: Deconvolve" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>Reference-free and Reference-based Spot Deconvolution for Spatial Transcriptomics with BayesTME</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="bayestme_requirements"/>
7 <command detect_errors="aggressive"><![CDATA[
8
9 ## Filtering Step (optional)
10 #if str($filter_genes.pre_filter) == 'filter_genes':
11
12 filter_genes
13 --adata '${adata}'
14 --output 'dataset_filtered.h5ad'
15 --n-top-by-standard-deviation '${n_top_by_standard_deviation}'
16 #if str($spot_threshold)
17 --spot-threshold '${spot_threshold}'
18 #end if
19 #if $filter_ribosomal_genes
20 --filter-ribosomal-genes
21 #end if
22 #if $mode.deconv_mode == 'reference_based'
23 --expression-truth '${mode.expression_truth}'
24 #end if
25 #if $verbose
26 -v
27 #end if
28 &&
29 #else
30
31 ## Just use unfiltered
32 ln -s '${adata}' 'dataset_filtered.h5ad' &&
33
34 #end if
35
36 ## Deconvolve Step
37 deconvolve
38 --adata 'dataset_filtered.h5ad'
39 --adata-output 'dataset_deconvolved.h5ad'
40 --output 'deconvolution_samples.h5'
41 #if $mode.deconv_mode == 'reference_free'
42 --n-components '${mode.n_components}'
43 #end if
44 #if $mode.deconv_mode == 'reference_based'
45 --expression-truth '${mode.expression_truth}'
46 --reference-scrna-celltype-column '${mode.reference_scrna_celltype_column}'
47 --reference-scrna-sample-column '${mode.reference_scrna_sample_column}'
48 #end if
49 --spatial-smoothing-parameter '${deconv_params.spatial_smoothing_parameter}'
50 --n-samples '${deconv_params.n_samples}'
51 --n-svi-steps '${deconv_params.n_svi_steps}'
52 #if $deconv_params.use_spatial_guide
53 --use-spatial-guide
54 #else
55 --no-use-spatial-guide
56 #end if
57 #if $additional_cli.verbose
58 -v
59 #end if
60 #if str($additional_cli.seed)
61 --seed '${additional_cli.seed}'
62 #end if
63
64 ]]></command>
65
66 <inputs>
67
68 <!-- Required Input ST Data -->
69 <param argument="--adata" type="data" format="h5ad" label="Input AnnData in h5 format, expected to be already bleed corrected"/>
70
71 <!-- Filter Genes Options (from macros) -->
72 <conditional name="filter_genes">
73 <param name="pre_filter" type="select" label="Optional: Filter Genes By Spatial Variance Prior To Deconvolution" >
74 <option value="no_filtering" selected="true">No Filtering</option>
75 <option value="filter_genes">Filter Genes Prior To Deconvolution</option>
76 </param>
77 <when value="no_filtering">
78 </when>
79 <when value="filter_genes">
80 <expand macro="filter_genes_options" />
81 </when>
82 </conditional>
83
84 <!-- Deconvolution Strategy -->
85 <conditional name="mode">
86
87 <param name="deconv_mode" type="select" label="Deconvolution Strategy">
88 <option value="reference_free" selected="true">Reference-free (unsupervised)</option>
89 <option value="reference_based">Reference-based (with scRNA reference)</option>
90 </param>
91
92 <!-- Reference-free: Specify Number of Cell Types -->
93 <when value="reference_free">
94 <param argument="--n-components" type="integer" optional="false" label="Number of cell types to deconvolve into"/>
95 </when>
96
97 <!-- Reference-based: Provide scRNA Ref -->
98 <when value="reference_based">
99 <param argument="--expression-truth" type="data" format="h5ad" optional="true" label="Matched scRNA data in h5ad format, will be used to enforce a prior on celltypes and expression"/>
100 <param argument="--reference-scrna-celltype-column" type="text" label="The name of the column with celltype id in the matched scRNA anndata"/>
101 <param argument="--reference-scrna-sample-column" type="text" label="The name of the column with sample id in the matched scRNA anndata"/>
102 </when>
103
104 </conditional>
105
106 <!-- Deconvolution Parameters -->
107 <section name="deconv_params" title="Deconvolution Parameters" expanded="false">
108 <param argument="--spatial-smoothing-parameter" type="float" value="0.5" label="Spatial smoothing parameter (referred to as lambda in paper)"/>
109 <param argument="--n-samples" type="integer" value="100" label="Number of samples from the posterior distribution or variational family"/>
110 <param argument="--n-svi-steps" type="integer" value="20000" label="Number of steps for fitting variational family"/>
111 <param name="use_spatial_guide" argument="--use-spatial-guide, --no-use-spatial-guide" type="boolean" checked="true" label="Use spatial guide (variational family with spatial priors) for SVI"/>
112 </section>
113
114 <!-- Additional CLI Options -->
115 <section name="additional_cli" title="Additional Arguments" expanded="false">
116 <param argument="--seed" type="integer" optional="true" label="Seed value for random number generator"/>
117 <param argument="--verbose" type="boolean" checked="false" label="Enable verbose logging"/>
118 </section>
119
120 </inputs>
121
122 <outputs>
123 <data name="adata_output" format="h5ad" label="BayesTME Deconvolve on ${on_string}: dataset_deconvolved.h5ad" from_work_dir="dataset_deconvolved.h5ad"/>
124 <data name="output" format="h5" label="BayesTME Deconvolve on ${on_string}: deconvolution_samples.h5" from_work_dir="deconvolution_samples.h5"/>
125 <data name="deconvolution_loss" format="pdf" label="BayesTME Deconvolve on ${on_string}: deconvolution_loss.pdf" from_work_dir="deconvolution_loss.pdf"/>
126 </outputs>
127
128 <tests>
129
130 <!-- Reference-free Deconvolution Test -->
131 <test>
132 <param name="adata" value="visium_test_dataset.h5ad"/>
133 <conditional name="mode" >
134 <param name="deconv_mode" value="reference_free"/>
135 <param name="n_components" value="3"/>
136 </conditional>
137 <section name="deconv_params" >
138 <param name="spatial_smoothing_parameter" value="0.5"/>
139 <param name="n_samples" value="10"/>
140 <param name="n_svi_steps" value="10"/>
141 </section>
142 <section name="additional_cli" >
143 <param name="seed" value="93"/>
144 </section>
145 <conditional name="filter_genes" >
146 <param name="pre_filter" value="filter_genes"/>
147 <param name="n_top_by_standard_deviation" value="40"/>
148 <section name="additional_filtering_options" >
149 <param name="filter_ribosomal_genes" value="true"/>
150 </section>
151 </conditional>
152 <output name="adata_output" file="refFree_test_data/dataset_deconvolved.h5ad" compare="sim_size" delta="20000">
153 <assert_contents>
154 <has_h5_keys keys="obsm/bayestme_cell_type_counts,obsm/bayestme_cell_type_probabilities,varm/bayestme_omega,varm/bayestme_omega_difference,varm/bayestme_relative_expression,varm/bayestme_relative_mean_expression,uns/bayestme_n_cell_types"/>
155 </assert_contents>
156 </output>
157 <output name="output" file="refFree_test_data/deconvolution_samples.h5" compare="sim_size" delta="500000">
158 <assert_contents>
159 <has_h5_keys keys="beta_trace,cell_num_total_trace,cell_prob_trace,expression_trace,losses,reads_trace"/>
160 </assert_contents>
161 </output>
162 <output name="deconvolution_loss" file="refFree_test_data/deconvolution_loss.pdf" compare="sim_size" delta="20000" ftype="pdf"/>
163 </test>
164
165 <!-- Reference-based Deconvolution Test -->
166 <test>
167 <param name="adata" value="visium_test_dataset.h5ad"/>
168 <conditional name="mode" >
169 <param name="deconv_mode" value="reference_based"/>
170 <param name="expression_truth" value="refBased_test_data/scRef_test_dataset.h5ad"/>
171 <param name="reference_scrna_celltype_column" value="cell_type"/>
172 <param name="reference_scrna_sample_column" value="donor_id"/>
173 </conditional>
174 <section name="deconv_params" >
175 <param name="spatial_smoothing_parameter" value="0.5"/>
176 <param name="n_samples" value="10"/>
177 <param name="n_svi_steps" value="10"/>
178 </section>
179 <section name="additional_cli" >
180 <param name="seed" value="93"/>
181 </section>
182 <conditional name="filter_genes" >
183 <param name="pre_filter" value="filter_genes"/>
184 <param name="n_top_by_standard_deviation" value="40"/>
185 <section name="additional_filtering_options" >
186 <param name="filter_ribosomal_genes" value="true"/>
187 </section>
188 </conditional>
189 <output name="adata_output" file="refBased_test_data/dataset_deconvolved.h5ad" compare="sim_size" delta="20000">
190 <assert_contents>
191 <has_h5_keys keys="obsm/bayestme_cell_type_counts,obsm/bayestme_cell_type_probabilities,varm/bayestme_omega,varm/bayestme_omega_difference,varm/bayestme_relative_expression,varm/bayestme_relative_mean_expression,uns/bayestme_n_cell_types"/>
192 </assert_contents>
193 </output>
194 <output name="output" file="refBased_test_data/deconvolution_samples.h5" compare="sim_size" delta="500000">
195 <assert_contents>
196 <has_h5_keys keys="beta_trace,cell_num_total_trace,cell_prob_trace,expression_trace,losses,reads_trace"/>
197 </assert_contents>
198 </output>
199 <output name="deconvolution_loss" file="refBased_test_data/deconvolution_loss.pdf" compare="sim_size" delta="20000" ftype="pdf"/>
200 </test>
201
202 </tests>
203 <help>
204 <![CDATA[
205
206 usage: deconvolve [-h] [--adata ADATA] [--adata-output ADATA_OUTPUT] [-i] [--output OUTPUT] [--seed SEED] [--n-components N_COMPONENTS]
207 [--spatial-smoothing-parameter SPATIAL_SMOOTHING_PARAMETER] [--n-samples N_SAMPLES] [--expression-truth EXPRESSION_TRUTH]
208 [--reference-scrna-celltype-column REFERENCE_SCRNA_CELLTYPE_COLUMN] [--reference-scrna-sample-column REFERENCE_SCRNA_SAMPLE_COLUMN]
209 [--n-svi-steps N_SVI_STEPS] [--use-spatial-guide | --no-use-spatial-guide] [-v]
210
211 Deconvolve data
212
213 options:
214 -h, --help show this help message and exit
215 --adata ADATA Input AnnData in h5 format, expected to be already bleed corrected
216 --adata-output ADATA_OUTPUT
217 A new AnnData in h5 format created with the deconvolution summary results appended.
218 -i, --inplace If provided, append deconvolution summary results to the --adata archive in place
219 --output OUTPUT Path where DeconvolutionResult will be written h5 format
220 --seed SEED Seed value for random number generator.
221 --n-components N_COMPONENTS
222 Number of cell types to deconvolve into.
223 --spatial-smoothing-parameter SPATIAL_SMOOTHING_PARAMETER
224 Spatial smoothing parameter (referred to as lambda in paper)
225 --n-samples N_SAMPLES
226 Number of samples from the posterior distribution or variational family.
227 --expression-truth EXPRESSION_TRUTH
228 Matched scRNA data in h5ad format, will be used to enforce a prior on celltypes and expression.
229 --reference-scrna-celltype-column REFERENCE_SCRNA_CELLTYPE_COLUMN
230 The name of the column with celltype id in the matched scRNA anndata.
231 --reference-scrna-sample-column REFERENCE_SCRNA_SAMPLE_COLUMN
232 The name of the column with sample id in the matched scRNA anndata.
233 --n-svi-steps N_SVI_STEPS
234 Number of steps for fitting variational family
235 --use-spatial-guide, --no-use-spatial-guide
236 Use spatial guide (variational family with spatial priors) for SVI
237 -v, --verbose Enable verbose logging
238
239 ]]>
240 </help>
241 <expand macro="citations"/>
242 </tool>