Mercurial > repos > iuc > plot_muon
comparison plot_muon.xml @ 0:04f784475be4 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:22 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:04f784475be4 |
|---|---|
| 1 <tool id="plot_muon" name="muon plot" 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 == "pl.embedding" | |
| 18 plot = mu.pl.embedding( | |
| 19 mdata, | |
| 20 basis='$method.basis', | |
| 21 @CMD_params_embedding@ | |
| 22 return_fig=True | |
| 23 ) | |
| 24 plot.savefig("plot.$plot_ext") | |
| 25 | |
| 26 #else if $method.method == "pl.histogram" | |
| 27 plot = mu.pl.histogram( | |
| 28 mdata, | |
| 29 #if $method.key_variables.type == "var_names" | |
| 30 #set $key_list = mdata.var_names | |
| 31 #else if $method.key_variables.type == "obs" | |
| 32 #set $key_list = mdata.obs.select_dtypes(exclude=['category']).columns | |
| 33 #else if $method.key_variables.type == "custom" | |
| 34 #set $key_list=([x.strip() for x in str($method.key_variables.keys).split(',')]) | |
| 35 #end if | |
| 36 keys=$key_list, | |
| 37 #if $method.groupby | |
| 38 groupby='$method.groupby', | |
| 39 #end if | |
| 40 save='plot.$plot_ext' | |
| 41 ) | |
| 42 os.rename(os.path.join('figures', 'histogram_plot.$plot_ext'), 'plot.$plot_ext') | |
| 43 | |
| 44 #else if $method.method == "pl.mofa" | |
| 45 plot = mu.pl.mofa( | |
| 46 mdata, | |
| 47 @CMD_params_embedding@ | |
| 48 return_fig=True | |
| 49 ) | |
| 50 plot.savefig("plot.$plot_ext") | |
| 51 | |
| 52 #else if $method.method == "pl.mofa_loadings" | |
| 53 plot = mu.pl.mofa_loadings( | |
| 54 mdata, | |
| 55 #if $method.factors | |
| 56 factors='$method.factors', | |
| 57 #end if | |
| 58 include_lowest=$method.include_lowest, | |
| 59 #if str($method.n_points) | |
| 60 n_points=$method.n_points, | |
| 61 #end if | |
| 62 save='plot.$plot_ext' | |
| 63 ) | |
| 64 os.rename(os.path.join('figures', 'mofa_loadings_plot.$plot_ext'), 'plot.$plot_ext') | |
| 65 | |
| 66 #else if $method.method == "pl.umap" | |
| 67 plot = mu.pl.umap( | |
| 68 mdata, | |
| 69 @CMD_params_embedding@ | |
| 70 return_fig=True | |
| 71 ) | |
| 72 plot.savefig("plot.$plot_ext") | |
| 73 | |
| 74 #end if | |
| 75 | |
| 76 ]]></configfile> | |
| 77 </configfiles> | |
| 78 <inputs> | |
| 79 <expand macro="inputs_mudata"/> | |
| 80 <conditional name="method"> | |
| 81 <param name="method" type="select" label="Method used for plotting"> | |
| 82 <option value="pl.embedding">Scatter: Scatter plot along observations (.obs column), using 'muon.pl.embedding'</option> | |
| 83 <option value="pl.histogram">Histogram: Plot Histogram of Fragment lengths within specified region, using 'muon.pl.histogram'</option> | |
| 84 <option value="pl.mofa">Scatter: Scatter plot in MOFA factor coordinates, using 'muon.pl.mofa'</option> | |
| 85 <option value="pl.mofa_loadings">Ranking: Rank genes according to contributions to MOFA factors, using 'muon.pl.mofa_loadings'</option> | |
| 86 <option value="pl.umap">Scatter: UMAP scatter plot, using 'muon.pl.umap'</option> | |
| 87 </param> | |
| 88 <when value="pl.embedding"> | |
| 89 <param argument="basis" type="text" value="X_mofa" label="Name of the obsm basis to use" help="can also be a basis inside any modality, e.g. 'rna:X_pca'"> | |
| 90 <expand macro="sanitize_query" /> | |
| 91 </param> | |
| 92 <expand macro="params_embedding"/> | |
| 93 </when> | |
| 94 <when value="pl.histogram"> | |
| 95 <expand macro="param_keys"/> | |
| 96 <param argument="groupby" type="text" optional="true" label="Column name(s) of .obs slot of the AnnData object according to which the plot is split"> | |
| 97 <expand macro="sanitize_query" /> | |
| 98 </param> | |
| 99 </when> | |
| 100 <when value="pl.mofa"> | |
| 101 <expand macro="params_embedding"/> | |
| 102 </when> | |
| 103 <when value="pl.mofa_loadings"> | |
| 104 <param argument="factors" type="text" optional="true" label="Comma separated list of factors" help="For example, '1,2,3' means [1, 2, 3], first, second, third factors"> | |
| 105 <expand macro="sanitize_query" /> | |
| 106 </param> | |
| 107 <param argument="include_lowest" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Whether to show the variables with both highest and lowest loadings"/> | |
| 108 <param argument="n_points" type="integer" optional="true" label="Number of variables to plot for each factor"/> | |
| 109 </when> | |
| 110 <when value="pl.umap"> | |
| 111 <expand macro="params_embedding"/> | |
| 112 </when> | |
| 113 </conditional> | |
| 114 <param name="plot_ext" type="select" label="Type of output plot"> | |
| 115 <option value="png" selected="true">PNG</option> | |
| 116 <option value="svg">SVG</option> | |
| 117 <option value="pdf">PDF</option> | |
| 118 </param> | |
| 119 <expand macro="inputs_common_advanced" /> | |
| 120 </inputs> | |
| 121 <outputs> | |
| 122 <data name="out_png" format="png" from_work_dir="plot.png" label="PNG plot from ${tool.name} (${method.method}) on ${on_string}"> | |
| 123 <filter>plot_ext == 'png'</filter> | |
| 124 </data> | |
| 125 <data name="out_pdf" format="pdf" from_work_dir="plot.pdf" label="PDF plot from ${tool.name} (${method.method}) on ${on_string}"> | |
| 126 <filter>plot_ext == 'pdf'</filter> | |
| 127 </data> | |
| 128 <data name="out_svg" format="svg" from_work_dir="plot.svg" label="SVG plot from ${tool.name} (${method.method}) on ${on_string}"> | |
| 129 <filter>plot_ext == 'svg'</filter> | |
| 130 </data> | |
| 131 <data name="hidden_output" format="txt" label="Log file" hidden="true" > | |
| 132 <filter>advanced_common['show_log']</filter> | |
| 133 </data> | |
| 134 </outputs> | |
| 135 <tests> | |
| 136 <test expect_num_outputs="2"> | |
| 137 <!-- test1: pl.embedding --> | |
| 138 <param name="mdata" location="https://zenodo.org/records/12570984/files/tl.mofa.h5mu"/> | |
| 139 <param name="method" value="pl.embedding"/> | |
| 140 <param name="basis" value="X_mofa"/> | |
| 141 <param name="color" value="rna:leiden,atac:leiden"/> | |
| 142 <param name="use_raw" value="False"/> | |
| 143 <param name="plot_ext" value="pdf"/> | |
| 144 <section name="advanced_common"> | |
| 145 <param name="show_log" value="true" /> | |
| 146 </section> | |
| 147 <output name="hidden_output"> | |
| 148 <assert_contents> | |
| 149 <has_text_matching expression="mu.pl.embedding"/> | |
| 150 <has_text_matching expression="basis='X_mofa'"/> | |
| 151 <has_text_matching expression="color=\['rna:leiden', 'atac:leiden'\]"/> | |
| 152 <has_text_matching expression="use_raw=False"/> | |
| 153 </assert_contents> | |
| 154 </output> | |
| 155 <output name="out_pdf" ftype="pdf" location="https://zenodo.org/records/12570984/files/pl.embedding.pdf" compare="sim_size" delta_frac="0.1"/> | |
| 156 </test> | |
| 157 <test expect_num_outputs="2"> | |
| 158 <!-- test2 pl.histogram --> | |
| 159 <param name="mdata" location="https://zenodo.org/records/12570984/files/tl.mofa.h5mu"/> | |
| 160 <param name="method" value="pl.histogram"/> | |
| 161 <conditional name="key_variables"> | |
| 162 <param name="type" value="custom"/> | |
| 163 <param name="keys" value="rna:n_genes_by_counts,rna:total_counts"/> | |
| 164 </conditional> | |
| 165 <param name="plot_ext" value="png"/> | |
| 166 <section name="advanced_common"> | |
| 167 <param name="show_log" value="true" /> | |
| 168 </section> | |
| 169 <output name="hidden_output"> | |
| 170 <assert_contents> | |
| 171 <has_text_matching expression="mu.pl.histogram"/> | |
| 172 <has_text_matching expression="keys=\['rna:n_genes_by_counts', 'rna:total_counts'\]"/> | |
| 173 </assert_contents> | |
| 174 </output> | |
| 175 <output name="out_png" ftype="png" location="https://zenodo.org/records/12570984/files/pl.histogram.png" compare="image_diff"/> | |
| 176 </test> | |
| 177 <test expect_num_outputs="2"> | |
| 178 <!-- test3: pl.mofa --> | |
| 179 <param name="mdata" location="https://zenodo.org/records/12570984/files/tl.mofa.h5mu"/> | |
| 180 <param name="method" value="pl.mofa"/> | |
| 181 <param name="use_raw" value="False"/> | |
| 182 <param name="plot_ext" value="svg"/> | |
| 183 <section name="advanced_common"> | |
| 184 <param name="show_log" value="true" /> | |
| 185 </section> | |
| 186 <output name="hidden_output"> | |
| 187 <assert_contents> | |
| 188 <has_text_matching expression="mu.pl.mofa"/> | |
| 189 <has_text_matching expression="use_raw=False"/> | |
| 190 </assert_contents> | |
| 191 </output> | |
| 192 <output name="out_svg" ftype="svg" location="https://zenodo.org/records/12570984/files/pl.mofa.svg" compare="sim_size" delta_frac="0.1"/> | |
| 193 </test> | |
| 194 <test expect_num_outputs="2"> | |
| 195 <!-- test4: pl.mofa_loadings --> | |
| 196 <param name="mdata" location="https://zenodo.org/records/12570984/files/tl.mofa.h5mu"/> | |
| 197 <param name="method" value="pl.mofa_loadings"/> | |
| 198 <param name="factors" value="1,2,3"/> | |
| 199 <param name="include_lowest" value="True"/> | |
| 200 <section name="advanced_common"> | |
| 201 <param name="show_log" value="true" /> | |
| 202 </section> | |
| 203 <output name="hidden_output"> | |
| 204 <assert_contents> | |
| 205 <has_text_matching expression="mu.pl.mofa_loadings"/> | |
| 206 <has_text_matching expression="factors='1,2,3'"/> | |
| 207 <has_text_matching expression="include_lowest=True"/> | |
| 208 </assert_contents> | |
| 209 </output> | |
| 210 <output name="out_png" ftype="png" location="https://zenodo.org/records/12570984/files/pl.mofa_loadings.png" compare="image_diff"/> | |
| 211 </test> | |
| 212 <test expect_num_outputs="2"> | |
| 213 <!-- test5: pl.umap --> | |
| 214 <param name="mdata" location="https://zenodo.org/records/12570984/files/tl.umap.h5mu"/> | |
| 215 <param name="method" value="pl.umap"/> | |
| 216 <param name="use_raw" value="False"/> | |
| 217 <section name="advanced_common"> | |
| 218 <param name="show_log" value="true" /> | |
| 219 </section> | |
| 220 <output name="hidden_output"> | |
| 221 <assert_contents> | |
| 222 <has_text_matching expression="mu.pl.umap"/> | |
| 223 <has_text_matching expression="use_raw=False"/> | |
| 224 </assert_contents> | |
| 225 </output> | |
| 226 <output name="out_png" ftype="png" location="https://zenodo.org/records/12570984/files/pl.umap.png" compare="image_diff"/> | |
| 227 </test> | |
| 228 </tests> | |
| 229 <help><![CDATA[ | |
| 230 Scatter: Scatter plot along observations (.obs column) ('muon.pl.embedding') | |
| 231 ============================================================================ | |
| 232 | |
| 233 Produce a scatter plot in the define basis (.obs), which can also be a basis inside any modality. | |
| 234 | |
| 235 More details on the `muon documentation | |
| 236 <https://muon.readthedocs.io/en/latest/api/generated/muon.pl.embedding.html#muon.pl.embedding>`__ | |
| 237 | |
| 238 Scatter: Scatter plot in MOFA factor coordinates ('muon.pl.mofa') | |
| 239 ================================================================= | |
| 240 | |
| 241 Scatter plot in MOFA factors coordinates. | |
| 242 | |
| 243 More details on the `muon documentation | |
| 244 <https://muon.readthedocs.io/en/latest/api/generated/muon.pl.mofa.html#muon.pl.mofa>`__ | |
| 245 | |
| 246 Scatter: UMAP scatter plot ('muon.pl.umap') | |
| 247 =========================================== | |
| 248 | |
| 249 UMAP Scatter plot. | |
| 250 | |
| 251 More details on the `muon documentation | |
| 252 <https://muon.readthedocs.io/en/latest/api/generated/muon.pl.umap.html#muon.pl.umap>`__ | |
| 253 | |
| 254 Histogram: Plot Histogram of Fragment lengths within specified region ('muon.pl.histogram') | |
| 255 =========================================================================================== | |
| 256 | |
| 257 Plot Histogram of Fragment lengths within specified region. | |
| 258 | |
| 259 More details on the `muon documentation | |
| 260 <https://muon.readthedocs.io/en/latest/api/generated/muon.pl.histogram.html#muon.pl.histogram>`__ | |
| 261 | |
| 262 Ranking: Rank genes according to contributions to MOFA factors ('muon.pl.mofa_loadings') | |
| 263 ======================================================================================== | |
| 264 | |
| 265 Rank genes according to contributions to MOFA factors. | |
| 266 | |
| 267 More details on the `muon documentation | |
| 268 <https://muon.readthedocs.io/en/latest/api/generated/muon.pl.mofa_loadings.html#muon.pl.mofa_loadings>`__ | |
| 269 ]]></help> | |
| 270 <expand macro="citations"/> | |
| 271 </tool> |
