Mercurial > repos > iuc > cluster_analyze_embed_muon
comparison macros.xml @ 0:b82f44c4e8af draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/muon/ commit bcf2ec32c3d13b29da55e0e638da7ddd7162c436
| author | iuc |
|---|---|
| date | Wed, 05 Feb 2025 10:53:32 +0000 |
| parents | |
| children | a8f0f1cf5152 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:b82f44c4e8af |
|---|---|
| 1 <macros> | |
| 2 <token name="@TOOL_VERSION@">0.1.6</token> | |
| 3 <token name="@VERSION_SUFFIX@">0</token> | |
| 4 <token name="@PROFILE@">23.0</token> | |
| 5 <xml name="requirements"> | |
| 6 <requirements> | |
| 7 <requirement type="package" version="@TOOL_VERSION@">muon</requirement> | |
| 8 <requirement type="package" version="0.10.2">leidenalg</requirement> | |
| 9 <requirement type="package" version="0.8.2">louvain</requirement> | |
| 10 <requirement type="package" version="0.7.2">mofapy2</requirement> | |
| 11 </requirements> | |
| 12 </xml> | |
| 13 <xml name="bio_tools"> | |
| 14 <xrefs> | |
| 15 <xref type="bio.tools">muon</xref> | |
| 16 </xrefs> | |
| 17 </xml> | |
| 18 <xml name="creators"> | |
| 19 <creator> | |
| 20 <organization name="European Galaxy Team" url="https://galaxyproject.org/eu/" /> | |
| 21 </creator> | |
| 22 </xml> | |
| 23 <xml name="citations"> | |
| 24 <citations> | |
| 25 <citation type="doi">10.1186/s13059-021-02577-8</citation> | |
| 26 </citations> | |
| 27 </xml> | |
| 28 <xml name="sanitize_query"> | |
| 29 <sanitizer> | |
| 30 <valid initial="string.printable"> | |
| 31 <remove value="'" /> | |
| 32 </valid> | |
| 33 </sanitizer> | |
| 34 </xml> | |
| 35 <xml name="sanitize_string"> | |
| 36 <sanitizer> | |
| 37 <valid initial="string.letters,string.digits"><add value="_" /></valid> | |
| 38 </sanitizer> | |
| 39 </xml> | |
| 40 <xml name="version_command"> | |
| 41 <version_command><![CDATA[python -c "import muon as mu;print('Muon version: %s' % mu.__version__)"]]></version_command> | |
| 42 </xml> | |
| 43 | |
| 44 <token name="@CMD_imports@"><![CDATA[ | |
| 45 import mudata as md | |
| 46 import muon as mu | |
| 47 import scanpy as sc | |
| 48 import os | |
| 49 ]]> | |
| 50 </token> | |
| 51 <xml name="inputs_mudata"> | |
| 52 <param name="mdata" type="data" format="h5ad" label="MuData input file"/> | |
| 53 </xml> | |
| 54 <token name="@CMD_read_inputs@"><![CDATA[ | |
| 55 mdata = md.read('mudata.h5mu') | |
| 56 ]]> | |
| 57 </token> | |
| 58 <token name="@CMD_prettify_stdout@"><![CDATA[ | sed -r '1 s|MuData object with (.+) = (.*)\s*|\1: \2|g' | sed "s|'||g" | sed -r 's|^\s*(.*):\s(.*)|[\1]\n- \2|g' | sed 's|, |\n- |g' | |
| 59 ]]></token> | |
| 60 <token name="@COPY_MUDATA@"><![CDATA[ | |
| 61 cp '$mdata' 'mudata.h5mu' && | |
| 62 ]]> | |
| 63 </token> | |
| 64 | |
| 65 <token name="@CMD@"><![CDATA[ | |
| 66 cat '$script_file' > '$hidden_output' && | |
| 67 python '$script_file' >> '$hidden_output' && | |
| 68 touch 'mudata_info.txt' && | |
| 69 cat 'mudata_info.txt' @CMD_prettify_stdout@ | |
| 70 ]]> | |
| 71 </token> | |
| 72 | |
| 73 <token name="@CMD_params_clustering@"><![CDATA[ | |
| 74 #if $method.res.type == 'same' | |
| 75 #if str($method.res.resolution) | |
| 76 resolution=$method.res.resolution, | |
| 77 #end if | |
| 78 #else if $method.res.type == 'separate' | |
| 79 resolution={ | |
| 80 #for $modality in $method.res.modalities | |
| 81 '$modality.mod_name': $modality.resolution, | |
| 82 #end for | |
| 83 }, | |
| 84 #end if | |
| 85 #if $method.weights.type == 'same' | |
| 86 #if str($method.weights.mod_weights) | |
| 87 mod_weights=$method.weights.mod_weights, | |
| 88 #end if | |
| 89 #else if $method.weights.type == 'separate' | |
| 90 mod_weights={ | |
| 91 #for $modality in $method.weights.modalities | |
| 92 '$modality.mod_name': $modality.mod_weights, | |
| 93 #end for | |
| 94 }, | |
| 95 #end if | |
| 96 random_state=$method.random_state, | |
| 97 key_added='$method.key_added', | |
| 98 #if $method.neighbors_key | |
| 99 neighbors_key='$method.neighbors_key', | |
| 100 #end if | |
| 101 directed=$method.directed | |
| 102 ]]></token> | |
| 103 | |
| 104 <token name="@CMD_neighbor_keys@"><![CDATA[ | |
| 105 #if $method.n_keys.type == 'same' | |
| 106 neighbor_keys='$method.n_keys.neighbor_keys', | |
| 107 #else if $method.n_keys.type == 'separate' | |
| 108 neighbor_keys={ | |
| 109 #for $modality in $method.n_keys.modalities | |
| 110 '$modality.mod_name': '$modality.neighbor_keys', | |
| 111 #end for | |
| 112 }, | |
| 113 #end if | |
| 114 ]]></token> | |
| 115 <token name="@CMD_params_embedding@"><![CDATA[ | |
| 116 #if $method.color | |
| 117 #set $color = ([x.strip() for x in str($method.color).split(',')]) | |
| 118 color=$color, | |
| 119 #end if | |
| 120 use_raw=$method.use_raw, | |
| 121 #if $method.layer | |
| 122 layer='$method.layer', | |
| 123 #end if | |
| 124 ]]></token> | |
| 125 | |
| 126 <xml name="inputs_common_advanced"> | |
| 127 <section name="advanced_common" title="Advanced Options" expanded="false"> | |
| 128 <param name="show_log" type="boolean" checked="false" label="Output Log?" /> | |
| 129 </section> | |
| 130 </xml> | |
| 131 <xml name="outputs_common_advanced"> | |
| 132 <data name="hidden_output" format="txt" label="Log file" > | |
| 133 <filter>advanced_common['show_log']</filter> | |
| 134 </data> | |
| 135 </xml> | |
| 136 <xml name="muon_outputs"> | |
| 137 <data name="mudata_out" format="h5ad" from_work_dir="mudata.h5mu" label="${tool.name} (${method.method}) on ${on_string}: MuData"/> | |
| 138 <expand macro="outputs_common_advanced"/> | |
| 139 </xml> | |
| 140 <token name="@CMD_mudata_write_outputs@"><![CDATA[ | |
| 141 mdata.write('mudata.h5mu') | |
| 142 with open('mudata_info.txt','w', encoding='utf-8') as ainfo: | |
| 143 print(mdata, file=ainfo) | |
| 144 ]]> | |
| 145 </token> | |
| 146 | |
| 147 <xml name="param_neighbor_keys"> | |
| 148 <conditional name="n_keys"> | |
| 149 <param name="type" type="select" label="Same or separate neighborhood information for each modality?"> | |
| 150 <option value="same">Same neighborhood key for all modalities</option> | |
| 151 <option value="separate">Separate neighborhood keys per modality</option> | |
| 152 </param> | |
| 153 <when value="same"> | |
| 154 <param argument="neighbor_keys" type="text" value="neighbors" label="Keys in .uns where per-modality neighborhood information is stored"/> | |
| 155 </when> | |
| 156 <when value="separate"> | |
| 157 <repeat name="modalities" title="Modalities" min="2" default="2"> | |
| 158 <param name="mod_name" type="text" label="Modality name" optional="true"> | |
| 159 <expand macro="sanitize_string" /> | |
| 160 </param> | |
| 161 <param argument="neighbor_keys" type="text" value="neighbors" label="Keys in .uns where neighborhood information is stored"/> | |
| 162 </repeat> | |
| 163 </when> | |
| 164 </conditional> | |
| 165 </xml> | |
| 166 <xml name="param_resolution"> | |
| 167 <conditional name="res"> | |
| 168 <param name="type" type="select" label="Same or separate resolutions for each modality?"> | |
| 169 <option value="same">Same resolution for all modalities</option> | |
| 170 <option value="separate">Separate resolutions per modality</option> | |
| 171 </param> | |
| 172 <when value="same"> | |
| 173 <param argument="resolution" type="float" optional="true" label="Coarseness of the clustering" help="Higher values -> more clusters"/> | |
| 174 </when> | |
| 175 <when value="separate"> | |
| 176 <repeat name="modalities" title="Modalities" min="2" default="2"> | |
| 177 <param name="mod_name" type="text" label="Modality name" optional="true"> | |
| 178 <expand macro="sanitize_string" /> | |
| 179 </param> | |
| 180 <param name="resolution" type="float" label="Resolution for the above modality" help="Higher values -> more clusters"/> | |
| 181 </repeat> | |
| 182 </when> | |
| 183 </conditional> | |
| 184 </xml> | |
| 185 <xml name="param_weight"> | |
| 186 <conditional name="weights"> | |
| 187 <param name="type" type="select" label="Same or separate weights for each modality?"> | |
| 188 <option value="same">Same weight for all modalities</option> | |
| 189 <option value="separate">Separate weight per modality</option> | |
| 190 </param> | |
| 191 <when value="same"> | |
| 192 <param argument="mod_weights" type="float" optional="true" label="Weight each modality controlling its contribution" help="Higher values -> more important"/> | |
| 193 </when> | |
| 194 <when value="separate"> | |
| 195 <repeat name="modalities" title="Modalities" min="2" default="2"> | |
| 196 <param name="mod_name" type="text" label="Modality name" optional="true"> | |
| 197 <expand macro="sanitize_string" /> | |
| 198 </param> | |
| 199 <param name="mod_weights" type="float" label="Weight for the above modality" help="Higher values -> more important"/> | |
| 200 </repeat> | |
| 201 </when> | |
| 202 </conditional> | |
| 203 </xml> | |
| 204 <xml name="param_random_state" tokens="seed"> | |
| 205 <param argument="random_state" type="integer" value="@SEED@" optional="true" label="Random seed for the optimization"/> | |
| 206 </xml> | |
| 207 <xml name="param_key_added" tokens="key_added"> | |
| 208 <param argument="key_added" type="text" value="@KEY_ADDED@" label="mdata.obs key where cluster labels to be added"> | |
| 209 <expand macro="sanitize_string" /> | |
| 210 </param> | |
| 211 </xml> | |
| 212 <xml name="param_neighbors_key"> | |
| 213 <param argument="neighbors_key" type="text" optional="true" label="Use neighbors connectivities as adjacency" | |
| 214 help="If not specified, look for .obsp['connectivities'] in each modality. | |
| 215 If specified, look for .obsp[.uns[neighbors_key]['connectivities_key']] in each modality for connectivities."> | |
| 216 <expand macro="sanitize_string" /> | |
| 217 </param> | |
| 218 </xml> | |
| 219 <xml name="param_directed"> | |
| 220 <param argument="directed" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Treat the graph as directed"/> | |
| 221 </xml> | |
| 222 <xml name="param_key_added_common"> | |
| 223 <param argument="key_added" type="text" optional="true" label="Key to be added to store neighbors, distances and connectivities data" | |
| 224 help="If not specified, the multimodal neighbors data is stored in .uns['neighbors'], distances and connectivities are stored in .obsp['distances'] and .obsp['connectivities'], respectively. | |
| 225 If specified, the neighbors data is added to .uns[key_added], distances are stored in .obsp[key_added + '_distances'] and connectivities in .obsp[key_added + '_connectivities']."> | |
| 226 <expand macro="sanitize_string" /> | |
| 227 </param> | |
| 228 </xml> | |
| 229 <xml name="param_eps" tokens="eps_value"> | |
| 230 <param argument="eps" type="float" value="@EPS_VALUE@" label="Small number to avoid numerical errors"/> | |
| 231 </xml> | |
| 232 <xml name="param_use_raw" tokens="label,checked"> | |
| 233 <param argument="use_raw" type="boolean" truevalue="True" falsevalue="False" checked="@CHECKED@" label="@LABEL@" /> | |
| 234 </xml> | |
| 235 <xml name="param_keys"> | |
| 236 <conditional name="key_variables"> | |
| 237 <param name="type" type="select" label="Keys to plot"> | |
| 238 <option value="var_names">All variables in '.var_names'</option> | |
| 239 <option value="obs">All fields in '.obs'</option> | |
| 240 <option value="custom">Subset of variables in 'adata.var_names' or fields of '.obs'</option> | |
| 241 </param> | |
| 242 <when value="var_names"/> | |
| 243 <when value="obs"/> | |
| 244 <when value="custom"> | |
| 245 <param argument="keys" type="text" value="" label="Keys to plot" help="One or a list of comma-separated index or key from '.var_names' or fields of '.obs'"> | |
| 246 <expand macro="sanitize_query" /> | |
| 247 </param> | |
| 248 </when> | |
| 249 </conditional> | |
| 250 </xml> | |
| 251 <xml name="param_color"> | |
| 252 <param argument="color" type="text" optional="true" label="Keys for variables or annotations of observations (.obs columns)" help="Can be from any modality."> | |
| 253 <expand macro="sanitize_query" /> | |
| 254 </param> | |
| 255 </xml> | |
| 256 <xml name="params_embedding"> | |
| 257 <expand macro="param_color"/> | |
| 258 <expand macro="param_use_raw" label="Use raw slot of AnnData as input values" checked="true"/> | |
| 259 <param argument="layer" type="text" optional="true" label="Name of the layer in the modality where a feature (from color) is derived from" | |
| 260 help="If a valid layer is provided, this takes precedence over use_raw=True"> | |
| 261 <expand macro="sanitize_query" /> | |
| 262 </param> | |
| 263 </xml> | |
| 264 </macros> |
