Mercurial > repos > iuc > anndata_manipulate
comparison manipulate.xml @ 15:d1e49c3c0aa2 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit 4f6d044223f374ba44a4d46ad77559ca781e6db7
author | iuc |
---|---|
date | Sat, 11 Jan 2025 21:10:19 +0000 |
parents | c4209ea387d4 |
children |
comparison
equal
deleted
inserted
replaced
14:c4209ea387d4 | 15:d1e49c3c0aa2 |
---|---|
35 #if str($manipulate.index_unique) != '' | 35 #if str($manipulate.index_unique) != '' |
36 index_unique='$manipulate.index_unique', | 36 index_unique='$manipulate.index_unique', |
37 #else | 37 #else |
38 index_unique=None, | 38 index_unique=None, |
39 #end if | 39 #end if |
40 #if str($manipulate.uns_merge) != 'None' | |
41 uns_merge='$manipulate.uns_merge', | |
42 #else | |
43 uns_merge=None, | |
44 #end if | |
40 batch_key='$manipulate.batch_key') | 45 batch_key='$manipulate.batch_key') |
41 | 46 |
42 #else if $manipulate.function == 'var_names_make_unique' | 47 #else if $manipulate.function == 'var_names_make_unique' |
43 adata.var_names_make_unique(join='$manipulate.join') | 48 adata.var_names_make_unique(join='$manipulate.join') |
44 | 49 |
45 #else if $manipulate.function == 'obs_names_make_unique' | 50 #else if $manipulate.function == 'obs_names_make_unique' |
46 adata.obs_names_make_unique(join='$manipulate.join') | 51 adata.obs_names_make_unique(join='$manipulate.join') |
47 | 52 |
48 #else if $manipulate.function == 'rename_categories' | 53 #else if $manipulate.function == 'rename_categories' |
49 #set $categories = [x.strip() for x in str($manipulate.categories).split(',')] | 54 #set $categories = [x.strip() for x in str($manipulate.categories).split(',')] |
55 #if $manipulate.update_key.new_key == 'no': | |
50 adata.rename_categories( | 56 adata.rename_categories( |
51 key='$manipulate.key', | 57 key='$manipulate.key', |
52 categories=$categories) | 58 categories=$categories) |
59 #else | |
60 if '$manipulate.key' in adata.obs: | |
61 print("changing key in obs") | |
62 adata.obs['$manipulate.key_name'] = adata.obs['$manipulate.key'] | |
63 adata.rename_categories( | |
64 key='$manipulate.key_name', | |
65 categories=$categories) | |
66 elif '$manipulate.key' in adata.var: | |
67 print("changing key in var") | |
68 adata.var['$manipulate.key_name'] = adata.var['$manipulate.key'] | |
69 adata.rename_categories( | |
70 key='$manipulate.key_name', | |
71 categories=$categories) | |
72 else: | |
73 print("chanigng key in uns") | |
74 adata.uns['$manipulate.key_name'] = adata.uns['$manipulate.key'] | |
75 adata.rename_categories( | |
76 key='$manipulate.key_name', | |
77 categories=$categories) | |
78 #end if | |
53 | 79 |
54 #else if $manipulate.function == 'remove_keys' | 80 #else if $manipulate.function == 'remove_keys' |
55 #if $manipulate.obs_keys | 81 #if $manipulate.obs_keys |
56 #set $keys = [x.strip() for x in str($manipulate.obs_keys).split(',')] | 82 #set $keys = [x.strip() for x in str($manipulate.obs_keys).split(',')] |
57 adata.obs = adata.obs.drop(columns=$keys) | 83 adata.obs = adata.obs.drop(columns=$keys) |
63 #end if | 89 #end if |
64 | 90 |
65 #else if $manipulate.function == 'flag_genes' | 91 #else if $manipulate.function == 'flag_genes' |
66 ## adapted from anndata operations | 92 ## adapted from anndata operations |
67 #for $flag in $manipulate.gene_flags | 93 #for $flag in $manipulate.gene_flags |
94 #if str($flag.col_in) != '': | |
95 k_cat = adata.var['${flag.col_in}'].str.startswith('${flag.startswith}') | |
96 #else: | |
68 k_cat = adata.var_names.str.startswith('${flag.startswith}') | 97 k_cat = adata.var_names.str.startswith('${flag.startswith}') |
98 #end if | |
69 if k_cat.sum() > 0: | 99 if k_cat.sum() > 0: |
70 adata.var['${flag.col_name}'] = k_cat | 100 adata.var['${flag.col_out}'] = k_cat |
71 else: | 101 else: |
72 print(f'No genes starting with {'${flag.startswith}'} found.') | 102 print(f'No genes starting with {'${flag.startswith}'} found.') |
73 #end for | 103 #end for |
104 | |
105 #else if $manipulate.function == 'rename_obs': | |
106 adata.obs['${to_obs}'] = adata.obs['${from_obs}'] | |
107 #if not $keep_original: | |
108 del adata.obs['${from_obs}'] | |
109 #end if | |
110 | |
111 #else if $manipulate.function == 'rename_var': | |
112 adata.var['${to_var}'] = adata.var['${from_var}'] | |
113 #if not $keep_original: | |
114 del adata.var['${from_var}'] | |
115 #end if | |
74 | 116 |
75 #else if $manipulate.function == 'strings_to_categoricals' | 117 #else if $manipulate.function == 'strings_to_categoricals' |
76 adata.strings_to_categoricals() | 118 adata.strings_to_categoricals() |
77 | 119 |
78 #else if $manipulate.function == 'transpose' | 120 #else if $manipulate.function == 'transpose' |
99 os.makedirs(res_dir, exist_ok=True) | 141 os.makedirs(res_dir, exist_ok=True) |
100 for s,field_value in enumerate(adata.obs["${manipulate.key}"].unique()): | 142 for s,field_value in enumerate(adata.obs["${manipulate.key}"].unique()): |
101 ad_s = adata[adata.obs.${manipulate.key} == field_value] | 143 ad_s = adata[adata.obs.${manipulate.key} == field_value] |
102 ad_s.write(f"{res_dir}/${manipulate.key}_{s}.h5ad", compression='gzip') | 144 ad_s.write(f"{res_dir}/${manipulate.key}_{s}.h5ad", compression='gzip') |
103 | 145 |
104 #else if $manipulate.function == 'filter' | 146 #else if $manipulate.function == 'copy_obs' |
105 #if $manipulate.filter.filter == 'key' | 147 source_adata = ad.read_h5ad('$source_adata') |
106 #if $manipulate.var_obs == 'var' | 148 #for $key in $manipulate.keys |
107 filtered = adata.var['$manipulate.filter.key'] | 149 if '$key.source_key' in source_adata.obs: |
108 #else if $manipulate.var_obs == 'obs' | 150 #if str($key.target_key) == '': |
109 filtered = adata.obs['$manipulate.filter.key'] | 151 adata.obs['$key.source_key'] = source_adata.obs['$key.source_key'] |
152 #else | |
153 adata.obs['$key.target_key'] = source_adata.obs['$key.source_key'] | |
110 #end if | 154 #end if |
111 | 155 else: |
112 #if $manipulate.filter.filter_key.type == 'number' | 156 print(f"Obs column {'{$key.source_key}'} not found in source AnnData.") |
113 #if $manipulate.filter.filter_key.filter == 'equal' | 157 #end for |
114 filtered = filtered == $manipulate.filter.filter_key.value | 158 |
115 #else if $manipulate.filter.filter_key.filter == 'equal' | 159 #else if $manipulate.function == 'copy_uns' |
116 filtered = filtered != $manipulate.filter.filter_key.value | 160 source_adata = ad.read_h5ad('$source_adata') |
117 #else if $manipulate.filter.filter_key.filter == 'less' | 161 #for $key in $manipulate.keys |
118 filtered = filtered < $manipulate.filter.filter_key.value | 162 if '$key.source_key' in source_adata.uns: |
119 #else if $manipulate.filter.filter_key.filter == 'less_or_equal' | 163 #if str($key.target_key) == '': |
120 filtered = filtered <= $manipulate.filter.filter_key.value | 164 adata.uns['$key.source_key'] = source_adata.uns['$key.source_key'] |
121 #else if $manipulate.filter.filter_key.filter == 'greater' | 165 #else |
122 filtered = filtered > $manipulate.filter.filter_key.value | 166 adata.uns['$key.target_key'] = source_adata.uns['$key.source_key'] |
123 #else if $manipulate.filter.filter_key.filter == 'greater_or_equal' | |
124 filtered = filtered >= $manipulate.filter.filter_key.value | |
125 #end if | |
126 #else if $manipulate.filter.filter_key.type == 'text' | |
127 #if $manipulate.filter.filter_key.filter == 'equal' | |
128 filtered = filtered == '$manipulate.filter.filter_key.value' | |
129 #else | |
130 filtered = filtered != '$manipulate.filter.filter_key.value' | |
131 #end if | |
132 #else if $manipulate.filter.filter_key.type == 'boolean' | |
133 filtered = filtered == $manipulate.filter.filter_key.value | |
134 #end if | 167 #end if |
135 | 168 else: |
136 #else if $manipulate.filter.filter == 'index' | 169 print(f"Uns key {'{$key.source_key}'} not found in source AnnData.") |
137 #if str($manipulate.filter.index.format) == 'file' | 170 #end for |
138 with open('$manipulate.filter.index.file', 'r') as filter_f: | 171 |
139 filters = [str(x.strip()) for x in filter_f.readlines()] | 172 #else if $manipulate.function == 'copy_embed' |
140 filtered = filters | 173 source_adata = ad.read_h5ad('$source_adata') |
174 #for $key in $manipulate.keys | |
175 if '$key.source_key' in source_adata.obsm: | |
176 #if $key.target_key is None | |
177 adata.obsm['$key.source_key'] = source_adata.obsm['$key.source_key'] | |
141 #else | 178 #else |
142 #set $filters = [str(x.strip()) for x in $manipulate.filter.index.text.split(',')] | 179 adata.obsm['$key.target_key'] = source_adata.obsm['$key.source_key'] |
143 filtered = $filters | |
144 #end if | 180 #end if |
145 #end if | 181 else: |
146 print(filtered) | 182 print(f"Embedding key {'{$key.source_key}'} not found in source AnnData.") |
147 | 183 #end for |
148 #if $manipulate.var_obs == 'var' | 184 |
149 adata = adata[:,filtered] | 185 #else if $manipulate.function == 'copy_layers' |
150 #else if $manipulate.var_obs == 'obs' | 186 source_adata = ad.read_h5ad('$source_adata') |
151 adata = adata[filtered, :] | 187 #for $key in $manipulate.keys |
188 if '$key.source_key' in source_adata.layers: | |
189 #if $key.target_key is None | |
190 adata.layers['$key.source_key'] = source_adata.layers['$key.source_key'] | |
191 #else | |
192 adata.layers['$key.target_key'] = source_adata.layers['$key.source_key'] | |
193 #end if | |
194 else: | |
195 print(f"Layer {'{$key.source_key}'} not found in source AnnData.") | |
196 #end for | |
197 | |
198 #else if $manipulate.function == 'copy_X' | |
199 source_adata = ad.read_h5ad('$source_adata') | |
200 #if $target_key is None | |
201 adata.X = source_adata.X | |
202 #else | |
203 adata.layers['$target_key'] = source_adata.X | |
152 #end if | 204 #end if |
153 | 205 |
154 #else if $manipulate.function == 'save_raw' | 206 #else if $manipulate.function == 'save_raw' |
155 adata.raw = adata | 207 adata.raw = adata |
156 | 208 |
171 <option value="obs_names_make_unique">Makes the obs index unique by appending '1', '2', etc</option> | 223 <option value="obs_names_make_unique">Makes the obs index unique by appending '1', '2', etc</option> |
172 <option value="var_names_make_unique">Makes the var index unique by appending '1', '2', etc</option> | 224 <option value="var_names_make_unique">Makes the var index unique by appending '1', '2', etc</option> |
173 <option value="rename_categories">Rename categories of annotation</option> | 225 <option value="rename_categories">Rename categories of annotation</option> |
174 <option value="remove_keys">Remove keys from obs or var annotations</option> | 226 <option value="remove_keys">Remove keys from obs or var annotations</option> |
175 <option value="flag_genes">Flag genes start with a pattern</option><!--adapted from EBI anndata operations tool --> | 227 <option value="flag_genes">Flag genes start with a pattern</option><!--adapted from EBI anndata operations tool --> |
228 <option value="rename_obs">Rename fileds in AnnData observations</option><!--adapted from EBI anndata operations tool --> | |
229 <option value="rename_var">Rename fileds in AnnData variables</option><!--adapted from EBI anndata operations tool --> | |
176 <option value="strings_to_categoricals">Transform string annotations to categoricals</option> | 230 <option value="strings_to_categoricals">Transform string annotations to categoricals</option> |
177 <option value="transpose">Transpose the data matrix, leaving observations and variables interchanged</option> | 231 <option value="transpose">Transpose the data matrix, leaving observations and variables interchanged</option> |
178 <option value="add_annotation">Add new annotation(s) for observations or variables</option> | 232 <option value="add_annotation">Add new annotation(s) for observations or variables</option> |
179 <option value="split_on_obs">Split the AnnData object into multiple AnnData objects based on the values of a given obs key</option><!--adapted from EBI anndata operations tool--> | 233 <option value="split_on_obs">Split the AnnData object into multiple AnnData objects based on the values of a given obs key</option><!--adapted from EBI anndata operations tool--> |
180 <option value="filter">Filter observations or variables</option> | 234 <option value="copy_obs">Copy observation keys from a different anndata object</option> |
235 <option value="copy_uns">Copy uns keys from a different anndata object</option> | |
236 <option value="copy_embed">Copy embeddings from a different anndata object</option> | |
237 <option value="copy_layers">Copy layers from a different anndata object</option> | |
238 <option value="copy_X">Copy data matrix (.X) from a different anndata object</option> | |
181 <option value="save_raw">Freeze the current state into the 'raw' attribute</option> | 239 <option value="save_raw">Freeze the current state into the 'raw' attribute</option> |
182 </param> | 240 </param> |
183 <when value="concatenate"> | 241 <when value="concatenate"> |
184 <param name="other_adatas" type="data" format="h5ad" multiple="true" label="Annotated data matrix to add"/> | 242 <param name="other_adatas" type="data" format="h5ad" multiple="true" label="Annotated data matrix to add"/> |
185 <param name="join" type="select" label="Join method"> | 243 <param name="join" type="select" label="Join method"> |
186 <option value="inner">Intersection of variables</option> | 244 <option value="inner">Intersection of variables</option> |
187 <option value="outer">Union of variables</option> | 245 <option value="outer">Union of variables</option> |
188 </param> | 246 </param> |
189 <param name="batch_key" type="text" value="batch" label="Key to add the batch annotation to obs"/> | 247 <param name="batch_key" type="text" value="batch" label="Key to add the batch annotation to obs"/> |
248 <param name="uns_merge" type="select" label="Strategy to use for merging entries of uns" help="These strategies are applied recusivley."> | |
249 <option value="None" selected="true">The default. The concatenated object will just have an empty dict for uns</option> | |
250 <option value="same">Only entries which have the same value in all AnnData objects are kept</option> | |
251 <option value="unique">Only entries which have one unique value in all AnnData objects are kept</option> | |
252 <option value="first">The first non-missing value is used</option> | |
253 <option value="only">A value is included if only one of the AnnData objects has a value at this path</option> | |
254 </param> | |
190 <param name="index_unique" type="select" label="Separator to join the existing index names with the batch category" help="Leave it empty to keep existing indices"> | 255 <param name="index_unique" type="select" label="Separator to join the existing index names with the batch category" help="Leave it empty to keep existing indices"> |
191 <option value="-">-</option> | 256 <option value="-">-</option> |
192 <option value="_">_</option> | 257 <option value="_">_</option> |
193 <option value=" "> </option> | 258 <option value=" "> </option> |
194 <option value="/">/</option> | 259 <option value="/">/</option> |
201 <expand macro="param_join"/> | 266 <expand macro="param_join"/> |
202 </when> | 267 </when> |
203 <when value="rename_categories"> | 268 <when value="rename_categories"> |
204 <param name="key" type="text" value="" label="Key for observations or variables annotation" help="Annotation key in obs or var"/> | 269 <param name="key" type="text" value="" label="Key for observations or variables annotation" help="Annotation key in obs or var"/> |
205 <param name="categories" type="text" value="" label="Comma-separated list of new categories" help="It should be the same number as the old categories"/> | 270 <param name="categories" type="text" value="" label="Comma-separated list of new categories" help="It should be the same number as the old categories"/> |
271 <conditional name="update_key"> | |
272 <param name="new_key" type="select" label="Add categories to a new key?" help="If Yes, a new key will be created with the new categories, otherwise the old key will be updated"> | |
273 <option value="yes">Yes</option> | |
274 <option value="no" selected="true">No</option> | |
275 </param> | |
276 <when value="yes"> | |
277 <param name="key_name" type="text" value="" optional="false" label="Key name"> | |
278 <expand macro="sanitize_query"/> | |
279 </param> | |
280 </when> | |
281 <when value="no"></when> | |
282 </conditional> | |
206 </when> | 283 </when> |
207 <when value="remove_keys"> | 284 <when value="remove_keys"> |
208 <param name="obs_keys" type="text" value="" optional="true" label="Keys/fields to remove from observations (obs)"> | 285 <param name="obs_keys" type="text" value="" optional="true" label="Keys/fields to remove from observations (obs)"> |
209 <expand macro="sanitize_query"/> | 286 <expand macro="sanitize_query"/> |
210 </param> | 287 </param> |
219 <valid initial="string.ascii_letters,string.digits,string.punctuation"> | 296 <valid initial="string.ascii_letters,string.digits,string.punctuation"> |
220 <remove value="'" /> | 297 <remove value="'" /> |
221 </valid> | 298 </valid> |
222 </sanitizer> | 299 </sanitizer> |
223 </param> | 300 </param> |
224 <param name="col_name" type="text" label="Name of the column in var.names where this boolean flag is stored" help="For example, name this column as 'mito' for mitochondrial genes."/> | 301 <param name="col_in" value='' optional="true" type="text" label="Column in .var to use" help="By default it uses the var_names (normally gene symbols)"> |
225 </repeat> | 302 <expand macro="sanitize_query"/> |
303 </param> | |
304 <param name="col_out" type="text" label="Name of the column in var.names where this boolean flag is stored" help="For example, name this column as 'mito' for mitochondrial genes."> | |
305 <expand macro="sanitize_query"/> | |
306 </param> | |
307 </repeat> | |
308 </when> | |
309 <when value="rename_obs"> | |
310 <param name="from_obs" type="text" label="Name of the observations field that you want to change"> | |
311 <expand macro="sanitize_query"/> | |
312 </param> | |
313 <param name="to_obs" type="text" label="New name of the field in the observations"> | |
314 <expand macro="sanitize_query"/> | |
315 </param> | |
316 <param name="keep_original" type="boolean" checked="false" label="Keep original" help="If activated, it will also keep the original column"/> | |
317 </when> | |
318 <when value="rename_var"> | |
319 <param name="from_var" type="text" label="Name of the variables field that you want to change"> | |
320 <expand macro="sanitize_query"/> | |
321 </param> | |
322 <param name="to_var" type="text" label="New name of the filed in the variables"> | |
323 <expand macro="sanitize_query"/> | |
324 </param> | |
325 <param name="keep_original" type="boolean" checked="false" label="Keep original" help="If activated, it will also keep the original column"/> | |
226 </when> | 326 </when> |
227 <when value="strings_to_categoricals" ></when> | 327 <when value="strings_to_categoricals" ></when> |
228 <when value="transpose" ></when> | 328 <when value="transpose" ></when> |
229 <when value="add_annotation"> | 329 <when value="add_annotation"> |
230 <param name="var_obs" type="select" label="What to annotate?"> | 330 <param name="var_obs" type="select" label="What to annotate?"> |
231 <option value="var">Variables (var)</option> | 331 <option value="var">Variables (var)</option> |
232 <option value="obs">Observations (obs)</option> | 332 <option value="obs">Observations (obs)</option> |
233 </param> | 333 </param> |
234 <param name="new_annot" type="data" format="tabular" label="Table with new annotations" | 334 <param name="new_annot" type="data" format="tabular" label="Table with new annotations" |
235 help="The new table should have the same number of rows and same order than obs or var. The key names should be in the header (1st line)"/> | 335 help="The new table should have the same number of rows and the same order as obs or var. The key names should be in the header (1st line)"/> |
236 </when> | 336 </when> |
237 <when value="split_on_obs"> | 337 <when value="split_on_obs"> |
238 <param name="key" type="text" label="The obs key to split on" help="For example, if you want to split on cluster annotation, you can use the key 'louvain'. The output will be a collection of anndata objects"> | 338 <param name="key" type="text" label="The obs key to split on" help="For example, if you want to split on cluster annotation, you can use the key 'louvain'. The output will be a collection of anndata objects"> |
239 <sanitizer invalid_char=""> | 339 <sanitizer invalid_char=""> |
240 <valid initial="string.ascii_letters,string.digits,string.punctuation"> | 340 <valid initial="string.ascii_letters,string.digits,string.punctuation"> |
241 <remove value="'" /> | 341 <remove value="'" /> |
242 </valid> | 342 </valid> |
243 </sanitizer> | 343 </sanitizer> |
244 </param> | 344 </param> |
245 </when> | 345 </when> |
246 <when value="filter"> | |
247 <param name="var_obs" type="select" label="What to filter?"> | |
248 <option value="var">Variables (var)</option> | |
249 <option value="obs">Observations (obs)</option> | |
250 </param> | |
251 <conditional name="filter"> | |
252 <param name="filter" type="select" label="Type of filtering?"> | |
253 <option value="key">By key (column) values</option> | |
254 <option value="index">By index (row)</option> | |
255 </param> | |
256 <when value="key"> | |
257 <param name="key" type="text" value="n_genes" label="Key to filter"/> | |
258 <conditional name="filter_key"> | |
259 <param name="type" type="select" label="Type of value to filter"> | |
260 <option value="number">Number</option> | |
261 <option value="text">Text</option> | |
262 <option value="boolean">Boolean</option> | |
263 </param> | |
264 <when value="number"> | |
265 <param name="filter" type="select" label="Filter"> | |
266 <option value="equal">equal to</option> | |
267 <option value="not_equal">not equal to</option> | |
268 <option value="less">less than</option> | |
269 <option value="less_or_equal">less than or equal to</option> | |
270 <option value="greater">greater than</option> | |
271 <option value="greater_or_equal">greater than or equal to</option> | |
272 </param> | |
273 <param name="value" type="float" value="2500" label="Value"/> | |
274 </when> | |
275 <when value="text"> | |
276 <param name="filter" type="select" label="Filter"> | |
277 <option value="equal">equal to</option> | |
278 <option value="not_equal">not equal to</option></param> | |
279 <param name="value" type="text" value="2500" label="Value"/> | |
280 </when> | |
281 <when value="boolean"> | |
282 <param name="value" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Value to keep"/> | |
283 </when> | |
284 </conditional> | |
285 </when> | |
286 <when value="index"> | |
287 <conditional name="index"> | |
288 <param name="format" type="select" label="Format for the filter by index"> | |
289 <option value="file">File</option> | |
290 <option value="text" selected="true">Text</option> | |
291 </param> | |
292 <when value="text"> | |
293 <param name="text" type="text" value="" label="List of index to keep" help="Indexes separated by a comma"/> | |
294 </when> | |
295 <when value="file"> | |
296 <param name="file" type="data" format="txt" label="File with the list of index to keep" help="One index per line"/> | |
297 </when> | |
298 </conditional> | |
299 </when> | |
300 </conditional> | |
301 </when> | |
302 <when value="save_raw"></when> | 346 <when value="save_raw"></when> |
347 <when value="copy_obs"> | |
348 <param name="source_adata" type="data" format="h5ad" label="Source anndata object" help="Ideally the source AnnData object should contain the same set of genes and cells."/> | |
349 <repeat name="keys" title="Keys from obs to copy" min="1"> | |
350 <param name="source_key" type="text" optional="true" label="Column to be copied from the source anndata" help="louvain, batch, etc. Provide one key at a time."> | |
351 <expand macro="sanitize_query"/> | |
352 </param> | |
353 <param name="target_key" type="text" optional="true" label="Target column name" help="Warning! Provide a new key name to avoid rewriting. Leave empty to copy to the same key."> | |
354 <expand macro="sanitize_query"/> | |
355 </param> | |
356 </repeat> | |
357 </when> | |
358 <when value="copy_uns"> | |
359 <param name="source_adata" type="data" format="h5ad" label="Source anndata object" help="Ideally the source AnnData object should contain the same set of genes and cells."/> | |
360 <repeat name="keys" title="Keys from uns to copy" min="1"> | |
361 <param name="source_key" type="text" optional="true" label="Uns key to be copied from the source anndata" help="hvg, neighbors, etc. Provide one key at a time."> | |
362 <expand macro="sanitize_query"/> | |
363 </param> | |
364 <param name="target_key" type="text" optional="true" label="Target key name" help="Warning! Provide a new key name to avoid rewriting. Leave empty to copy to the same key."> | |
365 <expand macro="sanitize_query"/> | |
366 </param> | |
367 </repeat> | |
368 </when> | |
369 <when value="copy_embed"> | |
370 <param name="source_adata" type="data" format="h5ad" label="Source anndata object" help="Ideally the source AnnData object should contain the same set of genes and cells."/> | |
371 <repeat name="keys" title="Keys from embeddings to copy" min="1"> | |
372 <param name="source_key" type="text" label="Key to be copied from the source anndata" help="tSNE, UMAP, etc. Provide one key at a time."> | |
373 <expand macro="sanitize_query"/> | |
374 </param> | |
375 <param name="target_key" type="text" optional="true" label="Target key name" help="Warning! Provide a new key name to avoid rewriting. Leave empty to copy to the same key."> | |
376 <expand macro="sanitize_query"/> | |
377 </param> | |
378 </repeat> | |
379 </when> | |
380 <when value="copy_layers"> | |
381 <param name="source_adata" type="data" format="h5ad" label="Source anndata object" help="Ideally the source AnnData object should contain the same set of genes and cells."/> | |
382 <repeat name="keys" title="Layers to copy" min="1"> | |
383 <param name="source_key" type="text" label="Layer to be copied from the source anndata"> | |
384 <expand macro="sanitize_query"/> | |
385 </param> | |
386 <param name="target_key" type="text" optional="true" label="Target layer name" help="Warning! give a new key name to avoid rewriting. Leave empty to copy to the same key."> | |
387 <expand macro="sanitize_query"/> | |
388 </param> | |
389 </repeat> | |
390 </when> | |
391 <when value="copy_X"> | |
392 <param name="source_adata" type="data" format="h5ad" label="Source anndata object" help="Ideally the source AnnData object should contain the same set of genes and cells."/> | |
393 <param name="target_key" type="text" optional="true" label="Give a target layer name or leave empty to overwrite .X" help="Warning! give a new key name to avoid rewriting. Leave empty to copy to the .X of the current anndata"> | |
394 <expand macro="sanitize_query"/> | |
395 </param> | |
396 </when> | |
303 </conditional> | 397 </conditional> |
304 </inputs> | 398 </inputs> |
305 <outputs> | 399 <outputs> |
306 <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${manipulate.function}) on ${on_string}"> | 400 <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${manipulate.function}) on ${on_string}"> |
307 <filter>manipulate['function'] != 'split_on_obs'</filter> | 401 <filter>manipulate['function'] != 'split_on_obs'</filter> |
379 <param name="input" value="krumsiek11.h5ad"/> | 473 <param name="input" value="krumsiek11.h5ad"/> |
380 <conditional name="manipulate"> | 474 <conditional name="manipulate"> |
381 <param name="function" value="rename_categories"/> | 475 <param name="function" value="rename_categories"/> |
382 <param name="key" value="cell_type"/> | 476 <param name="key" value="cell_type"/> |
383 <param name="categories" value="ery, mk, mo, progenitor"/> | 477 <param name="categories" value="ery, mk, mo, progenitor"/> |
478 <conditional name="update_key"> | |
479 <param name="new_key" value="no"/> | |
480 </conditional> | |
384 </conditional> | 481 </conditional> |
385 <assert_stdout> | 482 <assert_stdout> |
386 <has_text_matching expression="adata.rename_categories"/> | 483 <has_text_matching expression="adata.rename_categories"/> |
387 <has_text_matching expression="key='cell_type'"/> | 484 <has_text_matching expression="key='cell_type'"/> |
388 <has_text_matching expression="categories=\['ery', 'mk', 'mo', 'progenitor'\]"/> | 485 <has_text_matching expression="categories=\['ery', 'mk', 'mo', 'progenitor'\]"/> |
476 </test> | 573 </test> |
477 <test expect_num_outputs="1"> | 574 <test expect_num_outputs="1"> |
478 <!-- test 9 --> | 575 <!-- test 9 --> |
479 <param name="input" value="krumsiek11.h5ad"/> | 576 <param name="input" value="krumsiek11.h5ad"/> |
480 <conditional name="manipulate"> | 577 <conditional name="manipulate"> |
481 <param name="function" value="filter"/> | 578 <param name="function" value="save_raw"/> |
482 <param name="var_obs" value="var"/> | 579 </conditional> |
483 <conditional name="filter"> | 580 <assert_stdout> |
484 <param name="filter" value="index"/> | 581 <has_text_matching expression="500 × 11"/> |
485 <conditional name="index"> | |
486 <param name="format" value="text"/> | |
487 <param name="text" value="Gata2,EKLF"/> | |
488 </conditional> | |
489 </conditional> | |
490 </conditional> | |
491 <assert_stdout> | |
492 <has_text_matching expression="500 × 2"/> | |
493 </assert_stdout> | 582 </assert_stdout> |
494 <output name="anndata" ftype="h5ad"> | 583 <output name="anndata" ftype="h5ad"> |
495 <assert_contents> | 584 <assert_contents> |
496 <has_h5_keys keys="obs/cell_type"/> | 585 <has_h5_keys keys="obs/cell_type"/> |
497 <has_h5_keys keys="uns/highlights"/> | 586 <has_h5_keys keys="uns/highlights"/> |
498 <has_h5_keys keys="uns/iroot"/> | 587 <has_h5_keys keys="uns/iroot"/> |
499 </assert_contents> | 588 </assert_contents> |
500 </output> | 589 </output> |
501 </test> | 590 </test> |
502 <test expect_num_outputs="1"> | 591 <test expect_num_outputs="1"> |
503 <!-- test 10 --> | 592 <!-- test 10 remove_keys --> |
504 <param name="input" value="krumsiek11.h5ad"/> | |
505 <conditional name="manipulate"> | |
506 <param name="function" value="filter"/> | |
507 <param name="var_obs" value="obs"/> | |
508 <conditional name="filter"> | |
509 <param name="filter" value="key"/> | |
510 <param name="key" value="cell_type"/> | |
511 <conditional name="filter_key"> | |
512 <param name="type" value="text"/> | |
513 <param name="filter" value="equal"/> | |
514 <param name="value" value="progenitor"/> | |
515 </conditional> | |
516 </conditional> | |
517 </conditional> | |
518 <assert_stdout> | |
519 <has_text_matching expression="260 × 11"/> | |
520 </assert_stdout> | |
521 <output name="anndata" ftype="h5ad"> | |
522 <assert_contents> | |
523 <has_h5_keys keys="obs/cell_type"/> | |
524 <has_h5_keys keys="uns/highlights"/> | |
525 <has_h5_keys keys="uns/iroot"/> | |
526 </assert_contents> | |
527 </output> | |
528 </test> | |
529 <test expect_num_outputs="1"> | |
530 <!-- test 11 --> | |
531 <param name="input" value="krumsiek11.h5ad"/> | |
532 <conditional name="manipulate"> | |
533 <param name="function" value="save_raw"/> | |
534 </conditional> | |
535 <assert_stdout> | |
536 <has_text_matching expression="500 × 11"/> | |
537 </assert_stdout> | |
538 <output name="anndata" ftype="h5ad"> | |
539 <assert_contents> | |
540 <has_h5_keys keys="obs/cell_type"/> | |
541 <has_h5_keys keys="uns/highlights"/> | |
542 <has_h5_keys keys="uns/iroot"/> | |
543 </assert_contents> | |
544 </output> | |
545 </test> | |
546 <test expect_num_outputs="1"> | |
547 <!-- test 12 remove_keys --> | |
548 <param name="input" value="krumsiek11.h5ad"/> | 593 <param name="input" value="krumsiek11.h5ad"/> |
549 <conditional name="manipulate"> | 594 <conditional name="manipulate"> |
550 <param name="function" value="remove_keys"/> | 595 <param name="function" value="remove_keys"/> |
551 <param name="obs_keys" value="cell_type"/> | 596 <param name="obs_keys" value="cell_type"/> |
552 </conditional> | 597 </conditional> |
559 <has_h5_keys keys="uns/iroot"/> | 604 <has_h5_keys keys="uns/iroot"/> |
560 </assert_contents> | 605 </assert_contents> |
561 </output> | 606 </output> |
562 </test> | 607 </test> |
563 <test expect_num_outputs="1"> | 608 <test expect_num_outputs="1"> |
564 <!-- test 13 flag_genes --> | 609 <!-- test 11 flag_genes --> |
565 <param name="input" value="krumsiek11.h5ad"/> | 610 <param name="input" value="krumsiek11.h5ad"/> |
566 <conditional name="manipulate"> | 611 <conditional name="manipulate"> |
567 <param name="function" value="flag_genes"/> | 612 <param name="function" value="flag_genes"/> |
568 <repeat name="gene_flags"> | 613 <repeat name="gene_flags"> |
569 <param name="startswith" value="Gata"/> | 614 <param name="startswith" value="Gata"/> |
570 <param name="col_name" value="Gata_TF"/> | 615 <param name="col_out" value="Gata_TF"/> |
571 </repeat> | 616 </repeat> |
572 <repeat name="gene_flags"> | 617 <repeat name="gene_flags"> |
573 <param name="startswith" value="Gf"/> | 618 <param name="startswith" value="Gf"/> |
574 <param name="col_name" value="GF"/> | 619 <param name="col_out" value="GF"/> |
575 </repeat> | 620 </repeat> |
576 </conditional> | 621 </conditional> |
577 <assert_stdout> | 622 <assert_stdout> |
578 <has_text_matching expression="500 × 11"/> | 623 <has_text_matching expression="500 × 11"/> |
579 </assert_stdout> | 624 </assert_stdout> |
583 <has_h5_keys keys="var/GF"/> | 628 <has_h5_keys keys="var/GF"/> |
584 </assert_contents> | 629 </assert_contents> |
585 </output> | 630 </output> |
586 </test> | 631 </test> |
587 <test expect_num_outputs="1"> | 632 <test expect_num_outputs="1"> |
588 <!-- test 14 split_on_obs --> | 633 <!-- test 12 split_on_obs --> |
589 <param name="input" value="krumsiek11.h5ad"/> | 634 <param name="input" value="krumsiek11.h5ad"/> |
590 <conditional name="manipulate"> | 635 <conditional name="manipulate"> |
591 <param name="function" value="split_on_obs"/> | 636 <param name="function" value="split_on_obs"/> |
592 <param name="key" value="cell_type"/> | 637 <param name="key" value="cell_type"/> |
593 </conditional> | 638 </conditional> |
620 <has_h5_keys keys="uns/iroot"/> | 665 <has_h5_keys keys="uns/iroot"/> |
621 </assert_contents> | 666 </assert_contents> |
622 </element> | 667 </element> |
623 </output_collection> | 668 </output_collection> |
624 </test> | 669 </test> |
670 <test expect_num_outputs="1"> | |
671 <!-- test 13 rename categories with new key --> | |
672 <param name="input" value="krumsiek11.h5ad"/> | |
673 <conditional name="manipulate"> | |
674 <param name="function" value="rename_categories"/> | |
675 <param name="key" value="cell_type"/> | |
676 <param name="categories" value="ery, mk, mo, progenitor"/> | |
677 <conditional name="update_key"> | |
678 <param name="new_key" value="yes"/> | |
679 <param name="key_name" value="new_cell_type"/> | |
680 </conditional> | |
681 </conditional> | |
682 <assert_stdout> | |
683 <has_text_matching expression="adata.rename_categories"/> | |
684 <has_text_matching expression="key='new_cell_type'"/> | |
685 <has_text_matching expression="categories=\['ery', 'mk', 'mo', 'progenitor'\]"/> | |
686 <has_text_matching expression="changing key in obs"/> | |
687 <has_text_matching expression="500 × 11"/> | |
688 </assert_stdout> | |
689 <output name="anndata" ftype="h5ad"> | |
690 <assert_contents> | |
691 <has_h5_keys keys="obs/cell_type"/> | |
692 <has_h5_keys keys="obs/new_cell_type"/> | |
693 <has_h5_keys keys="uns/highlights"/> | |
694 <has_h5_keys keys="uns/iroot"/> | |
695 </assert_contents> | |
696 </output> | |
697 </test> | |
698 <test expect_num_outputs="1"> | |
699 <!-- test 14 flag_genes with a key --> | |
700 <param name="input" value="flag_new_key.h5ad"/> | |
701 <conditional name="manipulate"> | |
702 <param name="function" value="flag_genes"/> | |
703 <repeat name="gene_flags"> | |
704 <param name="startswith" value="ENSG"/> | |
705 <param name="col_in" value="gene_ids"/> | |
706 <param name="col_out" value="ensembl"/> | |
707 </repeat> | |
708 </conditional> | |
709 <assert_stdout> | |
710 <has_text_matching expression="199 × 199"/> | |
711 </assert_stdout> | |
712 <output name="anndata" ftype="h5ad"> | |
713 <assert_contents> | |
714 <has_h5_keys keys="var/ensembl"/> | |
715 </assert_contents> | |
716 </output> | |
717 </test> | |
718 <test expect_num_outputs="1"> | |
719 <!-- test 15 copy_obs --> | |
720 <param name="input" value="krumsiek11.h5ad"/> | |
721 <conditional name="manipulate"> | |
722 <param name="function" value="copy_obs"/> | |
723 <param name="source_adata" value="krumsiek11.h5ad"/> | |
724 <repeat name="keys"> | |
725 <param name="source_key" value="cell_type"/> | |
726 <param name="target_key" value="new_cell_type"/> | |
727 </repeat> | |
728 </conditional> | |
729 <assert_stdout> | |
730 <has_text_matching expression="adata.obs\['new_cell_type'\] = source_adata.obs\['cell_type'\]"/> | |
731 <has_text_matching expression="500 × 11"/> | |
732 </assert_stdout> | |
733 <output name="anndata" ftype="h5ad"> | |
734 <assert_contents> | |
735 <has_h5_keys keys="obs/cell_type"/> | |
736 <has_h5_keys keys="obs/new_cell_type"/> | |
737 <has_h5_keys keys="uns/highlights"/> | |
738 <has_h5_keys keys="uns/iroot"/> | |
739 </assert_contents> | |
740 </output> | |
741 </test> | |
742 <test expect_num_outputs="1"> | |
743 <!-- test 16 copy_uns --> | |
744 <param name="input" value="krumsiek11.h5ad"/> | |
745 <conditional name="manipulate"> | |
746 <param name="function" value="copy_uns"/> | |
747 <param name="source_adata" value="krumsiek11.h5ad"/> | |
748 <repeat name="keys"> | |
749 <param name="source_key" value="iroot"/> | |
750 <param name="target_key" value="new_iroot"/> | |
751 </repeat> | |
752 </conditional> | |
753 <assert_stdout> | |
754 <has_text_matching expression="adata.uns\['new_iroot'\] = source_adata.uns\['iroot'\]"/> | |
755 <has_text_matching expression="500 × 11"/> | |
756 </assert_stdout> | |
757 <output name="anndata" ftype="h5ad"> | |
758 <assert_contents> | |
759 <has_h5_keys keys="obs/cell_type"/> | |
760 <has_h5_keys keys="uns/highlights"/> | |
761 <has_h5_keys keys="uns/iroot"/> | |
762 <has_h5_keys keys="uns/new_iroot"/> | |
763 </assert_contents> | |
764 </output> | |
765 </test> | |
766 <test expect_num_outputs="1"> | |
767 <!-- test 17 copy_embed --> | |
768 <param name="input" value="tl.umap.h5ad"/> | |
769 <conditional name="manipulate"> | |
770 <param name="function" value="copy_embed"/> | |
771 <param name="source_adata" value="tl.umap.h5ad"/> | |
772 <repeat name="keys"> | |
773 <param name="source_key" value="X_pca"/> | |
774 <param name="target_key" value="new_X_pca"/> | |
775 </repeat> | |
776 </conditional> | |
777 <assert_stdout> | |
778 <has_text_matching expression="adata.obsm\['new_X_pca'\] = source_adata.obsm\['X_pca'\]"/> | |
779 <has_text_matching expression="100 × 800"/> | |
780 </assert_stdout> | |
781 <output name="anndata" ftype="h5ad"> | |
782 <assert_contents> | |
783 <has_h5_keys keys="obs/paul15_clusters"/> | |
784 <has_h5_keys keys="uns/neighbors"/> | |
785 <has_h5_keys keys="uns/iroot"/> | |
786 <has_h5_keys keys="obsm/X_pca"/> | |
787 <has_h5_keys keys="obsm/new_X_pca"/> | |
788 <has_h5_keys keys="obsm/X_umap"/> | |
789 <has_h5_keys keys="layers/count"/> | |
790 <has_h5_keys keys="obsp/connectivities"/> | |
791 <has_h5_keys keys="obsp/distances"/> | |
792 </assert_contents> | |
793 </output> | |
794 </test> | |
795 <test expect_num_outputs="1"> | |
796 <!-- test 18 copy_layers --> | |
797 <param name="input" value="tl.umap.h5ad"/> | |
798 <conditional name="manipulate"> | |
799 <param name="function" value="copy_layers"/> | |
800 <param name="source_adata" value="tl.umap.h5ad"/> | |
801 <repeat name="keys"> | |
802 <param name="source_key" value="count"/> | |
803 <param name="target_key" value="new_count"/> | |
804 </repeat> | |
805 </conditional> | |
806 <assert_stdout> | |
807 <has_text_matching expression="adata.layers\['new_count'\] = source_adata.layers\['count'\]"/> | |
808 <has_text_matching expression="100 × 800"/> | |
809 </assert_stdout> | |
810 <output name="anndata" ftype="h5ad"> | |
811 <assert_contents> | |
812 <has_h5_keys keys="obs/paul15_clusters"/> | |
813 <has_h5_keys keys="uns/neighbors"/> | |
814 <has_h5_keys keys="uns/iroot"/> | |
815 <has_h5_keys keys="obsm/X_pca"/> | |
816 <has_h5_keys keys="obsm/X_umap"/> | |
817 <has_h5_keys keys="layers/count"/> | |
818 <has_h5_keys keys="layers/new_count"/> | |
819 <has_h5_keys keys="obsp/connectivities"/> | |
820 <has_h5_keys keys="obsp/distances"/> | |
821 </assert_contents> | |
822 </output> | |
823 </test> | |
824 <test expect_num_outputs="1"> | |
825 <!-- test 19 copy_X --> | |
826 <param name="input" value="tl.umap.h5ad"/> | |
827 <conditional name="manipulate"> | |
828 <param name="function" value="copy_X"/> | |
829 <param name="source_adata" value="tl.umap.h5ad"/> | |
830 <param name="target_key" value="new_X"/> | |
831 </conditional> | |
832 <assert_stdout> | |
833 <has_text_matching expression="adata.layers\['new_X'\] = source_adata.X"/> | |
834 <has_text_matching expression="100 × 800"/> | |
835 </assert_stdout> | |
836 <output name="anndata" ftype="h5ad"> | |
837 <assert_contents> | |
838 <has_h5_keys keys="obs/paul15_clusters"/> | |
839 <has_h5_keys keys="uns/neighbors"/> | |
840 <has_h5_keys keys="uns/iroot"/> | |
841 <has_h5_keys keys="obsm/X_pca"/> | |
842 <has_h5_keys keys="obsm/X_umap"/> | |
843 <has_h5_keys keys="layers/count"/> | |
844 <has_h5_keys keys="layers/new_X"/> | |
845 <has_h5_keys keys="obsp/connectivities"/> | |
846 <has_h5_keys keys="obsp/distances"/> | |
847 </assert_contents> | |
848 </output> | |
849 </test> | |
850 <test expect_num_outputs="1"> | |
851 <!-- test 20 save_raw --> | |
852 <param name="input" value="tl.umap.h5ad"/> | |
853 <conditional name="manipulate"> | |
854 <param name="function" value="save_raw"/> | |
855 </conditional> | |
856 <assert_stdout> | |
857 <has_text_matching expression="adata.raw = adata"/> | |
858 <has_text_matching expression="100 × 800"/> | |
859 </assert_stdout> | |
860 <output name="anndata" ftype="h5ad"> | |
861 <assert_contents> | |
862 <has_h5_keys keys="obs/paul15_clusters"/> | |
863 <has_h5_keys keys="uns/neighbors"/> | |
864 <has_h5_keys keys="uns/iroot"/> | |
865 <has_h5_keys keys="obsm/X_pca"/> | |
866 <has_h5_keys keys="obsm/X_umap"/> | |
867 <has_h5_keys keys="layers/count"/> | |
868 <has_h5_keys keys="obsp/connectivities"/> | |
869 <has_h5_keys keys="obsp/distances"/> | |
870 </assert_contents> | |
871 </output> | |
872 </test> | |
873 <test expect_num_outputs="1"> | |
874 <!-- test 21 rename_obs --> | |
875 <param name="input" value="krumsiek11.h5ad"/> | |
876 <conditional name="manipulate"> | |
877 <param name="function" value="rename_obs"/> | |
878 <param name="from_obs" value="cell_type"/> | |
879 <param name="to_obs" value="new_cell_type"/> | |
880 <param name="keep_original" value="false"/> | |
881 </conditional> | |
882 <assert_stdout> | |
883 <has_text_matching expression="adata.obs\['new_cell_type'\] = adata.obs\['cell_type'\]"/> | |
884 <has_text_matching expression="del adata.obs\['cell_type'\]"/> | |
885 <has_text_matching expression="500 × 11"/> | |
886 </assert_stdout> | |
887 <output name="anndata" ftype="h5ad"> | |
888 <assert_contents> | |
889 <has_h5_keys keys="obs/new_cell_type"/> | |
890 <has_h5_keys keys="uns/highlights"/> | |
891 <has_h5_keys keys="uns/iroot"/> | |
892 </assert_contents> | |
893 </output> | |
894 </test> | |
895 <test expect_num_outputs="1"> | |
896 <!-- test 22 rename_var --> | |
897 <param name="input" value="flag_new_key.h5ad"/> | |
898 <conditional name="manipulate"> | |
899 <param name="function" value="rename_var"/> | |
900 <param name="from_var" value="gene_ids"/> | |
901 <param name="to_var" value="new_id"/> | |
902 <param name="keep_original" value="false"/> | |
903 </conditional> | |
904 <assert_stdout> | |
905 <has_text_matching expression="adata.var\['new_id'\] = adata.var\['gene_ids'\]"/> | |
906 <has_text_matching expression="del adata.var\['gene_ids'\]"/> | |
907 <has_text_matching expression="199 × 199"/> | |
908 </assert_stdout> | |
909 <output name="anndata" ftype="h5ad"> | |
910 <assert_contents> | |
911 <has_h5_keys keys="var/feature_types"/> | |
912 <has_h5_keys keys="var/test"/> | |
913 <has_h5_keys keys="var/new_id"/> | |
914 </assert_contents> | |
915 </output> | |
916 </test> | |
625 </tests> | 917 </tests> |
626 <help><![CDATA[ | 918 <help><![CDATA[ |
627 **What it does** | 919 **What it does** |
628 | 920 |
629 This tool takes a AnnData dataset, manipulates it and returns it. | 921 This tool takes an AnnData dataset, manipulates it and returns it. |
630 | 922 |
631 The possible manipulations are: | 923 The possible manipulations are: |
632 | 924 |
633 - Concatenate along the observations axis (`concatenate method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.concatenate.html>`__) | 925 - Concatenate along the observations axis (`concatenate method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.concatenate.html>`__) |
634 | 926 |
636 | 928 |
637 If you use `join='outer'` this fills 0s for sparse data when variables are absent in a batch. Use this with care. Dense data is filled with `NaN` | 929 If you use `join='outer'` this fills 0s for sparse data when variables are absent in a batch. Use this with care. Dense data is filled with `NaN` |
638 | 930 |
639 - Makes the obs index unique by appending '1', '2', etc (`obs_names_make_unique method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.obs_names_make_unique.html>`__) | 931 - Makes the obs index unique by appending '1', '2', etc (`obs_names_make_unique method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.obs_names_make_unique.html>`__) |
640 | 932 |
641 The first occurance of a non-unique value is ignored. | 933 The first occurrence of a non-unique value is ignored. |
642 | 934 |
643 - Makes the var index unique by appending '1', '2', etc (`var_names_make_unique method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.var_names_make_unique.html>`__) | 935 - Makes the var index unique by appending '1', '2', etc (`var_names_make_unique method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.var_names_make_unique.html>`__) |
644 | 936 |
645 The first occurance of a non-unique value is ignored. | 937 The first occurrence of a non-unique value is ignored. |
646 | 938 |
647 - Rename categories of annotation `key` in `obs`, `var` and `uns` (`rename_categories method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.rename_categories.html>`__) | 939 - Rename categories of annotation `key` in `obs`, `var` and `uns` (`rename_categories method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.rename_categories.html>`__) |
648 | 940 |
649 Besides calling `self.obs[key].cat.categories = categories` - similar for `var` - this also renames categories in unstructured annotation that uses the categorical annotation `key` | 941 Besides calling `self.obs[key].cat.categories = categories` - similar for `var` - this also renames categories in unstructured annotation that uses the categorical annotation `key` |
650 | 942 |
652 | 944 |
653 Helps in cleaning up andata with many annotations. For example, helps in removing qc metrics calculated during the preprocesing or already existing cluster annotations. | 945 Helps in cleaning up andata with many annotations. For example, helps in removing qc metrics calculated during the preprocesing or already existing cluster annotations. |
654 | 946 |
655 - Flag genes start with a pattern | 947 - Flag genes start with a pattern |
656 | 948 |
657 Useful for flagging the mitochoncdrial or ribosomal protein genes | 949 Useful for flagging the mitochondrial or ribosomal protein genes |
658 | 950 |
659 - Transform string annotations to categoricals (`strings_to_categoricals method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.strings_to_categoricals.html>`__) | 951 - Transform string annotations to categoricals (`strings_to_categoricals method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.strings_to_categoricals.html>`__) |
660 | 952 |
661 Only affects string annotations that lead to less categories than the total number of observations. | 953 Only affects string annotations that lead to less categories than the total number of observations. |
662 | 954 |
666 | 958 |
667 - Add annotation for variables or | 959 - Add annotation for variables or |
668 | 960 |
669 - Split the AnnData object into multiple AnnData objects based on the values of a given obs key | 961 - Split the AnnData object into multiple AnnData objects based on the values of a given obs key |
670 | 962 |
671 For example, helps in splitting an anndata objects based on cluster annotation. This function generates a collection with number of elements equal to the number of categories in the input obs key. | 963 For example, helps in splitting an anndata objects based on cluster annotation. This function generates a collection with a number of elements equal to the number of categories in the input obs key. |
672 | 964 |
673 - Filter data variables or observations, by index or key | 965 - Filter data variables or observations, by index or key |
674 | 966 |
675 - Freeze the current state into the 'raw' attribute | 967 - Freeze the current state into the 'raw' attribute |
676 | 968 |