foldchange
Short Description
sm.tl.foldchange
: The function allows users to compute the foldchange (fc) in cell-type (phenotype) abundance
between samples or ROI's.
The reference sample or ROI needs to be passed via the from_group
parameter.
The column name of from_group
should be passed via imageid
. The function computes the fc
to all other categories within the same imageid
column. By default (can be turned off), the cell-abundance will
be normalized for the total number of cells within the sample/ROI to account for difference in area.
A fisher-exact-test
is performed to compute the p-values.
The results are stored in .uns
section of the anndata object.
Function
foldchange(adata, from_group, to_group=None, imageid='imageid', phenotype='phenotype', normalize=True, subset_phenotype=None, label='foldchange')
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData object |
required | |
from_group |
list
|
Pass in the name of the sample or ROI that will serve as a reference for calculating fold change. If multiple sample names or ROI's are passed in as a list e.g. ['ROI1', 'ROI2''], please note that they will be combined for calculating the fold change. |
required |
to_group |
list
|
By default the reference sample/ROI passed via |
None
|
imageid |
string
|
The column that contains the samples/ROI information. |
'imageid'
|
phenotype |
string
|
The column that contains the cell-type/phenotype information. |
'phenotype'
|
normalize |
bool
|
Inorder to account for the sample/ROI area, the cellular abundance is first normalized
to the total number of cells within the respective sample/ROI. Please note if you pass values in
|
True
|
subset_phenotype |
list
|
If users are interested in only a subset of cell-types, the names of those can be passed in through this parameter. The data is subsetted to include only these cell types before computing foldchange. |
None
|
label |
string
|
Key for the returned data, stored in |
'foldchange'
|
Returns:
Name | Type | Description |
---|---|---|
adata |
Updated anndata object
Check |
Example
1 2 3 4 5 |
|
Source code in scimap/tools/_foldchange.py
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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|