scmcp-shared 0.3.7__py3-none-any.whl → 0.5.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.
- scmcp_shared/__init__.py +1 -3
- scmcp_shared/agent.py +80 -0
- scmcp_shared/backend.py +44 -0
- scmcp_shared/cli.py +76 -37
- scmcp_shared/kb.py +38 -0
- scmcp_shared/logging_config.py +6 -8
- scmcp_shared/mcp_base.py +184 -0
- scmcp_shared/schema/io.py +101 -59
- scmcp_shared/schema/pl.py +386 -490
- scmcp_shared/schema/pp.py +514 -265
- scmcp_shared/schema/preset/__init__.py +15 -0
- scmcp_shared/schema/preset/io.py +103 -0
- scmcp_shared/schema/preset/pl.py +843 -0
- scmcp_shared/schema/preset/pp.py +616 -0
- scmcp_shared/schema/preset/tl.py +917 -0
- scmcp_shared/schema/preset/util.py +123 -0
- scmcp_shared/schema/tl.py +355 -407
- scmcp_shared/schema/tool.py +11 -0
- scmcp_shared/schema/util.py +57 -72
- scmcp_shared/server/__init__.py +0 -12
- scmcp_shared/server/auto.py +54 -0
- scmcp_shared/server/code.py +3 -0
- scmcp_shared/server/preset/__init__.py +14 -0
- scmcp_shared/server/{io.py → preset/io.py} +26 -22
- scmcp_shared/server/{pl.py → preset/pl.py} +162 -78
- scmcp_shared/server/{pp.py → preset/pp.py} +127 -65
- scmcp_shared/server/{tl.py → preset/tl.py} +142 -79
- scmcp_shared/server/{util.py → preset/util.py} +123 -66
- scmcp_shared/util.py +109 -38
- scmcp_shared/vector_db/decoupler.lance/_transactions/0-9499b1b5-85d4-44c2-8f05-1bcce87fe4ef.txn +3 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/1-1632e7a3-4427-4077-8d03-57437144443d.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/10-dcf66479-eafb-4193-9358-198154aea1c1.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/11-2c6ddc17-49f5-47b5-8764-753297cf9e1b.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/12-f079d0a2-9c1c-4e7a-abf6-3e3c4cddac11.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/13-5bda9382-a06e-493d-85cb-e066172778ce.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/14-6f9c669f-25e2-4096-b7ea-9b421a37e110.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/15-2068cca9-31e8-45a3-86d1-bcb8924c72b9.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/16-72356bb2-5c98-424e-97aa-a92fa3453da6.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/17-9baa67ce-f6d3-478c-9511-20d01988d4d5.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/18-b9f2e28e-c4c5-4ce7-bf58-402d53a39558.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/19-d199d9f9-7990-4ec0-adde-e98c1c927202.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/2-3827747c-095e-41cb-af69-3814bab3a588.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/20-31c197a3-7a23-472f-a7e3-056c0ff11e3a.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/21-066e3024-36f8-4557-83ae-d2f338ec045c.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/22-1d1ccbe5-7c4c-4882-986a-c61ec2f7925e.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/23-b2c41628-b2d6-49f1-81b5-3cd9100894b4.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/24-e43e2e8d-9dd8-479f-b63c-d147e737c49f.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/25-188708e9-5ee1-4b5c-8e13-45dec8efd60d.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/26-4f4b6316-5680-4b31-8dd6-215cce66d7b5.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/27-c1855f86-abab-44ef-9e61-1312dffc9b06.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/28-650d2be0-e977-4177-b457-b733eea8b6ea.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/29-e47751d8-0e44-46da-82bd-4836b00a8431.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/3-518fc9b8-67de-48f7-94c8-f2398c63dbc5.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/30-0db3ea0f-deca-4b5b-9d70-9fb5f741f90c.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/31-ef76f0bb-bcfa-4031-b3ad-94b51ee818a9.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/32-a763e0f1-5c8d-460f-a455-0c6f6c4f1450.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/33-30bce2aa-8e6f-4f42-a323-c420133aa20f.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/34-f91ec2f9-d34b-4fcf-8bc7-564c28e50538.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/35-7f36a75c-96a7-4868-a4db-5d5f78ecf850.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/36-f2df7f99-a37c-458a-958d-7eb5e81eee18.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/37-e0af7415-955b-4167-8705-fa9ddb643e9a.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/38-6c24a9f0-ce71-4dda-8193-479aa23c5456.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/39-72b8a20c-3112-4cf1-8b05-b74a2c02c3f2.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/4-42904942-5a79-4f28-90ce-35a4ae8c40d1.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/40-95ac7526-6a2e-4914-9654-288c41bff370.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/41-13430464-5e62-4aa8-9709-513693a75095.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/42-cbb1ad83-a906-4540-bc37-4db158eac618.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/43-3c246401-d742-49a9-b24d-cfc457685461.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/44-11315c14-ecf4-4e3d-8690-46d57cb3e8c0.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/45-7bbf4bc6-96d4-425a-afa2-34aec7121c85.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/5-82dda0b4-7838-4f04-90f3-4b1e932c6891.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/6-c78352d8-16ba-4814-bd7f-74b8c0c5efe7.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/7-bb882b35-63f3-4c52-870f-6a64e3ac7f3c.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/8-fc84ad1b-1b59-4822-8fc7-70f4eb18f6d9.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_transactions/9-3404dcf1-bb17-40e6-9e5d-d9942dff90b2.txn +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/1.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/10.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/11.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/12.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/13.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/14.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/15.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/16.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/17.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/18.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/19.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/2.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/20.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/21.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/22.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/23.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/24.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/25.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/26.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/27.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/28.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/29.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/3.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/30.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/31.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/32.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/33.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/34.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/35.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/36.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/37.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/38.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/39.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/4.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/40.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/41.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/42.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/43.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/44.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/45.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/46.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/5.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/6.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/7.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/8.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/_versions/9.manifest +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/0cc94dc3-2ca3-403c-a9df-59753f24b3f2.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/254a1a71-cdd2-4cca-b7ec-a50540fed62c.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/2574d216-5f05-4794-9e1c-986fafde6ab4.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/26c7bbe7-5f97-4453-b065-123b764448b3.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/286595a6-88f6-4b05-861e-e4f607a6fcdb.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/33219b1a-7575-46ef-bb64-2bdbde1e692b.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/344ad7dd-98bb-41de-b347-2f17bf5735cb.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/395b1ecb-68fe-4dd3-a770-4b3ed393ae0c.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/3db97f4c-9c35-44b7-9042-82b4006c5a22.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/4540246e-b0bb-4f4d-8f98-60a64f1c42ed.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/4643dbc0-9e45-4b63-81e1-e06cf9bddcec.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/4f28eb52-d409-43f2-ae17-d1826f209006.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/4fda4a22-35f0-4897-b4c5-6cedefba66e6.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/51ee77b6-ab24-44c0-916e-b81ff3912731.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/539d15c9-e88b-400c-9ab7-08f5e8dca10d.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/54007132-91f5-4909-8678-c471ef4d100f.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/546d88ec-0d5c-42bb-bccc-3271f3f183a4.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/6912ad8a-343c-4ca1-b1b7-4300125e688e.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/6b72e4f7-3051-40a4-a492-6d9eff1c647d.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/6d7ee320-ae1c-4e49-8ce5-c85971b11ce6.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/6ea47b70-69d4-43e9-b2c6-442fe50e4dd1.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/72adb5ed-bf11-4d06-b146-0272d333db08.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/745907df-e261-4f4b-a757-2c01c058bf27.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/78988307-4c66-4ad7-b295-7463ecd53609.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/798ce305-6d60-4f28-b82a-e1f647907abf.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/7c159cce-2741-442b-9c63-f44bf2996718.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/7cd7a818-e68b-4fa8-bad3-23b60c386670.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/7ec553ed-0c7a-4bac-99b2-2ad976b40466.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/83efdc85-d990-4762-b69a-fb1c3938f60f.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/8c1613b3-8d69-49c5-bfd0-a021bb516faf.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/95cd1b22-1f93-4133-9841-de21549ad8c5.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/9a2ea5d4-087e-4d3a-b64b-6c568b8a0010.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/b1c47dc6-450a-4dca-b465-badb6a3619c2.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/b21d183a-c51d-463b-932e-9beb2e0da9aa.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/b2598625-8683-4c33-be40-6f1a7555dc2c.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/b7297b39-1fc5-4886-be21-708b369bef59.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/b7d90085-5bd6-48f9-8a73-17eb7cf556fa.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/b988ceee-57fc-423b-8e67-5729086c6946.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/bfd68ea6-ddf4-44bb-aa87-2669f0462f7d.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/cb8ac58e-0e59-4391-95ab-6195e71b9625.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/d0f10434-afb5-49c5-9e77-d39a4f8cca94.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/d3f89fec-5795-4e11-8c15-bc2206a7fae2.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/e063c8a4-5ef1-4933-a049-b41049d9be5f.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/e2348b24-f290-4fe2-a6c8-e98009ae4c1b.lance +0 -0
- scmcp_shared/vector_db/decoupler.lance/data/e5d3f893-6763-40dc-9d02-04e2f56a4883.lance +0 -0
- {scmcp_shared-0.3.7.dist-info → scmcp_shared-0.5.0.dist-info}/METADATA +3 -1
- scmcp_shared-0.5.0.dist-info/RECORD +171 -0
- scmcp_shared/server/base.py +0 -148
- scmcp_shared-0.3.7.dist-info/RECORD +0 -21
- {scmcp_shared-0.3.7.dist-info → scmcp_shared-0.5.0.dist-info}/WHEEL +0 -0
- {scmcp_shared-0.3.7.dist-info → scmcp_shared-0.5.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,
|
2
|
-
from pydantic import
|
3
|
-
|
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=
|
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=
|
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
|
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
|
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=
|
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
|
-
|
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[
|
149
|
-
default=
|
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
|
-
|
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
|
-
# 重构
|
180
|
-
class
|
154
|
+
# 重构 ScatterParam 作为基础散点图模型
|
155
|
+
class BaseScatterParam(BaseVisualizationParam):
|
181
156
|
"""基础散点图模型"""
|
182
|
-
|
183
|
-
x: Optional[str] = Field(
|
184
|
-
|
185
|
-
|
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
|
-
# 使用继承关系重构
|
215
|
-
class
|
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[
|
241
|
-
default=
|
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(
|
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
|
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[
|
320
|
-
default=
|
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(
|
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
|
-
|
332
|
-
|
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
|
-
# 重构
|
378
|
-
class
|
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[
|
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(
|
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
|
-
# 重构
|
416
|
-
class
|
363
|
+
# 重构 TracksplotParam
|
364
|
+
class TracksplotParam(BaseMatrixParam):
|
417
365
|
"""Input schema for the tracksplot plotting tool."""
|
418
|
-
# 所有需要的字段已经在 BaseMatrixParams 中定义
|
419
366
|
|
367
|
+
# 所有需要的字段已经在 BaseMatrixParam 中定义
|
420
368
|
|
421
|
-
|
422
|
-
|
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
|
-
|
447
|
-
|
448
|
-
|
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(
|
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
|
-
# 重构
|
481
|
-
class
|
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=
|
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=
|
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[
|
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
|
-
|
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
|
-
# 重构
|
527
|
-
class
|
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[
|
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=
|
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=
|
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
|
-
# 重构
|
581
|
-
class
|
516
|
+
# 重构 RankGenesGroupsParam
|
517
|
+
class RankGenesGroupsParam(BaseVisualizationParam):
|
582
518
|
"""Input schema for the rank_genes_groups plotting tool."""
|
583
|
-
|
584
|
-
n_genes: int = Field(
|
585
|
-
|
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=
|
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(
|
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(
|
553
|
+
raise ValueError("Value must be a positive integer")
|
630
554
|
return v
|
631
555
|
|
632
556
|
|
633
557
|
# 重构 ClusterMapModel
|
634
|
-
class
|
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
|
-
|
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[
|
674
|
-
default=
|
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(
|
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
|
-
# 重构
|
692
|
-
class
|
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(
|
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(
|
632
|
+
raise ValueError("Value must be a positive integer")
|
717
633
|
return v
|
718
634
|
|
719
635
|
|
720
|
-
# 重构
|
721
|
-
class
|
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(
|
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
|
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
|
675
|
+
class UMAPParam(BaseEmbeddingParam):
|
765
676
|
"""Input schema for the UMAP plotting tool."""
|
766
|
-
|
677
|
+
|
678
|
+
# 所有需要的字段已经在 BaseEmbeddingParam 中定义
|
767
679
|
|
768
680
|
|
769
681
|
# 重构 TSNE 模型
|
770
|
-
class
|
682
|
+
class TSNEParam(BaseEmbeddingParam):
|
771
683
|
"""Input schema for the TSNE plotting tool."""
|
772
|
-
# 所有需要的字段已经在 BaseEmbeddingParams 中定义
|
773
684
|
|
774
|
-
#
|
775
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
715
|
+
class HighlyVariableGenesParam(BaseVisualizationParam):
|
807
716
|
"""Input schema for the highly_variable_genes plotting tool."""
|
808
|
-
|
809
|
-
log: bool = Field(
|
810
|
-
|
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
|
-
|
724
|
+
|
725
|
+
class PCAVarianceRatioParam(BaseVisualizationParam):
|
820
726
|
"""Input schema for the pca_variance_ratio plotting tool."""
|
821
|
-
|
822
|
-
n_pcs: int = Field(
|
823
|
-
|
824
|
-
|
825
|
-
|
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
|
-
|
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
|
-
|
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[
|
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
|
-
|
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
|
-
|
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
|
-
|