spatial_distance
Short Description
sm.pl.spatial_distance
: The function allows users to visualize the average shortest distance between phenotypes of interest.
Run sm.tl.spatial_distance
before running this function.
Function
spatial_distance(adata, spatial_distance='spatial_distance', phenotype='phenotype', imageid='imageid', log=False, method='heatmap', heatmap_summarize=True, heatmap_na_color='grey', heatmap_cmap='vlag_r', heatmap_row_cluster=False, heatmap_col_cluster=False, heatmap_standard_scale=0, distance_from=None, distance_to=None, x_axis=None, y_axis=None, facet_by=None, plot_type=None, return_data=False, subset_col=None, subset_value=None, **kwargs)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData object |
required | |
spatial_distance |
string, optional
In order to locate the spatial_distance data within the AnnData object please provide the output
label/columnname of |
'spatial_distance'
|
|
phenotype |
string, required Column name of the column containing the phenotype information. It could also be any categorical assignment given to single cells. |
'phenotype'
|
|
imageid |
string, optional Column name of the column containing the image id. |
'imageid'
|
|
log |
bool, optional Convert distance to log scale. |
False
|
|
method |
string, optional Three options are available. 1) heatmap - generates a heatmap of average shortest distance between all phenotypes. 2) numeric - can be used to generate boxplot, violin plot etc between a given set of phenotypes. 3) distribution - can be used to generate distribution plots between a given set of phenotypes. |
'heatmap'
|
|
heatmap_summarize |
bool, optional In the event multiple images are present in the dataset, True allows to calculate the average across all the images. |
True
|
|
heatmap_na_color |
string, optional Color for NA values within the heatmap. |
'grey'
|
|
heatmap_cmap |
string, optional Color map to use for continous variables. Can be a name or a Colormap instance (e.g. 'magma', 'viridis'). |
'vlag_r'
|
|
heatmap_row_cluster |
bool, optional Cluster Rows. |
False
|
|
heatmap_col_cluster |
bool, optional Cluster Columns. |
False
|
|
heatmap_standard_scale |
int, optional Either 0 (rows) or 1 (columns). Whether or not to standardize that dimension, meaning for each row or column, subtract the minimum and divide each by its maximum. |
0
|
|
distance_from |
string, optional In the event of using method = 'numeric' or 'distribution', this argument is required. Pass a phenotype of interest. If distance_from is provided and distance_to is not provided, the function will plot the average distance from the phenotype of interest to all phenotypes present within the dataset. |
None
|
|
distance_to |
string, optional In the event of using method = 'numeric' or 'distribution', this argument is required. Pass a phenotype of interest. The function will plot the average shortest between two phenotypes of interest (distance_from and distance_to). |
None
|
|
x_axis |
string, optional In the event of using method = 'numeric' or 'distribution', this argument is required. This determines the elements present in the x-axis of the resultant plot. Allowed arguments are: 'group', 'distance', 'imageid'. |
None
|
|
y_axis |
string, optional In the event of using method = 'numeric' or 'distribution', this argument is required. This determines the elements present in the y-axis of the numeric plot and if the user uses the distribution plot this argument is used to overlaying multiple categories within the same distribution plot. Allowed arguments are: 'group', 'distance', 'imageid'. |
None
|
|
facet_by |
string, optional In the event of using method = 'numeric' or 'distribution', this argument can be used to generate sub-plots. Allowed arguments are: 'group', 'imageid'. |
None
|
|
plot_type |
string, optional
In the event of using method = 'numeric' or 'distribution', this argument is required.
For |
None
|
|
subset_col |
string, optional
If the users wants to consider only a subset of observations while plotting, this argument in conjuction to
|
None
|
|
subset_value |
list, optional
If the users wants to consider only a subset of observations while plotting, this argument in conjuction to
|
None
|
|
**kwargs |
dict
Are passed to sns.clustermap. Pass other parameters that works with |
{}
|
Returns:
Type | Description |
---|---|
Heatmap or Numeric Plot or Distribution Plot. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Source code in scimap/plotting/_spatial_distance.py
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 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 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|