groupCorrelation
Short Description
The sm.pl.groupCorrelation
function calculates and visualizes the correlation between group abundances across various conditions within an AnnData
object. Customizable features such as normalization, hierarchical clustering, and manual ordering are available.
Function
groupCorrelation(adata, groupBy, condition, normalize=False, subsetGroups=None, orderRow=None, orderColumn=None, clusterRows=True, clusterColumns=True, cmap='vlag', figsize=None, overlayValues=False, fontSize=10, fontColor='black', fileName='groupCorrelation.pdf', saveDir=None, **kwargs)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData or str
|
An AnnData object containing the dataset, or a string path to an AnnData file to be loaded. |
required |
groupBy |
str
|
The column in |
required |
condition |
str
|
The column in |
required |
normalize |
bool
|
If True, apply z-score normalization to the group counts across conditions. |
False
|
subsetGroups |
list of str
|
A list specifying a subset of groups to include in the analysis. If None, all groups are included. |
None
|
orderRow |
list of str
|
Custom order for the rows in the heatmap. If None, the order is determined by clustering or the original group order. |
None
|
orderColumn |
list of str
|
Custom order for the columns in the heatmap. |
None
|
clusterRows |
bool
|
Whether to apply hierarchical clustering to rows. |
True
|
clusterColumns |
bool
|
Whether to apply hierarchical clustering to columns. |
True
|
cmap |
str
|
The colormap for the heatmap. |
'vlag'
|
figsize |
tuple of float
|
The size of the figure to create (width, height). If None, the size is inferred. |
None
|
overlayValues |
bool
|
If True, overlays the correlation coefficient values on the heatmap. |
False
|
fontSize |
int
|
Font size for overlay values. |
10
|
fontColor |
str
|
Color of the font used for overlay values. |
'black'
|
fileName |
str
|
Name of the file to save the heatmap. Relevant only if |
'groupCorrelation.pdf'
|
saveDir |
str
|
Directory to save the generated heatmap. If None, the heatmap is not saved. |
None
|
Returns:
Name | Type | Description |
---|---|---|
plot |
matplotlib
|
Displays or saves a heatmap visualizing the correlation between specified groups. |
Example
1 2 3 4 5 6 7 8 9 10 11 |
|
Source code in scimap/plotting/groupCorrelation.py
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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|