scmcp-shared 0.4.0__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. scmcp_shared/__init__.py +1 -3
  2. scmcp_shared/agent.py +38 -21
  3. scmcp_shared/backend.py +44 -0
  4. scmcp_shared/cli.py +75 -46
  5. scmcp_shared/kb.py +139 -0
  6. scmcp_shared/logging_config.py +6 -8
  7. scmcp_shared/mcp_base.py +184 -0
  8. scmcp_shared/schema/io.py +101 -59
  9. scmcp_shared/schema/pl.py +386 -490
  10. scmcp_shared/schema/pp.py +514 -265
  11. scmcp_shared/schema/preset/__init__.py +15 -0
  12. scmcp_shared/schema/preset/io.py +103 -0
  13. scmcp_shared/schema/preset/pl.py +843 -0
  14. scmcp_shared/schema/preset/pp.py +616 -0
  15. scmcp_shared/schema/preset/tl.py +917 -0
  16. scmcp_shared/schema/preset/util.py +123 -0
  17. scmcp_shared/schema/tl.py +355 -407
  18. scmcp_shared/schema/util.py +57 -72
  19. scmcp_shared/server/__init__.py +5 -10
  20. scmcp_shared/server/auto.py +15 -11
  21. scmcp_shared/server/code.py +3 -0
  22. scmcp_shared/server/preset/__init__.py +14 -0
  23. scmcp_shared/server/{io.py → preset/io.py} +26 -22
  24. scmcp_shared/server/{pl.py → preset/pl.py} +162 -78
  25. scmcp_shared/server/{pp.py → preset/pp.py} +123 -65
  26. scmcp_shared/server/{tl.py → preset/tl.py} +142 -79
  27. scmcp_shared/server/{util.py → preset/util.py} +123 -66
  28. scmcp_shared/server/rag.py +13 -0
  29. scmcp_shared/util.py +109 -38
  30. {scmcp_shared-0.4.0.dist-info → scmcp_shared-0.6.0.dist-info}/METADATA +6 -2
  31. scmcp_shared-0.6.0.dist-info/RECORD +35 -0
  32. scmcp_shared/server/base.py +0 -148
  33. scmcp_shared-0.4.0.dist-info/RECORD +0 -24
  34. {scmcp_shared-0.4.0.dist-info → scmcp_shared-0.6.0.dist-info}/WHEEL +0 -0
  35. {scmcp_shared-0.4.0.dist-info → scmcp_shared-0.6.0.dist-info}/licenses/LICENSE +0 -0
scmcp_shared/schema/pl.py CHANGED
@@ -1,258 +1,220 @@
1
- from typing import Optional, Union, List, Literal, Any, Collection, Tuple, Sequence, Mapping
2
- from pydantic import (
3
- Field,
4
- ValidationInfo,
5
- computed_field,
6
- field_validator,
7
- model_validator,
8
- BaseModel
9
- )
1
+ from typing import Optional, Union, List, Literal, Tuple, Mapping
2
+ from pydantic import Field, field_validator, BaseModel
3
+
10
4
 
11
5
  # 创建 Mixin 类处理特定功能
12
6
  class LegendMixin:
13
7
  """处理图例相关的字段"""
14
-
8
+
15
9
  legend_fontsize: Optional[Union[int, float, str]] = Field(
16
- default=None,
17
- description="Numeric size in pt or string describing the size."
10
+ default=None, description="Numeric size in pt or string describing the size."
18
11
  )
19
-
12
+
20
13
  legend_fontweight: Union[int, str] = Field(
21
- default='bold',
22
- description="Legend font weight. A numeric value in range 0-1000 or a string."
14
+ default="bold",
15
+ description="Legend font weight. A numeric value in range 0-1000 or a string.",
23
16
  )
24
-
17
+
25
18
  legend_loc: str = Field(
26
- default='right margin',
27
- description="Location of legend, either 'on data', 'right margin' or a valid keyword for the loc parameter."
19
+ default="right margin",
20
+ description="Location of legend, either 'on data', 'right margin' or a valid keyword for the loc parameter.",
28
21
  )
29
-
22
+
30
23
  legend_fontoutline: Optional[int] = Field(
31
- default=None,
32
- description="Line width of the legend font outline in pt."
24
+ default=None, description="Line width of the legend font outline in pt."
33
25
  )
34
26
 
35
27
 
36
28
  class ColorMappingMixin:
37
29
  """处理颜色映射相关的字段"""
38
-
30
+
39
31
  color_map: Optional[str] = Field(
40
- default=None,
41
- description="Color map to use for continuous variables."
32
+ default=None, description="Color map to use for continuous variables."
42
33
  )
43
-
34
+
44
35
  palette: Optional[Union[str, List[str], Mapping[str, str]]] = Field(
45
36
  default=None,
46
- description="Colors to use for plotting categorical annotation groups."
37
+ description="Colors to use for plotting categorical annotation groups.",
47
38
  )
48
-
39
+
49
40
  vmax: Optional[Union[str, float, List[Union[str, float]]]] = Field(
50
41
  default=None,
51
- description="The value representing the upper limit of the color scale."
42
+ description="The value representing the upper limit of the color scale.",
52
43
  )
53
-
44
+
54
45
  vmin: Optional[Union[str, float, List[Union[str, float]]]] = Field(
55
46
  default=None,
56
- description="The value representing the lower limit of the color scale."
47
+ description="The value representing the lower limit of the color scale.",
57
48
  )
58
-
49
+
59
50
  vcenter: Optional[Union[str, float, List[Union[str, float]]]] = Field(
60
51
  default=None,
61
- description="The value representing the center of the color scale."
52
+ description="The value representing the center of the color scale.",
62
53
  )
63
54
 
64
55
 
65
56
  class FigureSizeMixin:
66
57
  """处理图形大小相关的字段"""
67
-
58
+
68
59
  figsize: Optional[Tuple[float, float]] = Field(
69
- default=None,
70
- description="Figure size. Format is (width, height)."
60
+ default=None, description="Figure size. Format is (width, height)."
71
61
  )
72
62
 
73
63
 
74
64
  # 基础可视化模型,包含所有可视化工具共享的字段
75
- class BaseVisualizationParams(BaseModel, LegendMixin, ColorMappingMixin, FigureSizeMixin):
76
- """基础可视化模型,包含所有可视化工具共享的字段"""
65
+ class BaseVisualizationParam(
66
+ BaseModel, LegendMixin, ColorMappingMixin, FigureSizeMixin
67
+ ):
68
+ adata: str = Field(..., description="The AnnData object variable name.")
69
+ """基础可视化模型,包含所有可视化工具共享的字段"""
77
70
  pass
