rename
Short Description
sm.hl.rename
: This function offers a straightforward way to rename specific
categories within a chosen column of an AnnData object, with the new names
being stored in a separate column. It streamlines the process of updating or
consolidating category labels for enhanced data clarity and analysis.
Function
rename(adata, rename, from_column='phenotype', to_column='phenotype_renamed', verbose=True)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
Annotated data matrix or path to an AnnData object, containing spatial gene expression data. |
required |
rename |
dict
|
A dictionary mapping existing category names (values) to new category names (keys). Each key corresponds to the new name, and its value is a list of existing names to be consolidated under this new name. |
required |
from_column |
str
|
The name of the column in |
'phenotype'
|
to_column |
str
|
The name of the new column in |
'phenotype_renamed'
|
verbose |
bool
|
If True, prints messages about the renaming process. |
True
|
Returns:
Name | Type | Description |
---|---|---|
adata |
AnnData
|
The AnnData object after applying the renaming operation, with the newly named categories stored in the specified |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Source code in scimap/helpers/rename.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|