scmcp-shared 0.3.6__py3-none-any.whl → 0.4.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 -1
- scmcp_shared/agent.py +30 -0
- scmcp_shared/cli.py +10 -0
- scmcp_shared/schema/io.py +2 -2
- scmcp_shared/schema/pl.py +42 -42
- scmcp_shared/schema/pp.py +10 -10
- scmcp_shared/schema/tl.py +18 -18
- scmcp_shared/schema/tool.py +11 -0
- scmcp_shared/schema/util.py +9 -9
- scmcp_shared/server/auto.py +52 -0
- scmcp_shared/server/base.py +7 -12
- scmcp_shared/server/io.py +5 -4
- scmcp_shared/server/pl.py +33 -32
- scmcp_shared/server/pp.py +32 -24
- scmcp_shared/server/tl.py +35 -34
- scmcp_shared/server/util.py +19 -18
- {scmcp_shared-0.3.6.dist-info → scmcp_shared-0.4.0.dist-info}/METADATA +5 -2
- scmcp_shared-0.4.0.dist-info/RECORD +24 -0
- scmcp_shared-0.3.6.dist-info/RECORD +0 -21
- {scmcp_shared-0.3.6.dist-info → scmcp_shared-0.4.0.dist-info}/WHEEL +0 -0
- {scmcp_shared-0.3.6.dist-info → scmcp_shared-0.4.0.dist-info}/licenses/LICENSE +0 -0
scmcp_shared/__init__.py
CHANGED
scmcp_shared/agent.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
import instructor
|
2
|
+
from openai import OpenAI
|
3
|
+
from scmcp_shared.schema.tool import ToolList
|
4
|
+
import os
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
def select_tool(query):
|
9
|
+
|
10
|
+
API_KEY = os.environ.get("API_KEY", None)
|
11
|
+
BASE_URL = os.environ.get("BASE_URL", None)
|
12
|
+
MODEL = os.environ.get("MODEL", None)
|
13
|
+
|
14
|
+
client = OpenAI(api_key=API_KEY, base_url=BASE_URL)
|
15
|
+
client = instructor.from_openai(client)
|
16
|
+
|
17
|
+
response = client.chat.completions.create(
|
18
|
+
model=MODEL,
|
19
|
+
messages=[
|
20
|
+
{
|
21
|
+
"role": "system",
|
22
|
+
"content": f"you are a bioinformatician, you are given a task and a list of tools, you need to select the most directly relevant tools to use to solve the task"},
|
23
|
+
{
|
24
|
+
"role": "user",
|
25
|
+
"content": query
|
26
|
+
},
|
27
|
+
],
|
28
|
+
response_model=ToolList,
|
29
|
+
)
|
30
|
+
return response.tools
|
scmcp_shared/cli.py
CHANGED
@@ -35,6 +35,7 @@ class MCPCLI:
|
|
35
35
|
parser.add_argument('--host', default='127.0.0.1', help='transport host')
|
36
36
|
parser.add_argument('-f', '--forward', help='forward request to another server')
|
37
37
|
parser.add_argument('-wd', '--working-dir', default=".", help='working directory')
|
38
|
+
parser.add_argument('--tool-mode', choices=["auto", "normal"], default="normal", help='tool selection mode')
|
38
39
|
parser.add_argument('--log-file', help='log file path, use stdout if None')
|
39
40
|
|
40
41
|
def add_command(self, name: str, help_text: str, handler: Callable) -> argparse.ArgumentParser:
|
@@ -78,6 +79,15 @@ class MCPCLI:
|
|
78
79
|
modules = None
|
79
80
|
if self.manager is not None:
|
80
81
|
self.mcp = self.manager(self.name, include_modules=modules).mcp
|
82
|
+
all_tools = self.mcp._tool_manager._tools
|
83
|
+
auto_tools = {tool: all_tools[tool] for tool in all_tools if all_tools[tool].name in ["search_tool", "run_tool"]}
|
84
|
+
if args.tool_mode == "auto":
|
85
|
+
all_tools = self.mcp._tool_manager._tools
|
86
|
+
self.mcp._tool_manager._all_tools = all_tools
|
87
|
+
self.mcp._tool_manager._tools = auto_tools
|
88
|
+
else:
|
89
|
+
for name in auto_tools:
|
90
|
+
self.mcp._tool_manager.remove_tool(name)
|
81
91
|
elif self.mcp is not None:
|
82
92
|
pass
|
83
93
|
else:
|
scmcp_shared/schema/io.py
CHANGED
@@ -7,7 +7,7 @@ from typing import Optional, Literal
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
-
class
|
10
|
+
class ReadParams(BaseModel):
|
11
11
|
"""Input schema for the read tool."""
|
12
12
|
filename: str = Field(
|
13
13
|
...,
|
@@ -82,7 +82,7 @@ class ReadModel(BaseModel):
|
|
82
82
|
return v
|
83
83
|
|
84
84
|
|
85
|
-
class
|
85
|
+
class WriteParams(BaseModel):
|
86
86
|
"""Input schema for the write tool."""
|
87
87
|
filename: str = Field(
|
88
88
|
description="Path to save the file. If no extension is provided, the default format will be used."
|
scmcp_shared/schema/pl.py
CHANGED
@@ -72,12 +72,12 @@ class FigureSizeMixin:
|
|
72
72
|
|
73
73
|
|
74
74
|
# 基础可视化模型,包含所有可视化工具共享的字段
|
75
|
-
class
|
75
|
+
class BaseVisualizationParams(BaseModel, LegendMixin, ColorMappingMixin, FigureSizeMixin):
|
76
76
|
"""基础可视化模型,包含所有可视化工具共享的字段"""
|
77
77
|
pass
|
78
78
|
|
79
79
|
# 基础嵌入可视化模型,包含所有嵌入可视化工具共享的字段
|
80
|
-
class
|
80
|
+
class BaseEmbeddingParams(BaseVisualizationParams):
|
81
81
|
"""基础嵌入可视化模型,包含所有嵌入可视化工具共享的字段"""
|
82
82
|
|
83
83
|
color: Optional[Union[str, List[str]]] = Field(
|
@@ -176,8 +176,8 @@ class BaseEmbeddingModel(BaseVisualizationModel):
|
|
176
176
|
)
|
177
177
|
|
178
178
|
|
179
|
-
# 重构
|
180
|
-
class
|
179
|
+
# 重构 ScatterParams 作为基础散点图模型
|
180
|
+
class BaseScatterParams(BaseVisualizationParams):
|
181
181
|
"""基础散点图模型"""
|
182
182
|
|
183
183
|
x: Optional[str] = Field(
|
@@ -211,8 +211,8 @@ class BaseScatterModel(BaseVisualizationModel):
|
|
211
211
|
)
|
212
212
|
|
213
213
|
|
214
|
-
# 使用继承关系重构
|
215
|
-
class
|
214
|
+
# 使用继承关系重构 EnhancedScatterParams
|
215
|
+
class EnhancedScatterParams(BaseScatterParams):
|
216
216
|
"""Input schema for the enhanced scatter plotting tool."""
|
217
217
|
|
218
218
|
sort_order: bool = Field(
|
@@ -261,7 +261,7 @@ class EnhancedScatterModel(BaseScatterModel):
|
|
261
261
|
|
262
262
|
|
263
263
|
# 创建基础统计可视化模型
|
264
|
-
class
|
264
|
+
class BaseStatPlotParams(BaseVisualizationParams):
|
265
265
|
"""基础统计可视化模型,包含统计图表共享的字段"""
|
266
266
|
|
267
267
|
groupby: Optional[str] = Field(
|
@@ -328,8 +328,8 @@ class BaseStatPlotModel(BaseVisualizationModel):
|
|
328
328
|
raise ValueError("size must be a positive integer")
|
329
329
|
return v
|
330
330
|
|
331
|
-
# 添加缺失的
|
332
|
-
class
|
331
|
+
# 添加缺失的 BaseMatrixParams 类
|
332
|
+
class BaseMatrixParams(BaseVisualizationParams):
|
333
333
|
"""基础矩阵可视化模型,包含所有矩阵可视化工具共享的字段"""
|
334
334
|
|
335
335
|
var_names: Union[List[str], Mapping[str, List[str]]] = Field(
|
@@ -374,8 +374,8 @@ class BaseMatrixModel(BaseVisualizationModel):
|
|
374
374
|
)
|
375
375
|
|
376
376
|
|
377
|
-
# 重构
|
378
|
-
class
|
377
|
+
# 重构 HeatmapParams
|
378
|
+
class HeatmapParams(BaseMatrixParams):
|
379
379
|
"""Input schema for the heatmap plotting tool."""
|
380
380
|
|
381
381
|
num_categories: int = Field(
|
@@ -412,14 +412,14 @@ class HeatmapModel(BaseMatrixModel):
|
|
412
412
|
return v
|
413
413
|
|
414
414
|
|
415
|
-
# 重构
|
416
|
-
class
|
415
|
+
# 重构 TracksplotParams
|
416
|
+
class TracksplotParams(BaseMatrixParams):
|
417
417
|
"""Input schema for the tracksplot plotting tool."""
|
418
|
-
# 所有需要的字段已经在
|
418
|
+
# 所有需要的字段已经在 BaseMatrixParams 中定义
|
419
419
|
|
420
420
|
|
421
|
-
# 重构
|
422
|
-
class
|
421
|
+
# 重构 ViolinParams
|
422
|
+
class ViolinParams(BaseStatPlotParams):
|
423
423
|
"""Input schema for the violin plotting tool."""
|
424
424
|
|
425
425
|
keys: Union[str, List[str]] = Field(
|
@@ -477,8 +477,8 @@ class ViolinModel(BaseStatPlotModel):
|
|
477
477
|
return v
|
478
478
|
|
479
479
|
|
480
|
-
# 重构
|
481
|
-
class
|
480
|
+
# 重构 MatrixplotParams
|
481
|
+
class MatrixplotParams(BaseMatrixParams):
|
482
482
|
"""Input schema for the matrixplot plotting tool."""
|
483
483
|
|
484
484
|
num_categories: int = Field(
|
@@ -523,8 +523,8 @@ class MatrixplotModel(BaseMatrixModel):
|
|
523
523
|
return v
|
524
524
|
|
525
525
|
|
526
|
-
# 重构
|
527
|
-
class
|
526
|
+
# 重构 DotplotParams
|
527
|
+
class DotplotParams(BaseMatrixParams):
|
528
528
|
"""Input schema for the dotplot plotting tool."""
|
529
529
|
|
530
530
|
expression_cutoff: float = Field(
|
@@ -577,8 +577,8 @@ class DotplotModel(BaseMatrixModel):
|
|
577
577
|
)
|
578
578
|
|
579
579
|
|
580
|
-
# 重构
|
581
|
-
class
|
580
|
+
# 重构 RankGenesGroupsParams
|
581
|
+
class RankGenesGroupsParams(BaseVisualizationParams):
|
582
582
|
"""Input schema for the rank_genes_groups plotting tool."""
|
583
583
|
|
584
584
|
n_genes: int = Field(
|
@@ -631,7 +631,7 @@ class RankGenesGroupsModel(BaseVisualizationModel):
|
|
631
631
|
|
632
632
|
|
633
633
|
# 重构 ClusterMapModel
|
634
|
-
class
|
634
|
+
class ClusterMapParams(BaseModel):
|
635
635
|
"""Input schema for the clustermap plotting tool."""
|
636
636
|
|
637
637
|
obs_keys: Optional[str] = Field(
|
@@ -645,8 +645,8 @@ class ClusterMapModel(BaseModel):
|
|
645
645
|
|
646
646
|
|
647
647
|
|
648
|
-
# 重构
|
649
|
-
class
|
648
|
+
# 重构 StackedViolinParams
|
649
|
+
class StackedViolinParams(BaseStatPlotParams):
|
650
650
|
"""Input schema for the stacked_violin plotting tool."""
|
651
651
|
|
652
652
|
stripplot: bool = Field(
|
@@ -688,8 +688,8 @@ class StackedViolinModel(BaseStatPlotModel):
|
|
688
688
|
return v
|
689
689
|
|
690
690
|
|
691
|
-
# 重构
|
692
|
-
class
|
691
|
+
# 重构 TrackingParams
|
692
|
+
class TrackingParams(BaseVisualizationParams):
|
693
693
|
"""Input schema for the tracking plotting tool."""
|
694
694
|
|
695
695
|
groupby: str = Field(
|
@@ -717,8 +717,8 @@ class TrackingModel(BaseVisualizationModel):
|
|
717
717
|
return v
|
718
718
|
|
719
719
|
|
720
|
-
# 重构
|
721
|
-
class
|
720
|
+
# 重构 EmbeddingDensityParams
|
721
|
+
class EmbeddingDensityParams(BaseEmbeddingParams):
|
722
722
|
"""Input schema for the embedding_density plotting tool."""
|
723
723
|
|
724
724
|
basis: str = Field(
|
@@ -751,7 +751,7 @@ class EmbeddingDensityModel(BaseEmbeddingModel):
|
|
751
751
|
return v
|
752
752
|
|
753
753
|
|
754
|
-
class
|
754
|
+
class PCAParams(BaseEmbeddingParams):
|
755
755
|
"""Input schema for the PCA plotting tool."""
|
756
756
|
|
757
757
|
annotate_var_explained: bool = Field(
|
@@ -761,22 +761,22 @@ class PCAModel(BaseEmbeddingModel):
|
|
761
761
|
|
762
762
|
|
763
763
|
# 重构 UMAP 模型
|
764
|
-
class
|
764
|
+
class UMAPParams(BaseEmbeddingParams):
|
765
765
|
"""Input schema for the UMAP plotting tool."""
|
766
|
-
# 所有需要的字段已经在
|
766
|
+
# 所有需要的字段已经在 BaseEmbeddingParams 中定义
|
767
767
|
|
768
768
|
|
769
769
|
# 重构 TSNE 模型
|
770
|
-
class
|
770
|
+
class TSNEParams(BaseEmbeddingParams):
|
771
771
|
"""Input schema for the TSNE plotting tool."""
|
772
|
-
# 所有需要的字段已经在
|
772
|
+
# 所有需要的字段已经在 BaseEmbeddingParams 中定义
|
773
773
|
|
774
|
-
# 重构
|
775
|
-
class
|
774
|
+
# 重构 DiffusionMapParams
|
775
|
+
class DiffusionMapParams(BaseEmbeddingParams):
|
776
776
|
"""Input schema for the diffusion map plotting tool."""
|
777
|
-
# 所有需要的字段已经在
|
777
|
+
# 所有需要的字段已经在 BaseEmbeddingParams 中定义
|
778
778
|
|
779
|
-
class
|
779
|
+
class HighestExprGenesParams(BaseVisualizationParams):
|
780
780
|
"""Input schema for the highest_expr_genes plotting tool."""
|
781
781
|
|
782
782
|
n_top: int = Field(
|
@@ -803,7 +803,7 @@ class HighestExprGenesModel(BaseVisualizationModel):
|
|
803
803
|
return v
|
804
804
|
|
805
805
|
|
806
|
-
class
|
806
|
+
class HighlyVariableGenesParams(BaseVisualizationParams):
|
807
807
|
"""Input schema for the highly_variable_genes plotting tool."""
|
808
808
|
|
809
809
|
log: bool = Field(
|
@@ -816,7 +816,7 @@ class HighlyVariableGenesModel(BaseVisualizationModel):
|
|
816
816
|
description="Whether to plot highly variable genes or all genes."
|
817
817
|
)
|
818
818
|
|
819
|
-
class
|
819
|
+
class PCAVarianceRatioParams(BaseVisualizationParams):
|
820
820
|
"""Input schema for the pca_variance_ratio plotting tool."""
|
821
821
|
|
822
822
|
n_pcs: int = Field(
|
@@ -839,7 +839,7 @@ class PCAVarianceRatioModel(BaseVisualizationModel):
|
|
839
839
|
|
840
840
|
# ... existing code ...
|
841
841
|
|
842
|
-
class
|
842
|
+
class RankGenesGroupsDotplotParams(BaseMatrixParams):
|
843
843
|
"""Input schema for the rank_genes_groups_dotplot plotting tool."""
|
844
844
|
|
845
845
|
groups: Optional[Union[str, List[str]]] = Field(
|
@@ -874,7 +874,7 @@ class RankGenesGroupsDotplotModel(BaseMatrixModel):
|
|
874
874
|
|
875
875
|
|
876
876
|
|
877
|
-
class
|
877
|
+
class EmbeddingParams(BaseEmbeddingParams):
|
878
878
|
"""Input schema for the embedding plotting tool."""
|
879
879
|
|
880
880
|
basis: str = Field(
|
scmcp_shared/schema/pp.py
CHANGED
@@ -73,7 +73,7 @@ class FilterGenes(BaseModel):
|
|
73
73
|
return v
|
74
74
|
|
75
75
|
|
76
|
-
class
|
76
|
+
class SubsetCellParams(BaseModel):
|
77
77
|
"""Input schema for subsetting AnnData objects based on various criteria."""
|
78
78
|
obs_key: Optional[str] = Field(
|
79
79
|
default=None,
|
@@ -109,7 +109,7 @@ class SubsetCellModel(BaseModel):
|
|
109
109
|
)
|
110
110
|
|
111
111
|
|
112
|
-
class
|
112
|
+
class SubsetGeneParams(BaseModel):
|
113
113
|
"""Input schema for subsetting AnnData objects based on various criteria."""
|
114
114
|
min_counts: Optional[int] = Field(
|
115
115
|
default=None,
|
@@ -196,7 +196,7 @@ class CalculateQCMetrics(BaseModel):
|
|
196
196
|
|
197
197
|
|
198
198
|
|
199
|
-
class
|
199
|
+
class Log1PParams(BaseModel):
|
200
200
|
"""Input schema for the log1p preprocessing tool."""
|
201
201
|
|
202
202
|
base: Optional[Union[int, float]] = Field(
|
@@ -233,7 +233,7 @@ class Log1PModel(BaseModel):
|
|
233
233
|
|
234
234
|
|
235
235
|
|
236
|
-
class
|
236
|
+
class HighlyVariableGenesParams(BaseModel):
|
237
237
|
"""Input schema for the highly_variable_genes preprocessing tool."""
|
238
238
|
|
239
239
|
layer: Optional[str] = Field(
|
@@ -307,7 +307,7 @@ class HighlyVariableGenesModel(BaseModel):
|
|
307
307
|
return v
|
308
308
|
|
309
309
|
|
310
|
-
class
|
310
|
+
class RegressOutParams(BaseModel):
|
311
311
|
"""Input schema for the regress_out preprocessing tool."""
|
312
312
|
|
313
313
|
keys: Union[str, List[str]] = Field(
|
@@ -340,7 +340,7 @@ class RegressOutModel(BaseModel):
|
|
340
340
|
raise ValueError("keys must be a string or list of strings")
|
341
341
|
|
342
342
|
|
343
|
-
class
|
343
|
+
class ScaleParams(BaseModel):
|
344
344
|
"""Input schema for the scale preprocessing tool."""
|
345
345
|
|
346
346
|
zero_center: bool = Field(
|
@@ -376,7 +376,7 @@ class ScaleModel(BaseModel):
|
|
376
376
|
return v
|
377
377
|
|
378
378
|
|
379
|
-
class
|
379
|
+
class CombatParams(BaseModel):
|
380
380
|
"""Input schema for the combat batch effect correction tool."""
|
381
381
|
|
382
382
|
key: str = Field(
|
@@ -405,7 +405,7 @@ class CombatModel(BaseModel):
|
|
405
405
|
return v
|
406
406
|
|
407
407
|
|
408
|
-
class
|
408
|
+
class ScrubletParams(BaseModel):
|
409
409
|
"""Input schema for the scrublet doublet prediction tool."""
|
410
410
|
|
411
411
|
adata_sim: Optional[str] = Field(
|
@@ -511,7 +511,7 @@ class ScrubletModel(BaseModel):
|
|
511
511
|
return v.lower()
|
512
512
|
|
513
513
|
|
514
|
-
class
|
514
|
+
class NeighborsParams(BaseModel):
|
515
515
|
"""Input schema for the neighbors graph construction tool."""
|
516
516
|
|
517
517
|
n_neighbors: int = Field(
|
@@ -589,7 +589,7 @@ class NeighborsModel(BaseModel):
|
|
589
589
|
return v
|
590
590
|
|
591
591
|
|
592
|
-
class
|
592
|
+
class NormalizeTotalParams(BaseModel):
|
593
593
|
"""Input schema for the normalize_total preprocessing tool."""
|
594
594
|
|
595
595
|
target_sum: Optional[float] = Field(
|
scmcp_shared/schema/tl.py
CHANGED
@@ -2,7 +2,7 @@ from pydantic import Field, field_validator, ValidationInfo, BaseModel
|
|
2
2
|
from typing import Optional, Union, List, Dict, Any, Tuple, Literal, Mapping
|
3
3
|
|
4
4
|
|
5
|
-
class
|
5
|
+
class TSNEParams(BaseModel):
|
6
6
|
"""Input schema for the t-SNE dimensionality reduction tool."""
|
7
7
|
n_pcs: Optional[int] = Field(
|
8
8
|
default=None,
|
@@ -59,7 +59,7 @@ class TSNEModel(BaseModel):
|
|
59
59
|
return v.lower()
|
60
60
|
|
61
61
|
|
62
|
-
class
|
62
|
+
class UMAPParams(BaseModel):
|
63
63
|
"""Input schema for the UMAP dimensionality reduction tool."""
|
64
64
|
|
65
65
|
min_dist: Optional[float] = Field(
|
@@ -145,7 +145,7 @@ class UMAPModel(BaseModel):
|
|
145
145
|
return v.lower()
|
146
146
|
|
147
147
|
|
148
|
-
class
|
148
|
+
class DrawGraphParams(BaseModel):
|
149
149
|
"""Input schema for the force-directed graph drawing tool."""
|
150
150
|
|
151
151
|
layout: str = Field(
|
@@ -199,7 +199,7 @@ class DrawGraphModel(BaseModel):
|
|
199
199
|
return v
|
200
200
|
|
201
201
|
|
202
|
-
class
|
202
|
+
class DiffMapParams(BaseModel):
|
203
203
|
"""Input schema for the Diffusion Maps dimensionality reduction tool."""
|
204
204
|
|
205
205
|
n_comps: int = Field(
|
@@ -229,7 +229,7 @@ class DiffMapModel(BaseModel):
|
|
229
229
|
return v
|
230
230
|
|
231
231
|
|
232
|
-
class
|
232
|
+
class EmbeddingDensityParams(BaseModel):
|
233
233
|
"""Input schema for the embedding density calculation tool."""
|
234
234
|
|
235
235
|
basis: str = Field(
|
@@ -257,7 +257,7 @@ class EmbeddingDensityModel(BaseModel):
|
|
257
257
|
return v
|
258
258
|
|
259
259
|
|
260
|
-
class
|
260
|
+
class LeidenParams(BaseModel):
|
261
261
|
"""Input schema for the Leiden clustering algorithm."""
|
262
262
|
|
263
263
|
resolution: Optional[float] = Field(
|
@@ -324,7 +324,7 @@ class LeidenModel(BaseModel):
|
|
324
324
|
return v
|
325
325
|
|
326
326
|
|
327
|
-
class
|
327
|
+
class LouvainParams(BaseModel):
|
328
328
|
"""Input schema for the Louvain clustering algorithm."""
|
329
329
|
|
330
330
|
resolution: Optional[float] = Field(
|
@@ -396,7 +396,7 @@ class LouvainModel(BaseModel):
|
|
396
396
|
return v
|
397
397
|
|
398
398
|
|
399
|
-
class
|
399
|
+
class DendrogramParams(BaseModel):
|
400
400
|
"""Input schema for the hierarchical clustering dendrogram tool."""
|
401
401
|
|
402
402
|
groupby: str = Field(
|
@@ -461,7 +461,7 @@ class DendrogramModel(BaseModel):
|
|
461
461
|
return v
|
462
462
|
|
463
463
|
|
464
|
-
class
|
464
|
+
class DPTParams(BaseModel):
|
465
465
|
"""Input schema for the Diffusion Pseudotime (DPT) tool."""
|
466
466
|
|
467
467
|
n_dcs: int = Field(
|
@@ -510,7 +510,7 @@ class DPTModel(BaseModel):
|
|
510
510
|
raise ValueError("min_group_size must be between 0 and 1")
|
511
511
|
return v
|
512
512
|
|
513
|
-
class
|
513
|
+
class PAGAParams(BaseModel):
|
514
514
|
"""Input schema for the Partition-based Graph Abstraction (PAGA) tool."""
|
515
515
|
|
516
516
|
groups: Optional[str] = Field(
|
@@ -531,14 +531,14 @@ class PAGAModel(BaseModel):
|
|
531
531
|
)
|
532
532
|
|
533
533
|
@field_validator('model')
|
534
|
-
def
|
534
|
+
def validate_Params(cls, v: str) -> str:
|
535
535
|
"""Validate model version is supported"""
|
536
536
|
if v not in ['v1.2', 'v1.0']:
|
537
537
|
raise ValueError("model must be either 'v1.2' or 'v1.0'")
|
538
538
|
return v
|
539
539
|
|
540
540
|
|
541
|
-
class
|
541
|
+
class IngestParams(BaseModel):
|
542
542
|
"""Input schema for the ingest tool that maps labels and embeddings from reference data to new data."""
|
543
543
|
|
544
544
|
obs: Optional[Union[str, List[str]]] = Field(
|
@@ -587,7 +587,7 @@ class IngestModel(BaseModel):
|
|
587
587
|
return v.lower()
|
588
588
|
|
589
589
|
|
590
|
-
class
|
590
|
+
class RankGenesGroupsParams(BaseModel):
|
591
591
|
"""Input schema for the rank_genes_groups tool."""
|
592
592
|
|
593
593
|
groupby: str = Field(
|
@@ -669,7 +669,7 @@ class RankGenesGroupsModel(BaseModel):
|
|
669
669
|
return v
|
670
670
|
|
671
671
|
|
672
|
-
class
|
672
|
+
class FilterRankGenesGroupsParams(BaseModel):
|
673
673
|
"""Input schema for filtering ranked genes groups."""
|
674
674
|
|
675
675
|
key: Optional[str] = Field(
|
@@ -732,7 +732,7 @@ class FilterRankGenesGroupsModel(BaseModel):
|
|
732
732
|
return v
|
733
733
|
|
734
734
|
|
735
|
-
class
|
735
|
+
class MarkerGeneOverlapParams(BaseModel):
|
736
736
|
"""Input schema for the marker gene overlap tool."""
|
737
737
|
|
738
738
|
key: str = Field(
|
@@ -803,7 +803,7 @@ class MarkerGeneOverlapModel(BaseModel):
|
|
803
803
|
return v
|
804
804
|
|
805
805
|
|
806
|
-
class
|
806
|
+
class ScoreGenesParams(BaseModel):
|
807
807
|
"""Input schema for the score_genes tool that calculates gene scores based on average expression."""
|
808
808
|
|
809
809
|
ctrl_size: int = Field(
|
@@ -846,7 +846,7 @@ class ScoreGenesModel(BaseModel):
|
|
846
846
|
return v
|
847
847
|
|
848
848
|
|
849
|
-
class
|
849
|
+
class ScoreGenesCellCycleParams(BaseModel):
|
850
850
|
"""Input schema for the score_genes_cell_cycle tool that scores cell cycle genes."""
|
851
851
|
|
852
852
|
s_genes: List[str] = Field(
|
@@ -896,7 +896,7 @@ class ScoreGenesCellCycleModel(BaseModel):
|
|
896
896
|
|
897
897
|
|
898
898
|
|
899
|
-
class
|
899
|
+
class PCAParams(BaseModel):
|
900
900
|
"""Input schema for the PCA preprocessing tool."""
|
901
901
|
|
902
902
|
n_comps: Optional[int] = Field(
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from pydantic import BaseModel, Field
|
2
|
+
from typing import List
|
3
|
+
|
4
|
+
|
5
|
+
class Tool(BaseModel):
|
6
|
+
name: str = Field(description="The name of the tool")
|
7
|
+
description: str = Field(description="The description of the tool")
|
8
|
+
|
9
|
+
|
10
|
+
class ToolList(BaseModel):
|
11
|
+
tools: List[Tool]
|
scmcp_shared/schema/util.py
CHANGED
@@ -10,7 +10,7 @@ from typing import Optional, Union, List, Dict, Any, Callable, Collection, Liter
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
class
|
13
|
+
class MarkVarParams(BaseModel):
|
14
14
|
"""Determine or mark if each gene meets specific conditions and store results in adata.var as boolean values"""
|
15
15
|
|
16
16
|
var_name: str = Field(
|
@@ -32,15 +32,15 @@ class MarkVarModel(BaseModel):
|
|
32
32
|
)
|
33
33
|
|
34
34
|
|
35
|
-
class
|
35
|
+
class ListVarParams(BaseModel):
|
36
36
|
"""ListVarModel"""
|
37
37
|
pass
|
38
38
|
|
39
|
-
class
|
39
|
+
class ListObsParams(BaseModel):
|
40
40
|
"""ListObsModel"""
|
41
41
|
pass
|
42
42
|
|
43
|
-
class
|
43
|
+
class VarNamesParams(BaseModel):
|
44
44
|
"""ListObsModel"""
|
45
45
|
var_names: List[str] = Field(
|
46
46
|
default=None,
|
@@ -48,7 +48,7 @@ class VarNamesModel(BaseModel):
|
|
48
48
|
)
|
49
49
|
|
50
50
|
|
51
|
-
class
|
51
|
+
class ConcatBaseParams(BaseModel):
|
52
52
|
"""Model for concatenating AnnData objects"""
|
53
53
|
|
54
54
|
axis: Literal['obs', 0, 'var', 1] = Field(
|
@@ -89,7 +89,7 @@ class ConcatBaseModel(BaseModel):
|
|
89
89
|
)
|
90
90
|
|
91
91
|
|
92
|
-
class
|
92
|
+
class DPTIROOTParams(BaseModel):
|
93
93
|
"""Input schema for setting the root cell for diffusion pseudotime."""
|
94
94
|
diffmap_key: str = Field(
|
95
95
|
default="X_diffmap",
|
@@ -103,7 +103,7 @@ class DPTIROOTModel(BaseModel):
|
|
103
103
|
)
|
104
104
|
|
105
105
|
|
106
|
-
class
|
106
|
+
class CelltypeMapCellTypeParams(BaseModel):
|
107
107
|
"""Input schema for mapping cluster IDs to cell type names."""
|
108
108
|
cluster_key: str = Field(
|
109
109
|
description="Key in adata.obs containing cluster IDs."
|
@@ -122,14 +122,14 @@ class CelltypeMapCellTypeModel(BaseModel):
|
|
122
122
|
|
123
123
|
|
124
124
|
|
125
|
-
class
|
125
|
+
class AddLayerParams(BaseModel):
|
126
126
|
"""Input schema for adding a layer to AnnData object."""
|
127
127
|
layer_name: str = Field(
|
128
128
|
description="Name of the layer to add to adata.layers."
|
129
129
|
)
|
130
130
|
|
131
131
|
|
132
|
-
class
|
132
|
+
class QueryOpLogParams(BaseModel):
|
133
133
|
"""QueryOpLogModel"""
|
134
134
|
n: int = Field(
|
135
135
|
default=10,
|