78
71
 
72
+
79
73
  # 基础嵌入可视化模型,包含所有嵌入可视化工具共享的字段
80
- class BaseEmbeddingParams(BaseVisualizationParams):
74
+ class BaseEmbeddingParam(BaseVisualizationParam):
81
75
  """基础嵌入可视化模型,包含所有嵌入可视化工具共享的字段"""
82
-
76
+
83
77
  color: Optional[Union[str, List[str]]] = Field(
84
78
  default=None,
85
- description="Keys for annotations of observations/cells or variables/genes."
79
+ description="Keys for annotations of observations/cells or variables/genes.",
86
80
  )
87
-
81
+
88
82
  gene_symbols: Optional[str] = Field(
89
83
  default=None,
90
- description="Column name in .var DataFrame that stores gene symbols."
84
+ description="Column name in .var DataFrame that stores gene symbols.",
91
85
  )
92
-
86
+
93
87
  use_raw: Optional[bool] = Field(
94
88
  default=None,
95
- description="Use .raw attribute of adata for coloring with gene expression."
89
+ description="Use .raw attribute of adata for coloring with gene expression.",
96
90
  )
97
-
91
+
98
92
  sort_order: bool = Field(
99
93
  default=True,
100
- description="For continuous annotations used as color parameter, plot data points with higher values on top of others."
101
- )
102
-
103
- edges: bool = Field(
104
- default=False,
105
- description="Show edges between nodes."
106
- )
107
-
108
- edges_width: float = Field(
109
- default=0.1,
110
- description="Width of edges."
94
+ description="For continuous annotations used as color parameter, plot data points with higher values on top of others.",
111
95
  )
112
-
96
+
97
+ edges: bool = Field(default=False, description="Show edges between nodes.")
98
+
99
+ edges_width: float = Field(default=0.1, description="Width of edges.")
100
+
113
101
  edges_color: Union[str, List[float], List[str]] = Field(
114
- default='grey',
115
- description="Color of edges."
102
+ default="grey", description="Color of edges."
116
103
  )
117
-
104
+
118
105
  neighbors_key: Optional[str] = Field(
119
- default=None,
120
- description="Where to look for neighbors connectivities."
106
+ default=None, description="Where to look for neighbors connectivities."
121
107
  )
122
-
123
- arrows: bool = Field(
124
- default=False,
125
- description="Show arrows."
126
- )
127
-
108
+
109
+ arrows: bool = Field(default=False, description="Show arrows.")
110
+
128
111
  groups: Optional[Union[str, List[str]]] = Field(
129
112
  default=None,
130
- description="Restrict to a few categories in categorical observation annotation."
113
+ description="Restrict to a few categories in categorical observation annotation.",
131
114
  )
132
-
115
+
133
116
  components: Optional[Union[str, List[str]]] = Field(
134
117
  default=None,
135
- description="For instance, ['1,2', '2,3']. To plot all available components use components='all'."
118
+ description="For instance, ['1,2', '2,3']. To plot all available components use components='all'.",
136
119
  )
137
-
120
+
138
121
  dimensions: Optional[Union[Tuple[int, int], List[Tuple[int, int]]]] = Field(
139
122
  default=None,
140
- description="0-indexed dimensions of the embedding to plot as integers. E.g. [(0, 1), (1, 2)]."
123
+ description="0-indexed dimensions of the embedding to plot as integers. E.g. [(0, 1), (1, 2)].",
141
124
  )
142
-
125
+
143
126
  layer: Optional[str] = Field(
144
127
  default=None,
145
- description="Name of the AnnData object layer that wants to be plotted."
128
+ description="Name of the AnnData object layer that wants to be plotted.",
146
129
  )
