|
33 | 33 |
|
34 | 34 |
|
35 | 35 | class MDSession: |
| 36 | + """ |
| 37 | + A session for processing molecular data page endpoints. |
| 38 | + """ |
36 | 39 | def __init__(self, dataset_id: str, _client: _Client): |
| 40 | + """ |
| 41 | + Initializes the MDSession with the provided dataset ID and client. |
| 42 | + Do not call directly, use CapClient.md_session instead. |
| 43 | +
|
| 44 | + Args: |
| 45 | + dataset_id (str): The unique identifier of the dataset to be processed. |
| 46 | + _client (_Client): An instance of the client to interact with the backend API. |
| 47 | + """ |
37 | 48 | self.__client: _Client = _client |
38 | 49 | self._dataset_id: str = dataset_id |
39 | 50 | self._session_id: str = None |
@@ -334,6 +345,33 @@ def heatmap( |
334 | 345 | selection_key: SELECTION_KEY = None, |
335 | 346 | include_reference: bool = True |
336 | 347 | ) -> HeatmapDatasetEmbeddingDiffHeatMap: |
| 348 | + """ |
| 349 | + Return the data to plot a heatmap for the top differentially expressed genes from specific DE analysis. |
| 350 | +
|
| 351 | + Parameters: |
| 352 | + ----------- |
| 353 | + diff_key : DIFF_KEY |
| 354 | + The string key associated with the differential expression analysis results. |
| 355 | + n_top_genes : int, optional |
| 356 | + The number of top differentially expressed genes to include in the heatmap. Default is 3. |
| 357 | + max_cells_displayed : int, optional |
| 358 | + The maximum number of cells to display in the heatmap. Default is 1000. |
| 359 | + gene_name_filter : str, optional |
| 360 | + A filter to include only genes matching a given prefix. Should be used to focus on specific gene. Default is None. |
| 361 | + pseudogenes_filter : bool, optional |
| 362 | + If True, filters out genes which are often over-expressed but biologically non-informative. |
| 363 | + Defaults to True. See https://github.com/cellannotation/cap-gene-filtering for details. |
| 364 | + selection_key : SELECTION_KEY, optional |
| 365 | + If provided, the heatmap will include only cells within the specified selection. Default is None. |
| 366 | + include_reference : bool, optional |
| 367 | + If True, includes a reference selection in the heatmap. Default is True. |
| 368 | +
|
| 369 | + Returns: |
| 370 | + -------- |
| 371 | + HeatmapDatasetEmbeddingDiffHeatMap |
| 372 | + An object containing the heatmap data, including gene names, cell IDs, expression values, |
| 373 | + and selection information. |
| 374 | + """ |
337 | 375 |
|
338 | 376 | options=PostHeatmapInput( |
339 | 377 | diff_key = diff_key, |
@@ -373,6 +411,33 @@ def search_datasets( |
373 | 411 | offset: int = 0, |
374 | 412 | sort: List[Dict[str, str]] = [], |
375 | 413 | ) -> pd.DataFrame: |
| 414 | + """ |
| 415 | + Search public datasets, the analogue of the [dataset search page on CAP](https://celltype.info/search/datasets). |
| 416 | +
|
| 417 | + Parameters: |
| 418 | + ----------- |
| 419 | + search : List[str], optional |
| 420 | + A list of search terms to filter datasets by name. Defaults to None. |
| 421 | + organism : List[str], optional |
| 422 | + A list of organism names to filter datasets. Defaults to None. |
| 423 | + tissue : List[str], optional |
| 424 | + A list of tissue types to filter datasets. Defaults to None. |
| 425 | + assay : List[str], optional |
| 426 | + A list of assay types to filter datasets. Defaults to None. |
| 427 | + limit : int, optional |
| 428 | + The maximum number of datasets to return. Defaults to 50. |
| 429 | + offset : int, optional |
| 430 | + The number of datasets to skip before starting to collect the result set. Defaults to 0. |
| 431 | + sort : List[Dict[str, str]], optional |
| 432 | + A list of dictionaries specifying the sorting order. Each dictionary should have a single key-value pair |
| 433 | + where the key is the field to sort by and the value is either "asc" for ascending or "desc" for descending order. |
| 434 | + Example: [{"name": "asc"}, {"createdAt": "desc"}]. Defaults to an empty list. |
| 435 | +
|
| 436 | + Returns: |
| 437 | + -------- |
| 438 | + pd.DataFrame |
| 439 | + A DataFrame containing the search results with columns corresponding to dataset attributes. |
| 440 | + """ |
376 | 441 | sorting = [] |
377 | 442 | for item in sort: |
378 | 443 | key = list(item.keys())[0] |
@@ -411,6 +476,33 @@ def search_cell_labels( |
411 | 476 | offset: int = 0, |
412 | 477 | sort: List[Dict[str, str]] = [], |
413 | 478 | ) -> pd.DataFrame: |
| 479 | + """ |
| 480 | + Search for cell labels in the dataset. The analogue of the [cell labels search page on CAP](https://celltype.info/search/cell-labels). |
| 481 | +
|
| 482 | + Parameters: |
| 483 | + ----------- |
| 484 | + search : List[str], optional |
| 485 | + A list of search terms to filter datasets by name. Defaults to None. |
| 486 | + organism : List[str], optional |
| 487 | + A list of organism names to filter datasets. Defaults to None. |
| 488 | + tissue : List[str], optional |
| 489 | + A list of tissue types to filter datasets. Defaults to None. |
| 490 | + assay : List[str], optional |
| 491 | + A list of assay types to filter datasets. Defaults to None. |
| 492 | + limit : int, optional |
| 493 | + The maximum number of datasets to return. Defaults to 50. |
| 494 | + offset : int, optional |
| 495 | + The number of datasets to skip before starting to collect the result set. Defaults to 0. |
| 496 | + sort : List[Dict[str, str]], optional |
| 497 | + A list of dictionaries specifying the sorting order. Each dictionary should have a single key-value pair |
| 498 | + where the key is the field to sort by and the value is either "asc" for ascending or "desc" for descending order. |
| 499 | + Example: [{"name": "asc"}, {"createdAt": "desc"}]. Defaults to an empty list. |
| 500 | +
|
| 501 | + Returns: |
| 502 | + -------- |
| 503 | + pd.DataFrame |
| 504 | + A DataFrame containing the search results with columns corresponding to cell annotation metadata attributes. |
| 505 | + """ |
414 | 506 | sorting = [] |
415 | 507 | for item in sort: |
416 | 508 | key = list(item.keys())[0] |
|
0 commit comments