comparison cluster_analyze_embed_muon.xml @ 0:55c75ee7160b draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/muon commit fef10e0d450018d1e6ba4cbbda76c7686edc8aae
author iuc
date Sat, 25 Oct 2025 21:00:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:55c75ee7160b
1 <tool id="cluster_analyze_embed_muon" name="muon Cluster, analyze, and embed multimodal data" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <macros>
3 <import>macros.xml</import>
4 </macros>
5 <expand macro="bio_tools"/>
6 <expand macro="requirements"/>
7 <expand macro="version_command"/>
8 <command detect_errors="exit_code"><![CDATA[
9 @COPY_MUDATA@
10 @CMD@
11 ]]></command>
12 <configfiles>
13 <configfile name="script_file"><![CDATA[
14 @CMD_imports@
15 @CMD_read_inputs@
16
17 #if $method.method == 'tl.louvain'
18 mu.tl.louvain(
19 mdata,
20 @CMD_params_clustering@
21 )
22
23 #else if $method.method == 'tl.leiden'
24 mu.tl.leiden(
25 mdata,
26 @CMD_params_clustering@
27 )
28
29 #else if $method.method == 'tl.mofa'
30 mu.tl.mofa(
31 mdata,
32 #if $method.groups_label
33 groups_label='$method.groups_label',
34 #end if
35 use_raw=$method.use_raw,
36 #if $method.use_layer
37 use_layer='$method.use_layer',
38 #end if
39 #if $method.use_var
40 use_var='$method.use_var',
41 #end if
42 #if str($method.use_obs) != 'None'
43 use_obs='$method.use_obs',
44 #end if
45 n_factors=$method.n_factors,
46 scale_views=$method.scale_views,
47 scale_groups=$method.scale_groups,
48 center_groups=$method.center_groups,
49 ard_weights=$method.ard_weights,
50 ard_factors=$method.ard_factors,
51 spikeslab_weights=$method.spikeslab_weights,
52 spikeslab_factors=$method.spikeslab_factors,
53 n_iterations=$method.n_iterations,
54 convergence_mode='$method.convergence_mode',
55 use_float32=$method.use_float32,
56 #if $method.svi.svi_mode == 'yes'
57 svi_batch_size=$method.svi.svi_batch_size,
58 svi_learning_rate=$method.svi.svi_learning_rate,
59 svi_forgetting_rate=$method.svi.svi_forgetting_rate,
60 svi_start_stochastic=$method.svi.svi_start_stochastic,
61 #end if
62 #if $method.smooth_covariate
63 smooth_covariate='$method.smooth_covariate',
64 #end if
65 smooth_warping=$method.smooth_warping,
66 seed=$method.seed,
67 copy=False
68 )
69
70 #else if $method.method == 'tl.umap'
71 mu.tl.umap(
72 mdata,
73 min_dist=$method.min_dist,
74 spread=$method.spread,
75 n_components=$method.n_components,
76 #if str($method.maxiter)
77 maxiter=$method.maxiter,
78 #end if
79 alpha=$method.alpha,
80 gamma=$method.gamma,
81 negative_sample_rate=$method.negative_sample_rate,
82 init_pos='$method.init_pos',
83 random_state=$method.random_state,
84 #if $method.neighbors_key
85 neighbors_key='$method.neighbors_key',
86 #end if
87 copy=False
88 )
89 #end if
90
91 @CMD_mudata_write_outputs@
92 ]]></configfile>
93 </configfiles>
94 <inputs>
95 <expand macro="inputs_mudata"/>
96 <conditional name="method">
97 <param name="method" type="select" label="Method used for processing">
98 <option value="tl.leiden">Cluster: Cluster cells using the Leiden algorithm, using 'muon.tl.leiden'</option>
99 <option value="tl.louvain">Cluster: Cluster cells using the Louvain algorithm, using 'muon.tl.louvain'</option>
100 <option value="tl.mofa">Analyze: Run Multi Omics Factor Analysis, using 'muon.tl.mofa'</option>
101 <option value="tl.umap">Embed: Embed the multimodal neighborhood graph using UMAP, using 'muon.tl.umap'</option>
102 </param>
103 <when value="tl.leiden">
104 <expand macro="param_resolution"/>
105 <expand macro="param_weight"/>
106 <expand macro="param_random_state" seed="0"/>
107 <expand macro="param_key_added" key_added="leiden"/>
108 <expand macro="param_neighbors_key"/>
109 <expand macro="param_directed"/>
110 </when>
111 <when value="tl.louvain">
112 <expand macro="param_resolution"/>
113 <expand macro="param_weight"/>
114 <expand macro="param_random_state" seed="0"/>
115 <expand macro="param_key_added" key_added="louvain"/>
116 <expand macro="param_neighbors_key"/>
117 <expand macro="param_directed"/>
118 </when>
119 <when value="tl.mofa">
120 <param argument="groups_label" type="text" optional="true" label="a column name in adata.obs for grouping the samples">
121 <expand macro="sanitize_query" />
122 </param>
123 <expand macro="param_use_raw" label="Use raw slot of AnnData as input values" checked="false"/>
124 <param argument="use_layer" type="text" optional="true" label="Use a specific layer of AnnData as input values"
125 help="supersedes use_raw option">
126 <expand macro="sanitize_query" />
127 </param>
128 <param argument="use_var" type="text" optional="true" label=".var column with a boolean value to select genes"
129 help="e.g. “highly_variable”">
130 <expand macro="sanitize_query" />
131 </param>
132 <param argument="use_obs" type="select" optional="true" label="strategy to deal with samples (cells) not being the same across modalities"
133 help="Throws error if there are cells that are not same across modalities">
134 <option value="union">union</option>
135 <option value="intersection">intersection</option>
136 </param>
137 <param name="n_factors" type="integer" value="10" label="Number of factors to train the model with"/>
138 <param argument="scale_views" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Scale views to unit variance"/>
139 <param argument="scale_groups" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Scale groups to unit variance"/>
140 <param argument="center_groups" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Center groups to zero mean"/>
141 <param argument="ard_weights" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Use view-wise sparsity"/>
142 <param argument="ard_factors" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Use group-wise sparsity"/>
143 <param argument="spikeslab_weights" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Use feature-wise sparsity (e.g. gene-wise)"/>
144 <param argument="spikeslab_factors" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Use sample-wise sparsity (e.g. cell-wise)"/>
145 <param name="n_iterations" type="integer" value="1000" label="Upper limit on the number of iterations"/>
146 <param argument="convergence_mode" type="select" label="Convergence mode">
147 <option value="fast" selected="true">fast</option>
148 <option value="medium">medium</option>
149 <option value="slow">slow</option>
150 </param>
151 <param argument="use_float32" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Use reduced precision"/>
152 <conditional name="svi">
153 <param name="svi_mode" type="select" label="Use Stochastic Variational Inference (SVI)?">
154 <option value="yes">Yes</option>
155 <option value="no" selected="true">No</option>
156 </param>
157 <when value="yes">
158 <param argument="svi_batch_size" type="float" value="0.5" min="0" max="1" label="Batch size as a fraction"/>
159 <param argument="svi_learning_rate" type="float" value="1.0" min="0" max="1" label="Learning rate"/>
160 <param argument="svi_forgetting_rate" type="float" value="0.5" min="0" max="1" label="Forgetting rate"/>
161 <param argument="svi_start_stochastic" type="integer" value="1" label="First iteration to start SVI"/>
162 </when>
163 <when value="no"/>
164 </conditional>
165 <param argument="smooth_covariate" type="text" optional="true" label="Use a covariate (column in .obs) to learn smooth factors (MEFISTO)">
166 <expand macro="sanitize_query" />
167 </param>
168 <param argument="smooth_warping" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Learn the alignment of covariates (e.g. time points) from different groups?"/>
169 <param argument="seed" type="integer" value="1" label="Random seed"/>
170 </when>
171 <when value="tl.umap">
172 <param argument="min_dist" type="float" min="0" value="0.5" label="The effective minimum distance between embedded points"
173 help="Smaller values will result in a more clustered/clumped embedding where nearby points on the manifold are drawn closer together, while larger values will result on a more even dispersal of points."/>
174 <param argument="spread" type="float" value="1.0" label="The effective scale of embedded points"
175 help="Determines how clustered/clumped the embedded points are"/>
176 <param argument="n_components" type="integer" value="2" label="The number of dimensions of the embedding"/>
177 <param argument="maxiter" type="integer" optional="true" label="The number of iterations (epochs) of the optimization"
178 help="Called `n_epochs` in the original UMAP"/>
179 <param argument="alpha" type="float" value="1.0" label="The initial learning rate for the embedding optimization"/>
180 <param argument="gamma" type="float" value="1.0" label="Weighting applied to negative samples in low dimensional embedding optimization"
181 help="Values higher than one will result in greater weight being given to negative samples"/>
182 <param argument="negative_sample_rate" type="integer" value="5" label="Negative sample rate"
183 help="The number of negative edge/1-simplex samples to use per positive edge/1-simplex sample in optimizing the low dimensional embedding"/>
184 <param argument="init_pos" type="select" label="How to initialize the low dimensional embedding"
185 help="Called `init` in the original UMAP">
186 <option value="spectral">Use a spectral embedding of the graph</option>
187 <option value="random">Assign initial embedding positions at random</option>
188 </param>
189 <expand macro="param_random_state" seed="42"/>
190 <expand macro="param_neighbors_key"/>
191 </when>
192 </conditional>
193 <expand macro="inputs_common_advanced" />
194 </inputs>
195 <outputs>
196 <expand macro="muon_outputs"/>
197 </outputs>
198 <tests>
199 <test expect_num_outputs="2">
200 <!-- test2: tl.leiden -->
201 <param name="mdata" location="https://zenodo.org/records/12570984/files/pbmc3k_chr21_processed.h5mu"/>
202 <param name="method" value="tl.leiden"/>
203 <conditional name="res">
204 <param name="type" value="separate"/>
205 <repeat name="modalities">
206 <param name="mod_name" value="rna"/>
207 <param name="resolution" value="2.0"/>
208 </repeat>
209 <repeat name="modalities">
210 <param name="mod_name" value="atac"/>
211 <param name="resolution" value="1.5"/>
212 </repeat>
213 </conditional>
214 <conditional name="weights">
215 <param name="type" value="separate"/>
216 <repeat name="modalities">
217 <param name="mod_name" value="rna"/>
218 <param name="mod_weights" value="3"/>
219 </repeat>
220 <repeat name="modalities">
221 <param name="mod_name" value="atac"/>
222 <param name="mod_weights" value="1"/>
223 </repeat>
224 </conditional>
225 <param name="random_state" value="0"/>
226 <param name="key_added" value="leiden"/>
227 <param name="neighbors_key" value="neighbors"/>
228 <param name="directed" value="True"/>
229 <section name="advanced_common">
230 <param name="show_log" value="true" />
231 </section>
232 <output name="hidden_output">
233 <assert_contents>
234 <has_text_matching expression="mu.tl.leiden"/>
235 <has_text_matching expression="'rna': 2.0"/>
236 <has_text_matching expression="'atac': 1.5"/>
237 <has_text_matching expression="'rna': 3"/>
238 <has_text_matching expression="'atac': 1"/>
239 <has_text_matching expression="random_state=0"/>
240 <has_text_matching expression="key_added='leiden'"/>
241 <has_text_matching expression="neighbors_key='neighbors'"/>
242 <has_text_matching expression="directed=True"/>
243 </assert_contents>
244 </output>
245 <assert_stdout>
246 <has_text_matching expression="179 × 490"/>
247 <has_text_matching expression="179 x 178"/>
248 <has_text_matching expression="179 x 312"/>
249 </assert_stdout>
250 <output name="mudata_out" ftype="h5ad">
251 <assert_contents>
252 <has_h5_keys keys="mod/rna"/>
253 <has_h5_keys keys="mod/atac"/>
254 <has_h5_keys keys="obs/leiden"/>
255 <has_h5_keys keys="uns/leiden"/>
256 </assert_contents>
257 </output>
258 </test>
259 <test expect_num_outputs="2">
260 <!-- test3: tl.louvain -->
261 <param name="mdata" location="https://zenodo.org/records/12570984/files/pbmc3k_chr21_processed.h5mu"/>
262 <param name="method" value="tl.louvain"/>
263 <conditional name="res">
264 <param name="type" value="separate"/>
265 <repeat name="modalities">
266 <param name="mod_name" value="rna"/>
267 <param name="resolution" value="2.0"/>
268 </repeat>
269 <repeat name="modalities">
270 <param name="mod_name" value="atac"/>
271 <param name="resolution" value="1.5"/>
272 </repeat>
273 </conditional>
274 <conditional name="weights">
275 <param name="type" value="separate"/>
276 <repeat name="modalities">
277 <param name="mod_name" value="rna"/>
278 <param name="mod_weights" value="3"/>
279 </repeat>
280 <repeat name="modalities">
281 <param name="mod_name" value="atac"/>
282 <param name="mod_weights" value="1"/>
283 </repeat>
284 </conditional>
285 <param name="random_state" value="0"/>
286 <param name="key_added" value="louvain"/>
287 <param name="neighbors_key" value="neighbors"/>
288 <param name="directed" value="True"/>
289 <section name="advanced_common">
290 <param name="show_log" value="true" />
291 </section>
292 <output name="hidden_output">
293 <assert_contents>
294 <has_text_matching expression="mu.tl.louvain"/>
295 <has_text_matching expression="'rna': 2.0"/>
296 <has_text_matching expression="'atac': 1.5"/>
297 <has_text_matching expression="'rna': 3"/>
298 <has_text_matching expression="'atac': 1"/>
299 <has_text_matching expression="random_state=0"/>
300 <has_text_matching expression="key_added='louvain'"/>
301 <has_text_matching expression="neighbors_key='neighbors'"/>
302 <has_text_matching expression="directed=True"/>
303 </assert_contents>
304 </output>
305 <assert_stdout>
306 <has_text_matching expression="179 × 490"/>
307 <has_text_matching expression="179 x 178"/>
308 <has_text_matching expression="179 x 312"/>
309 </assert_stdout>
310 <output name="mudata_out" ftype="h5ad">
311 <assert_contents>
312 <has_h5_keys keys="mod/rna"/>
313 <has_h5_keys keys="mod/atac"/>
314 <has_h5_keys keys="obs/louvain"/>
315 <has_h5_keys keys="uns/louvain"/>
316 </assert_contents>
317 </output>
318 </test>
319 <test expect_num_outputs="2">
320 <!-- test4: tl.mofa -->
321 <param name="mdata" location="https://zenodo.org/records/12570984/files/pbmc3k_chr21_processed.h5mu"/>
322 <param name="method" value="tl.mofa"/>
323 <param name="groups_label" value=""/>
324 <param name="use_raw" value="False"/>
325 <param name="use_var" value="highly_variable"/>
326 <param name="use_obs" value="union"/>
327 <param name="n_factors" value="10"/>
328 <param name="n_iterations" value="10"/>
329 <param name="convergence_mode" value="fast"/>
330 <conditional name="svi">
331 <param name="svi_mode" value="yes"/>
332 <param name="svi_batch_size" value="0.5"/>
333 <param name="svi_learning_rate" value="1.0"/>
334 <param name="svi_forgetting_rate" value="0.5"/>
335 <param name="svi_start_stochastic" value="1"/>
336 </conditional>
337 <param name="seed" value="1"/>
338 <section name="advanced_common">
339 <param name="show_log" value="true" />
340 </section>
341 <output name="hidden_output">
342 <assert_contents>
343 <has_text_matching expression="mu.tl.mofa"/>
344 <has_text_matching expression="use_raw=False"/>
345 <has_text_matching expression="use_var='highly_variable'"/>
346 <has_text_matching expression="use_obs='union'"/>
347 <has_text_matching expression="n_factors=10"/>
348 <has_text_matching expression="n_iterations=10"/>
349 <has_text_matching expression="convergence_mode='fast'"/>
350 <has_text_matching expression="svi_batch_size=0.5"/>
351 <has_text_matching expression="svi_learning_rate=1.0"/>
352 <has_text_matching expression="svi_forgetting_rate=0.5"/>
353 <has_text_matching expression="svi_start_stochastic=1"/>
354 <has_text_matching expression="seed=1"/>
355 </assert_contents>
356 </output>
357 <assert_stdout>
358 <has_text_matching expression="179 × 490"/>
359 <has_text_matching expression="179 x 178"/>
360 <has_text_matching expression="179 x 312"/>
361 </assert_stdout>
362 <output name="mudata_out" ftype="h5ad">
363 <assert_contents>
364 <has_h5_keys keys="mod/rna"/>
365 <has_h5_keys keys="mod/atac"/>
366 <has_h5_keys keys="uns/mofa"/>
367 <has_h5_keys keys="obsm/X_mofa"/>
368 <has_h5_keys keys="varm/LFs"/>
369 </assert_contents>
370 </output>
371 </test>
372 <test expect_num_outputs="2">
373 <!-- test5: tl.umap -->
374 <param name="mdata" location="https://zenodo.org/records/12570984/files/pp.neighbors.h5mu"/>
375 <param name="method" value="tl.umap"/>
376 <param name="min_dist" value="0.5"/>
377 <param name="spread" value="1.0"/>
378 <param name="n_components" value="2"/>
379 <param name="maxiter" value="10"/>
380 <param name="alpha" value="1.0"/>
381 <param name="gamma" value="1.0"/>
382 <param name="negative_sample_rate" value="5"/>
383 <param name="init_pos" value="spectral"/>
384 <param name="random_state" value="42"/>
385 <section name="advanced_common">
386 <param name="show_log" value="true" />
387 </section>
388 <output name="hidden_output">
389 <assert_contents>
390 <has_text_matching expression="mu.tl.umap"/>
391 <has_text_matching expression="min_dist=0.5"/>
392 <has_text_matching expression="spread=1.0"/>
393 <has_text_matching expression="n_components=2"/>
394 <has_text_matching expression="maxiter=10"/>
395 <has_text_matching expression="alpha=1.0"/>
396 <has_text_matching expression="gamma=1.0"/>
397 <has_text_matching expression="negative_sample_rate=5"/>
398 <has_text_matching expression="init_pos='spectral'"/>
399 <has_text_matching expression="random_state=42"/>
400 </assert_contents>
401 </output>
402 <assert_stdout>
403 <has_text_matching expression="2711 × 1781"/>
404 <has_text_matching expression="2711 x 555"/>
405 <has_text_matching expression="2711 x 1226"/>
406 </assert_stdout>
407 <output name="mudata_out" ftype="h5ad">
408 <assert_contents>
409 <has_h5_keys keys="mod/rna"/>
410 <has_h5_keys keys="mod/atac"/>
411 <has_h5_keys keys="uns/umap"/>
412 <has_h5_keys keys="obsm/X_umap"/>
413 <has_h5_keys keys="obsp/connectivities"/>
414 <has_h5_keys keys="obsp/distances"/>
415 </assert_contents>
416 </output>
417 </test>
418 </tests>
419 <help><![CDATA[
420 Cluster: Cluster cells using the Leiden algorithm (`muon.tl.leiden`)
421 ====================================================================
422
423 Cluster cells using the Leiden algorithm. This runs only the multiplex Leiden algorithm on the MuData object
424 using connectivities of individual modalities.
425
426 More details on the `muon documentation
427 <https://muon.readthedocs.io/en/latest/api/generated/muon.tl.leiden.html#muon.tl.leiden>`__
428
429 Cluster: Cluster cells using the Louvain algorithm ('muon.tl.louvain')
430 ======================================================================
431
432 Cluster cells using the Louvain algorithm. This runs only the multiplex Louvain algorithm on the MuData object
433 using connectivities of individual modalities
434
435 More details on the `muon documentation
436 <https://muon.readthedocs.io/en/latest/api/generated/muon.tl.louvain.html#muon.tl.louvain>`__
437
438 Analyze: Run Multi Omics Factor Analysis ('muon.tl.mofa')
439 =========================================================
440
441 Run Multi-Omics Factor Analysis
442
443 More details on the `muon documentation
444 <https://muon.readthedocs.io/en/latest/api/generated/muon.tl.mofa.html#muon.tl.mofa>`__
445
446 Analyze: Similarity Network Fusion ('muon.tl.snf')
447 ==================================================
448
449 Similarity network fusion (SNF). See Wang et al., 2014 (DOI: 10.1038/nmeth.2810).
450
451 More details on the `muon documentation
452 <https://muon.readthedocs.io/en/latest/api/generated/muon.tl.snf.html#muon.tl.snf>`__
453
454 Embed: Embed the multimodal neighborhood graph using UMAP ('muon.tl.umap')
455 ==========================================================================
456
457 Embed the multimodal neighborhood graph using UMAP (McInnes et al, 2018). UMAP (Uniform Manifold Approximation
458 and Projection) is a manifold learning technique suitable for visualizing high-dimensional data.
459
460 More details on the `muon documentation
461 <https://muon.readthedocs.io/en/latest/api/generated/muon.tl.umap.html#muon.tl.umap>`__
462
463 ]]></help>
464 <expand macro="citations"/>
465 </tool>