147
-
148
- projection: Literal['2d', '3d'] = Field(
149
- default='2d',
150
- description="Projection of plot."
130
+
131
+ projection: Literal["2d", "3d"] = Field(
132
+ default="2d", description="Projection of plot."
151
133
  )
152
-
134
+
153
135
  size: Optional[Union[float, List[float]]] = Field(
154
- default=None,
155
- description="Point size. If None, is automatically computed."
136
+ default=None, description="Point size. If None, is automatically computed."
156
137
  )
157
-
138
+
158
139
  frameon: Optional[bool] = Field(
159
- default=None,
160
- description="Draw a frame around the scatter plot."
140
+ default=None, description="Draw a frame around the scatter plot."
161
141
  )
162
-
142
+
163
143
  add_outline: Optional[bool] = Field(
164
- default=False,
165
- description="Add outline to scatter plot points."
144
+ default=False, description="Add outline to scatter plot points."
166
145
  )
167
-
168
- ncols: int = Field(
169
- default=4,
170
- description="Number of columns for multiple plots."
171
- )
172
-
146
+
147
+ ncols: int = Field(default=4, description="Number of columns for multiple plots.")
148
+
173
149
  marker: Union[str, List[str]] = Field(
174
- default='.',
175
- description="Matplotlib marker style for points."
150
+ default=".", description="Matplotlib marker style for points."
176
151
  )
177
152
 
178
153
 
179
- # 重构 ScatterParams 作为基础散点图模型
180
- class BaseScatterParams(BaseVisualizationParams):
154
+ # 重构 ScatterParam 作为基础散点图模型
155
+ class BaseScatterParam(BaseVisualizationParam):
181
156
  """基础散点图模型"""
182
-
183
- x: Optional[str] = Field(
184
- default=None,
185
- description="x coordinate."
186
- )
187
-
188
- y: Optional[str] = Field(
189
- default=None,
190
- description="y coordinate."
191
- )
192
-
157
+
158
+ x: Optional[str] = Field(default=None, description="x coordinate.")
159
+
160
+ y: Optional[str] = Field(default=None, description="y coordinate.")
161
+
193
162
  color: Optional[Union[str, List[str]]] = Field(
194
163
  default=None,
195
- description="Keys for annotations of observations/cells or variables/genes, or a hex color specification."
164
+ description="Keys for annotations of observations/cells or variables/genes, or a hex color specification.",
196
165
  )
197
-
166
+
198
167
  use_raw: Optional[bool] = Field(
199
168
  default=None,
200
- description="Whether to use raw attribute of adata. Defaults to True if .raw is present."
169
+ description="Whether to use raw attribute of adata. Defaults to True if .raw is present.",
201
170
  )
202
-
171
+
203
172
  layers: Optional[Union[str, List[str]]] = Field(
204
173
  default=None,
205
- description="Use the layers attribute of adata if present: specify the layer for x, y and color."
174
+ description="Use the layers attribute of adata if present: specify the layer for x, y and color.",
206
175
  )
207
-
176
+
208
177
  basis: Optional[str] = Field(
209
- default=None,
210
- description="Basis to use for embedding."
178
+ default=None, description="Basis to use for embedding."
211
179
  )
212
180
 
213
181
 
214
- # 使用继承关系重构 EnhancedScatterParams
215
- class EnhancedScatterParams(BaseScatterParams):
182
+ # 使用继承关系重构 EnhancedScatterParam
183
+ class EnhancedScatterParam(BaseScatterParam):
216
184
  """Input schema for the enhanced scatter plotting tool."""
217
-
185
+
218
186
  sort_order: bool = Field(
219
187
  default=True,
220
- description="For continuous annotations used as color parameter, plot data points with higher values on top of others."
188
+ description="For continuous annotations used as color parameter, plot data points with higher values on top of others.",
221
189
  )
222
-
190
+
223
191
  alpha: Optional[float] = Field(
224
- default=None,
225
- description="Alpha value for the plot.",
226
- ge=0,
227
- le=1
192
+ default=None, description="Alpha value for the plot.", ge=0, le=1
228
193
  )
229
-
194
+
230
195
  groups: Optional[Union[str, List[str]]] = Field(
231
196
  default=None,
232
- description="Restrict to a few categories in categorical observation annotation."
197
+ description="Restrict to a few categories in categorical observation annotation.",
233
198
  )
234
-
199
+
235
200
  components: Optional[Union[str, List[str]]] = Field(
236
201
  default=None,
237
- description="For instance, ['1,2', '2,3']. To plot all available components use components='all'."
202
+ description="For instance, ['1,2', '2,3']. To plot all available components use components='all'.",
238
203
  )
239
-
240
- projection: Literal['2d', '3d'] = Field(
241
- default='2d',
242
- description="Projection of plot."
204
+
205
+ projection: Literal["2d", "3d"] = Field(
206
+ default="2d", description="Projection of plot."
243
207
  )
244
-
208
+
245
209
  right_margin: Optional[float] = Field(
246
- default=None,
247
- description="Adjust the width of the right margin."
210
+ default=None, description="Adjust the width of the right margin."
248
211
  )
249
-
212
+
250
213
  left_margin: Optional[float] = Field(
251
- default=None,
252
- description="Adjust the width of the left margin."
214
+ default=None, description="Adjust the width of the left margin."
253
215
  )
254
-
255
- @field_validator('alpha')
216
+
217
+ @field_validator("alpha")
256
218
  def validate_alpha(cls, v: Optional[float]) -> Optional[float]:
257
219
  """Validate alpha is between 0 and 1"""
258
220
  if v is not None and (v < 0 or v > 1):
@@ -261,150 +223,136 @@ class EnhancedScatterParams(BaseScatterParams):
261
223
 
262
224
 
263
225
  # 创建基础统计可视化模型
264
- class BaseStatPlotParams(BaseVisualizationParams):
226
+ class BaseStatPlotParam(BaseVisualizationParam):
265
227
  """基础统计可视化模型,包含统计图表共享的字段"""
266
-
228
+
267
229
  groupby: Optional[str] = Field(
268
- default=None,
269
- description="The key of the observation grouping to consider."
270
- )
271
-
272
- log: bool = Field(
273
- default=False,
274
- description="Plot on logarithmic axis."
230
+ default=None, description="The key of the observation grouping to consider."
275
231
  )
276
-
232
+
233
+ log: bool = Field(default=False, description="Plot on logarithmic axis.")
234
+
277
235
  use_raw: Optional[bool] = Field(
278
- default=None,
279
- description="Use raw attribute of adata if present."
236
+ default=None, description="Use raw attribute of adata if present."
280
237
  )
281
-
238
+
282
239
  var_names: Optional[Union[str, List[str]]] = Field(
283
240
  default=None,
284
- description="var_names should be a valid subset of adata.var_names."
241
+ description="var_names should be a valid subset of adata.var_names.",
285
242
  )
286
-
243
+
287
244
  layer: Optional[str] = Field(
288
245
  default=None,
289
- description="Name of the AnnData object layer that wants to be plotted."
246
+ description="Name of the AnnData object layer that wants to be plotted.",
290
247
  )
291
-
248
+
292
249
  gene_symbols: Optional[str] = Field(
293
250
  default=None,
294
- description="Column name in .var DataFrame that stores gene symbols."
251
+ description="Column name in .var DataFrame that stores gene symbols.",
295
252
  )
296
-
253
+
297
254
  # 添加共享的小提琴图相关字段
298
255
  stripplot: bool = Field(
299
- default=True,
300
- description="Add a stripplot on top of the violin plot."
256
+ default=True, description="Add a stripplot on top of the violin plot."
301
257
  )
302
-
258
+
303
259
  jitter: Union[float, bool] = Field(
304
260
  default=True,
305
- description="Add jitter to the stripplot (only when stripplot is True)."
306
- )
307
-
308
- size: int = Field(
309
- default=1,
310
- description="Size of the jitter points.",
311
- gt=0
261
+ description="Add jitter to the stripplot (only when stripplot is True).",
312
262
  )
313
-
263
+
264
+ size: int = Field(default=1, description="Size of the jitter points.", gt=0)
265
+
314
266
  order: Optional[List[str]] = Field(
315
- default=None,
316
- description="Order in which to show the categories."
267
+ default=None, description="Order in which to show the categories."
317
268
  )
318
-
319
- scale: Literal['area', 'count', 'width'] = Field(
320
- default='width',
321
- description="The method used to scale the width of each violin."
269
+
270
+ scale: Literal["area", "count", "width"] = Field(
271
+ default="width",
272
+ description="The method used to scale the width of each violin.",
322
273
  )
323
-
324
- @field_validator('size')
274
+
275
+ @field_validator("size")
325
276
  def validate_size(cls, v: int) -> int:
326
277
  """Validate size is positive"""
327
278
  if v <= 0:
328
279
  raise ValueError("size must be a positive integer")
329
280
  return v
330
281
 
331
- # 添加缺失的 BaseMatrixParams 类
332
- class BaseMatrixParams(BaseVisualizationParams):
282
+
283
+ # 添加缺失的 BaseMatrixParam 类
284
+ class BaseMatrixParam(BaseVisualizationParam):
333
285
  """基础矩阵可视化模型,包含所有矩阵可视化工具共享的字段"""
334
-
286
+
335
287
  var_names: Union[List[str], Mapping[str, List[str]]] = Field(
336
288
  default=None,
337
- description="var_names should be a valid subset of adata.var_names or a mapping where the key is used as label to group the values."
338
- )
289
+ description="var_names should be a valid subset of adata.var_names or a mapping where the key is used as label to group the values.",
290
+ )
339
291
  groupby: Union[str, List[str]] = Field(
340
292
  ..., # Required field
341
- description="The key of the observation grouping to consider."
293
+ description="The key of the observation grouping to consider.",
342
294
  )
343
295
  use_raw: Optional[bool] = Field(
344
- default=None,
345
- description="Use raw attribute of adata if present."
346
- )
347
- log: bool = Field(
348
- default=False,
349
- description="Plot on logarithmic axis."
296
+ default=None, description="Use raw attribute of adata if present."
350
297
  )
298
+ log: bool = Field(default=False, description="Plot on logarithmic axis.")
351
299
  dendrogram: Union[bool, str] = Field(
352
300
  default=False,
353
- description="If True or a valid dendrogram key, a dendrogram based on the hierarchical clustering between the groupby categories is added."
301
+ description="If True or a valid dendrogram key, a dendrogram based on the hierarchical clustering between the groupby categories is added.",
354
302
  )
355
-
303
+
356
304
  gene_symbols: Optional[str] = Field(
357
305
  default=None,
358
- description="Column name in .var DataFrame that stores gene symbols."
306
+ description="Column name in .var DataFrame that stores gene symbols.",
359
307
  )
360
-
308
+
361
309
  var_group_positions: Optional[List[Tuple[int, int]]] = Field(
362
310
  default=None,
363
- description="Use this parameter to highlight groups of var_names with brackets or color blocks between the given start and end positions."
311
+ description="Use this parameter to highlight groups of var_names with brackets or color blocks between the given start and end positions.",
364
312
  )
365
-
313
+
366
314
  var_group_labels: Optional[List[str]] = Field(
367
315
  default=None,
368
- description="Labels for each of the var_group_positions that want to be highlighted."
316
+ description="Labels for each of the var_group_positions that want to be highlighted.",
369
317
  )
370
-
318
+
371
319
  layer: Optional[str] = Field(
372
320
  default=None,
373
- description="Name of the AnnData object layer that wants to be plotted."
321
+ description="Name of the AnnData object layer that wants to be plotted.",
374
322
  )
375
323
 
376
324
 
377
- # 重构 HeatmapParams
378
- class HeatmapParams(BaseMatrixParams):
325
+ # 重构 HeatmapParam
326
+ class HeatmapParam(BaseMatrixParam):
379
327
  """Input schema for the heatmap plotting tool."""
380
-
328
+
381
329
  num_categories: int = Field(
382
330
  default=7,
383
331
  description="Only used if groupby observation is not categorical. This value determines the number of groups into which the groupby observation should be subdivided.",
384
- gt=0
332
+ gt=0,
385
333
  )
386
-
334
+
387
335
  var_group_rotation: Optional[float] = Field(
388
336
  default=None,
389
- description="Label rotation degrees. By default, labels larger than 4 characters are rotated 90 degrees."
337
+ description="Label rotation degrees. By default, labels larger than 4 characters are rotated 90 degrees.",
390
338
  )
391
-
392
- standard_scale: Optional[Literal['var', 'obs']] = Field(
339
+
340
+ standard_scale: Optional[Literal["var", "obs"]] = Field(
393
341
  default=None,
394
- description="Whether or not to standardize that dimension between 0 and 1."
342
+ description="Whether or not to standardize that dimension between 0 and 1.",
395
343
  )
396
-
344
+
397
345
  swap_axes: bool = Field(
398
346
  default=False,
399
- description="By default, the x axis contains var_names and the y axis the groupby categories. By setting swap_axes then x are the groupby categories and y the var_names."
347
+ description="By default, the x axis contains var_names and the y axis the groupby categories. By setting swap_axes then x are the groupby categories and y the var_names.",
400
348
  )
401
-
349
+
402
350
  show_gene_labels: Optional[bool] = Field(
403
351
  default=None,
404
- description="By default gene labels are shown when there are 50 or less genes. Otherwise the labels are removed."
352
+ description="By default gene labels are shown when there are 50 or less genes. Otherwise the labels are removed.",
405
353
  )
406
-
407
- @field_validator('num_categories')
354
+
355
+ @field_validator("num_categories")
408
356
  def validate_num_categories(cls, v: int) -> int:
409
357
  """Validate num_categories is positive"""
410
358
  if v <= 0:
@@ -412,64 +360,56 @@ class HeatmapParams(BaseMatrixParams):
412
360
  return v
413
361
 
414
362
 
415
- # 重构 TracksplotParams
416
- class TracksplotParams(BaseMatrixParams):
363
+ # 重构 TracksplotParam
364
+ class TracksplotParam(BaseMatrixParam):
417
365
  """Input schema for the tracksplot plotting tool."""
418
- # 所有需要的字段已经在 BaseMatrixParams 中定义
419
366
 
367
+ # 所有需要的字段已经在 BaseMatrixParam 中定义
420
368
 
421
- # 重构 ViolinParams
422
- class ViolinParams(BaseStatPlotParams):
369
+
370
+ # 重构 ViolinParam
371
+ class ViolinParam(BaseStatPlotParam):
423
372
  """Input schema for the violin plotting tool."""
424
-
373
+
425
374
  keys: Union[str, List[str]] = Field(
426
375
  ..., # Required field
427
- description="Keys for accessing variables of adata.var or adata.obs. or variables of adata.obsm when obsm_key is not None."
376
+ description="Keys for accessing variables of adata.var or adata.obs. or variables of adata.obsm when obsm_key is not None.",
428
377
  )
429
378
  use_obsm: str = Field(
430
- default=None,
431
- description="using data of adata.obsm instead of adata.X"
379
+ default=None, description="using data of adata.obsm instead of adata.X"
432
380
  )
433
381
  stripplot: bool = Field(
434
- default=True,
435
- description="Add a stripplot on top of the violin plot."
382
+ default=True, description="Add a stripplot on top of the violin plot."
436
383
  )
437
384
  jitter: Union[float, bool] = Field(
438
385
  default=True,
439
- description="Add jitter to the stripplot (only when stripplot is True)."
440
- )
441
- size: int = Field(
442
- default=1,
443
- description="Size of the jitter points.",
444
- gt=0
386
+ description="Add jitter to the stripplot (only when stripplot is True).",
445
387
  )
446
- scale: Literal['area', 'count', 'width'] = Field(
447
- default='width',
448
- description="The method used to scale the width of each violin."
388
+ size: int = Field(default=1, description="Size of the jitter points.", gt=0)
389
+ scale: Literal["area", "count", "width"] = Field(
390
+ default="width",
391
+ description="The method used to scale the width of each violin.",
449
392
  )
450
393
  order: Optional[List[str]] = Field(
451
- default=None,
452
- description="Order in which to show the categories."
394
+ default=None, description="Order in which to show the categories."
453
395
  )
454
396
  multi_panel: Optional[bool] = Field(
455
397
  default=None,
456
- description="Display keys in multiple panels also when groupby is not None."
398
+ description="Display keys in multiple panels also when groupby is not None.",
457
399
  )
458
400
  xlabel: str = Field(
459
- default='',
460
- description="Label of the x axis. Defaults to groupby if rotation is None, otherwise, no label is shown."
461
- )
401
+ default="",
402
+ description="Label of the x axis. Defaults to groupby if rotation is None, otherwise, no label is shown.",
403
+ )
462
404
  ylabel: Optional[Union[str, List[str]]] = Field(
463
- default=None,
464
- description="Label of the y axis."
405
+ default=None, description="Label of the y axis."
465
406
  )
466
-
407
+
467
408
  rotation: Optional[float] = Field(
468
- default=None,
469
- description="Rotation of xtick labels."
409
+ default=None, description="Rotation of xtick labels."
470
410
  )
471
-
472
- @field_validator('size')
411
+
412
+ @field_validator("size")
473
413
  def validate_size(cls, v: int) -> int:
474
414
  """Validate size is positive"""
475
415
  if v <= 0:
@@ -477,45 +417,44 @@ class ViolinParams(BaseStatPlotParams):
477
417
  return v
478
418
 
479
419
 
480
- # 重构 MatrixplotParams
481
- class MatrixplotParams(BaseMatrixParams):
420
+ # 重构 MatrixplotParam
421
+ class MatrixplotParam(BaseMatrixParam):
482
422
  """Input schema for the matrixplot plotting tool."""
483
-
423
+
484
424
  num_categories: int = Field(
485
425
  default=7,
486
426
  description="Only used if groupby observation is not categorical. This value determines the number of groups into which the groupby observation should be subdivided.",
487
- gt=0
427
+ gt=0,
488
428
  )
489
-
429
+
490
430
  cmap: Optional[str] = Field(
491
- default='viridis',
492
- description="String denoting matplotlib color map."
431
+ default="viridis", description="String denoting matplotlib color map."
493
432
  )
494
-
433
+
495
434
  colorbar_title: Optional[str] = Field(
496
- default='Mean expression\nin group',
497
- description="Title for the color bar. New line character (\\n) can be used."
435
+ default="Mean expression\nin group",
436
+ description="Title for the color bar. New line character (\\n) can be used.",
498
437
  )
499
-
438
+
500
439
  var_group_rotation: Optional[float] = Field(
501
440
  default=None,
502
- description="Label rotation degrees. By default, labels larger than 4 characters are rotated 90 degrees."
441
+ description="Label rotation degrees. By default, labels larger than 4 characters are rotated 90 degrees.",
503
442
  )
504
-
505
- standard_scale: Optional[Literal['var', 'group']] = Field(
443
+
444
+ standard_scale: Optional[Literal["var", "group"]] = Field(
506
445
  default=None,
507
- description="Whether or not to standardize the given dimension between 0 and 1."
446
+ description="Whether or not to standardize the given dimension between 0 and 1.",
508
447
  )
509
-
448
+
510
449
  swap_axes: bool = Field(
511
450
  default=False,
512
- description="By default, the x axis contains var_names and the y axis the groupby categories. By setting swap_axes then x are the groupby categories and y the var_names."
451
+ description="By default, the x axis contains var_names and the y axis the groupby categories. By setting swap_axes then x are the groupby categories and y the var_names.",
513
452
  )
514
453
  use_obsm: str = Field(
515
- default=None,
516
- description="using data of adata.obsm instead of adata.X"
454
+ default=None, description="using data of adata.obsm instead of adata.X"
517
455
  )
518
- @field_validator('num_categories')
456
+
457
+ @field_validator("num_categories")
519
458
  def validate_num_categories(cls, v: int) -> int:
520
459
  """Validate num_categories is positive"""
521
460
  if v <= 0:
@@ -523,164 +462,141 @@ class MatrixplotParams(BaseMatrixParams):
523
462
  return v
524
463
 
525
464
 
526
- # 重构 DotplotParams
527
- class DotplotParams(BaseMatrixParams):
465
+ # 重构 DotplotParam
466
+ class DotplotParam(BaseMatrixParam):
528
467
  """Input schema for the dotplot plotting tool."""
529
-
468
+
530
469
  expression_cutoff: float = Field(
531
470
  default=0.0,
532
- description="Expression cutoff that is used for binarizing the gene expression."
471
+ description="Expression cutoff that is used for binarizing the gene expression.",
533
472
  )
534
-
473
+
535
474
  mean_only_expressed: bool = Field(
536
475
  default=False,
537
- description="If True, gene expression is averaged only over the cells expressing the given genes."
476
+ description="If True, gene expression is averaged only over the cells expressing the given genes.",
538
477
  )
539
-
540
- standard_scale: Optional[Literal['var', 'group']] = Field(
478
+
479
+ standard_scale: Optional[Literal["var", "group"]] = Field(
541
480
  default=None,
542
- description="Whether or not to standardize that dimension between 0 and 1."
481
+ description="Whether or not to standardize that dimension between 0 and 1.",
543
482
  )
544
-
483
+
545
484
  swap_axes: bool = Field(
546
485
  default=False,
547
- description="By default, the x axis contains var_names and the y axis the groupby categories. By setting swap_axes then x are the groupby categories and y the var_names."
486
+ description="By default, the x axis contains var_names and the y axis the groupby categories. By setting swap_axes then x are the groupby categories and y the var_names.",
548
487
  )
549
-
488
+
550
489
  dot_max: Optional[float] = Field(
551
- default=None,
552
- description="The maximum size of the dots."
490
+ default=None, description="The maximum size of the dots."
553
491
  )
554
-
492
+
555
493
  dot_min: Optional[float] = Field(
556
- default=None,
557
- description="The minimum size of the dots."
494
+ default=None, description="The minimum size of the dots."
558
495
  )
559
-
496
+
560
497
  smallest_dot: Optional[float] = Field(
561
- default=None,
562
- description="The smallest dot size."
498
+ default=None, description="The smallest dot size."
563
499
  )
564
500
  var_group_rotation: Optional[float] = Field(
565
501
  default=None,
566
- description="Label rotation degrees. By default, labels larger than 4 characters are rotated 90 degrees."
502
+ description="Label rotation degrees. By default, labels larger than 4 characters are rotated 90 degrees.",
567
503
  )
568
-
504
+
569
505
  colorbar_title: Optional[str] = Field(
570
- default='Mean expression\nin group',
571
- description="Title for the color bar. New line character (\\n) can be used."
506
+ default="Mean expression\nin group",
507
+ description="Title for the color bar. New line character (\\n) can be used.",
572
508
  )
573
-
509
+
574
510
  size_title: Optional[str] = Field(
575
- default='Fraction of cells\nin group (%)',
576
- description="Title for the size legend. New line character (\\n) can be used."
511
+ default="Fraction of cells\nin group (%)",
512
+ description="Title for the size legend. New line character (\\n) can be used.",
577
513
  )
578
514
 
579
515
 
580
- # 重构 RankGenesGroupsParams
581
- class RankGenesGroupsParams(BaseVisualizationParams):
516
+ # 重构 RankGenesGroupsParam
517
+ class RankGenesGroupsParam(BaseVisualizationParam):
582
518
  """Input schema for the rank_genes_groups plotting tool."""
583
-
584
- n_genes: int = Field(
585
- default=20,
586
- description="Number of genes to show.",
587
- gt=0
588
- )
589
-
519
+
520
+ n_genes: int = Field(default=20, description="Number of genes to show.", gt=0)
521
+
590
522
  gene_symbols: Optional[str] = Field(
591
523
  default=None,
592
- description="Column name in `.var` DataFrame that stores gene symbols."
524
+ description="Column name in `.var` DataFrame that stores gene symbols.",
593
525
  )
594
-
526
+
595
527
  groupby: Optional[str] = Field(
596
- default=None,
597
- description="The key of the observation grouping to consider."
528
+ default=None, description="The key of the observation grouping to consider."
598
529
  )
599
-
530
+
600
531
  groups: Optional[Union[str, List[str]]] = Field(
601
- default=None,
602
- description="Subset of groups, e.g. ['g1', 'g2', 'g3']."
532
+ default=None, description="Subset of groups, e.g. ['g1', 'g2', 'g3']."
603
533
  )
604
-
534
+
605
535
  key: Optional[str] = Field(
606
- default='rank_genes_groups',
607
- description="Key used to store the rank_genes_groups parameters."
608
- )
609
-
610
- fontsize: int = Field(
611
- default=8,
612
- description="Fontsize for gene names."
613
- )
614
-
615
- ncols: int = Field(
616
- default=4,
617
- description="Number of columns."
536
+ default="rank_genes_groups",
537
+ description="Key used to store the rank_genes_groups parameters.",
618
538
  )
619
-
539
+
540
+ fontsize: int = Field(default=8, description="Fontsize for gene names.")
541
+
542
+ ncols: int = Field(default=4, description="Number of columns.")
543
+
620
544
  sharey: bool = Field(
621
545
  default=True,
622
- description="Controls if the y-axis of each panels should be shared."
546
+ description="Controls if the y-axis of each panels should be shared.",
623
547
  )
624
-
625
- @field_validator('n_genes', 'fontsize')
548
+
549
+ @field_validator("n_genes", "fontsize")
626
550
  def validate_positive_int(cls, v: int) -> int:
627
551
  """Validate positive integers"""
628
552
  if v <= 0:
629
- raise ValueError(f"Value must be a positive integer")
553
+ raise ValueError("Value must be a positive integer")
630
554
  return v
631
555
 
632
556
 
633
557
  # 重构 ClusterMapModel
634
- class ClusterMapParams(BaseModel):
558
+ class ClusterMapParam(BaseModel):
635
559
  """Input schema for the clustermap plotting tool."""
636
560
 
637
561
  obs_keys: Optional[str] = Field(
638
562
  default=None,
639
- description="key column in adata.obs, categorical annotation to plot with a different color map."
563
+ description="key column in adata.obs, categorical annotation to plot with a different color map.",
640
564
  )
641
565
  use_raw: Optional[bool] = Field(
642
566
  default=None,
643
- description="Whether to use `raw` attribute of `adata`. Defaults to `True` if `.raw` is present."
567
+ description="Whether to use `raw` attribute of `adata`. Defaults to `True` if `.raw` is present.",
644
568
  )
645
569
 
646
570
 
647
-
648
- # 重构 StackedViolinParams
649
- class StackedViolinParams(BaseStatPlotParams):
571
+ # 重构 StackedViolinParam
572
+ class StackedViolinParam(BaseStatPlotParam):
650
573
  """Input schema for the stacked_violin plotting tool."""
651
-
574
+
652
575
  stripplot: bool = Field(
653
- default=True,
654
- description="Add a stripplot on top of the violin plot."
576
+ default=True, description="Add a stripplot on top of the violin plot."
655
577
  )
656
-
578
+
657
579
  jitter: Union[float, bool] = Field(
658
580
  default=True,
659
- description="Add jitter to the stripplot (only when stripplot is True)."
660
- )
661
-
662
- size: int = Field(
663
- default=1,
664
- description="Size of the jitter points.",
665
- gt=0
581
+ description="Add jitter to the stripplot (only when stripplot is True).",
666
582
  )
667
-
583
+
584
+ size: int = Field(default=1, description="Size of the jitter points.", gt=0)
585
+
668
586
  order: Optional[List[str]] = Field(
669
- default=None,
670
- description="Order in which to show the categories."
587
+ default=None, description="Order in which to show the categories."
671
588
  )
672
-
673
- scale: Literal['area', 'count', 'width'] = Field(
674
- default='width',
675
- description="The method used to scale the width of each violin."
589
+
590
+ scale: Literal["area", "count", "width"] = Field(
591
+ default="width",
592
+ description="The method used to scale the width of each violin.",
676
593
  )
677
-
594
+
678
595
  swap_axes: bool = Field(
679
- default=False,
680
- description="Swap axes such that observations are on the x-axis."
596
+ default=False, description="Swap axes such that observations are on the x-axis."
681
597
  )
682
-
683
- @field_validator('size')
598
+
599
+ @field_validator("size")
684
600
  def validate_size(cls, v: int) -> int:
685
601
  """Validate size is positive"""
686
602
  if v <= 0:
@@ -688,62 +604,58 @@ class StackedViolinParams(BaseStatPlotParams):
688
604
  return v
689
605
 
690
606
 
691
- # 重构 TrackingParams
692
- class TrackingParams(BaseVisualizationParams):
607
+ # 重构 TrackingParam
608
+ class TrackingParam(BaseVisualizationParam):
693
609
  """Input schema for the tracking plotting tool."""
694
-
610
+
695
611
  groupby: str = Field(
696
612
  ..., # Required field
697
- description="The key of the observation grouping to consider."
613
+ description="The key of the observation grouping to consider.",
698
614
  )
699
-
615
+
700
616
  min_group_size: int = Field(
701
617
  default=1,
702
618
  description="Minimal number of cells in a group for the group to be considered.",
703
- gt=0
619
+ gt=0,
704
620
  )
705
-
621
+
706
622
  min_split_size: int = Field(
707
623
  default=1,
708
624
  description="Minimal number of cells in a split for the split to be shown.",
709
- gt=0
625
+ gt=0,
710
626
  )
711
-
712
- @field_validator('min_group_size', 'min_split_size')
627
+
628
+ @field_validator("min_group_size", "min_split_size")
713
629
  def validate_positive_int(cls, v: int) -> int:
714
630
  """Validate positive integers"""
715
631
  if v <= 0:
716
- raise ValueError(f"Value must be a positive integer")
632
+ raise ValueError("Value must be a positive integer")
717
633
  return v
718
634
 
719
635
 
720
- # 重构 EmbeddingDensityParams
721
- class EmbeddingDensityParams(BaseEmbeddingParams):
636
+ # 重构 EmbeddingDensityParam
637
+ class EmbeddingDensityParam(BaseEmbeddingParam):
722
638
  """Input schema for the embedding_density plotting tool."""
723
-
639
+
724
640
  basis: str = Field(
725
641
  ..., # Required field
726
- description="Basis to use for embedding."
642
+ description="Basis to use for embedding.",
727
643
  )
728
-
644
+
729
645
  key: Optional[str] = Field(
730
646
  default=None,
731
- description="Key for annotation of observations/cells or variables/genes."
647
+ description="Key for annotation of observations/cells or variables/genes.",
732
648
  )
733
-
649
+
734
650
  convolve: Optional[float] = Field(
735
- default=None,
736
- description="Sigma for Gaussian kernel used for convolution."
651
+ default=None, description="Sigma for Gaussian kernel used for convolution."
737
652
  )
738
-
653
+
739
654
  alpha: float = Field(
740
- default=0.5,
741
- description="Alpha value for the plot.",
742
- ge=0,
743
- le=1
655
+ default=0.5, description="Alpha value for the plot.", ge=0, le=1
744
656
  )
745
-
746
- @field_validator('alpha')
657
+
658
+ @field_validator("alpha")
747
659
  def validate_alpha(cls, v: float) -> float:
748
660
  """Validate alpha is between 0 and 1"""
749
661
  if v < 0 or v > 1:
@@ -751,51 +663,48 @@ class EmbeddingDensityParams(BaseEmbeddingParams):
751
663
  return v
752
664
 
753
665
 
754
- class PCAParams(BaseEmbeddingParams):
666
+ class PCAParam(BaseEmbeddingParam):
755
667
  """Input schema for the PCA plotting tool."""
756
-
668
+
757
669
  annotate_var_explained: bool = Field(
758
- default=False,
759
- description="Annotate the explained variance."
670
+ default=False, description="Annotate the explained variance."
760
671
  )
761
672
 
762
673
 
763
674
  # 重构 UMAP 模型
764
- class UMAPParams(BaseEmbeddingParams):
675
+ class UMAPParam(BaseEmbeddingParam):
765
676
  """Input schema for the UMAP plotting tool."""
766
- # 所有需要的字段已经在 BaseEmbeddingParams 中定义
677
+
678
+ # 所有需要的字段已经在 BaseEmbeddingParam 中定义
767
679
 
768
680
 
769
681
  # 重构 TSNE 模型
770
- class TSNEParams(BaseEmbeddingParams):
682
+ class TSNEParam(BaseEmbeddingParam):
771
683
  """Input schema for the TSNE plotting tool."""
772
- # 所有需要的字段已经在 BaseEmbeddingParams 中定义
773
684
 
774
- # 重构 DiffusionMapParams
775
- class DiffusionMapParams(BaseEmbeddingParams):
685
+ # 所有需要的字段已经在 BaseEmbeddingParam 中定义
686
+
687
+
688
+ # 重构 DiffusionMapParam
689
+ class DiffusionMapParam(BaseEmbeddingParam):
776
690
  """Input schema for the diffusion map plotting tool."""
777
- # 所有需要的字段已经在 BaseEmbeddingParams 中定义
778
691
 
779
- class HighestExprGenesParams(BaseVisualizationParams):
692
+ # 所有需要的字段已经在 BaseEmbeddingParam 中定义
693
+
694
+
695
+ class HighestExprGenesParam(BaseVisualizationParam):
780
696
  """Input schema for the highest_expr_genes plotting tool."""
781
-
782
- n_top: int = Field(
783
- default=30,
784
- description="Number of top genes to plot.",
785
- gt=0
786
- )
787
-
697
+
698
+ n_top: int = Field(default=30, description="Number of top genes to plot.", gt=0)
699
+
788
700
  gene_symbols: Optional[str] = Field(
789
701
  default=None,
790
- description="Key for field in .var that stores gene symbols if you do not want to use .var_names."
791
- )
792
-
793
- log: bool = Field(
794
- default=False,
795
- description="Plot x-axis in log scale."
702
+ description="Key for field in .var that stores gene symbols if you do not want to use .var_names.",
796
703
  )
797
-
798
- @field_validator('n_top')
704
+
705
+ log: bool = Field(default=False, description="Plot x-axis in log scale.")
706
+
707
+ @field_validator("n_top")
799
708
  def validate_n_top(cls, v: int) -> int:
800
709
  """Validate n_top is positive"""
801
710
  if v <= 0:
@@ -803,145 +712,132 @@ class HighestExprGenesParams(BaseVisualizationParams):
803
712
  return v
804
713
 
805
714
 
806
- class HighlyVariableGenesParams(BaseVisualizationParams):
715
+ class HighlyVariableGenesParam(BaseVisualizationParam):
807
716
  """Input schema for the highly_variable_genes plotting tool."""
808
-
809
- log: bool = Field(
810
- default=False,
811
- description="Plot on logarithmic axes."
812
- )
813
-
717
+
718
+ log: bool = Field(default=False, description="Plot on logarithmic axes.")
719
+
814
720
  highly_variable_genes: bool = Field(
815
- default=True,
816
- description="Whether to plot highly variable genes or all genes."
721
+ default=True, description="Whether to plot highly variable genes or all genes."
817
722
  )
818
723
 
819
- class PCAVarianceRatioParams(BaseVisualizationParams):
724
+
725
+ class PCAVarianceRatioParam(BaseVisualizationParam):
820
726
  """Input schema for the pca_variance_ratio plotting tool."""
821
-
822
- n_pcs: int = Field(
823
- default=30,
824
- description="Number of PCs to show.",
825
- gt=0
826
- )
827
-
828
- log: bool = Field(
829
- default=False,
830
- description="Plot on logarithmic scale."
831
- )
832
-
833
- @field_validator('n_pcs')
727
+
728
+ n_pcs: int = Field(default=30, description="Number of PCs to show.", gt=0)
729
+
730
+ log: bool = Field(default=False, description="Plot on logarithmic scale.")
731
+
732
+ @field_validator("n_pcs")
834
733
  def validate_n_pcs(cls, v: int) -> int:
835
734
  """Validate n_pcs is positive"""
836
735
  if v <= 0:
837
736
  raise ValueError("n_pcs must be a positive integer")
838
737
  return v
839
738
 
739
+
840
740
  # ... existing code ...
841
741
 
842
- class RankGenesGroupsDotplotParams(BaseMatrixParams):
742
+
743
+ class RankGenesGroupsDotplotParam(BaseMatrixParam):
843
744
  """Input schema for the rank_genes_groups_dotplot plotting tool."""
844
-
745
+
845
746
  groups: Optional[Union[str, List[str]]] = Field(
846
- default=None,
847
- description="The groups for which to show the gene ranking."
848
- )
747
+ default=None, description="The groups for which to show the gene ranking."
748
+ )
849
749
  n_genes: Optional[int] = Field(
850
750
  default=None,
851
- description="Number of genes to show. This can be a negative number to show down regulated genes. Ignored if var_names is passed."
751
+ description="Number of genes to show. This can be a negative number to show down regulated genes. Ignored if var_names is passed.",
852
752
  )
853
- values_to_plot: Optional[Literal['scores', 'logfoldchanges', 'pvals', 'pvals_adj', 'log10_pvals', 'log10_pvals_adj']] = Field(
753
+ values_to_plot: Optional[
754
+ Literal[
755
+ "scores",
756
+ "logfoldchanges",
757
+ "pvals",
758
+ "pvals_adj",
759
+ "log10_pvals",
760
+ "log10_pvals_adj",
761
+ ]
762
+ ] = Field(
854
763
  default=None,
855
- description="Instead of the mean gene value, plot the values computed by sc.rank_genes_groups."
764
+ description="Instead of the mean gene value, plot the values computed by sc.rank_genes_groups.",
856
765
  )
857
766
  min_logfoldchange: Optional[float] = Field(
858
767
  default=None,
859
- description="Value to filter genes in groups if their logfoldchange is less than the min_logfoldchange."
768
+ description="Value to filter genes in groups if their logfoldchange is less than the min_logfoldchange.",
860
769
  )
861
770
  key: Optional[str] = Field(
862
- default=None,
863
- description="Key used to store the ranking results in adata.uns."
771
+ default=None, description="Key used to store the ranking results in adata.uns."
864
772
  )
865
773
  var_names: Union[List[str], Mapping[str, List[str]]] = Field(
866
774
  default=None,
867
- description="Genes to plot. Sometimes is useful to pass a specific list of var names (e.g. genes) to check their fold changes or p-values"
868
- )
869
- @field_validator('n_genes')
775
+ description="Genes to plot. Sometimes is useful to pass a specific list of var names (e.g. genes) to check their fold changes or p-values",
776
+ )
777
+
778
+ @field_validator("n_genes")
870
779
  def validate_n_genes(cls, v: Optional[int]) -> Optional[int]:
871
780
  """Validate n_genes"""
872
781
  # n_genes can be positive or negative, so no validation needed
873
782
  return v
874
783
 
875
784
 
876
-
877
- class EmbeddingParams(BaseEmbeddingParams):
785
+ class EmbeddingParam(BaseEmbeddingParam):
878
786
  """Input schema for the embedding plotting tool."""
879
-
787
+
880
788
  basis: str = Field(
881
789
  ..., # Required field
882
- description="Name of the obsm basis to use."
790
+ description="Name of the obsm basis to use.",
883
791
  )
884
792
  use_obsm: str = Field(
885
- default=None,
886
- description="using data of adata.obsm instead of adata.X"
793
+ default=None, description="using data of adata.obsm instead of adata.X"
887
794
  )
888
795
  mask_obs: Optional[str] = Field(
889
796
  default=None,
890
- description="A boolean array or a string mask expression to subset observations."
797
+ description="A boolean array or a string mask expression to subset observations.",
891
798
  )
892
-
799
+
893
800
  arrows_kwds: Optional[dict] = Field(
894
801
  default=None,
895
- description="Passed to matplotlib's quiver function for drawing arrows."
802
+ description="Passed to matplotlib's quiver function for drawing arrows.",
896
803
  )
897
-
804
+
898
805
  scale_factor: Optional[float] = Field(
899
- default=None,
900
- description="Scale factor for the plot."
806
+ default=None, description="Scale factor for the plot."
901
807
  )
902
-
808
+
903
809
  cmap: Optional[str] = Field(
904
810
  default=None,
905
- description="Color map to use for continuous variables. Overrides color_map."
811
+ description="Color map to use for continuous variables. Overrides color_map.",
906
812
  )
907
-
813
+
908
814
  na_color: str = Field(
909
- default="lightgray",
910
- description="Color to use for null or masked values."
815
+ default="lightgray", description="Color to use for null or masked values."
911
816
  )
912
-
817
+
913
818
  na_in_legend: bool = Field(
914
- default=True,
915
- description="Whether to include null values in the legend."
819
+ default=True, description="Whether to include null values in the legend."
916
820
  )
917
-
821
+
918
822
  outline_width: Tuple[float, float] = Field(
919
- default=(0.3, 0.05),
920
- description="Width of the outline for highlighted points."
823
+ default=(0.3, 0.05), description="Width of the outline for highlighted points."
921
824
  )
922
-
825
+
923
826
  outline_color: Tuple[str, str] = Field(
924
827
  default=("black", "white"),
925
- description="Color of the outline for highlighted points."
828
+ description="Color of the outline for highlighted points.",
926
829
  )
927
-
830
+
928
831
  colorbar_loc: Optional[str] = Field(
929
- default="right",
930
- description="Location of the colorbar."
832
+ default="right", description="Location of the colorbar."
931
833
  )
932
-
933
- hspace: float = Field(
934
- default=0.25,
935
- description="Height space between panels."
936
- )
937
-
834
+
835
+ hspace: float = Field(default=0.25, description="Height space between panels.")
836
+
938
837
  wspace: Optional[float] = Field(
939
- default=None,
940
- description="Width space between panels."
838
+ default=None, description="Width space between panels."
941
839
  )
942
-
840
+
943
841
  title: Optional[Union[str, List[str]]] = Field(
944
- default=None,
945
- description="Title for the plot."
842
+ default=None, description="Title for the plot."
946
843
  )
947
-