cells_search_format: Format Cell Search Results for Query Based on Lineage

View source: R/cells.R

cells_search_formatR Documentation

Format Cell Search Results for Query Based on Lineage

Description

This function formats the results from cell search queries into a structured list based on specified lineage criteria. It allows subsetting of the cell data to include parent cells, child cells, or both in the output, and converts them into a named list where each key is a cell_id and each value is a string representing a condition on the marker_score.

Usage

cells_search_format(cell_list, cells_lineages = "both")

Arguments

cell_list

A list of cells, each including details such as cell_id and marker_score, and optionally containing nested lists of child cells.

cells_lineages

A character string specifying the lineage subset to include in the output. Options are "parent" for only parent cells, "childs" for only child cells, and "both" for including both parent and child cells. Defaults to "both".

Value

A named list where keys are cell_ids and values are strings formatted as conditions on the marker_score. This list can be used for constructing query conditions in further API requests.

Examples

cells <- list(
  list(cell_id = "CL0000235", cell_name = "macrophage", 
  marker_score = 1112.325, childs = list()),
  list(cell_id = "CL0000784", cell_name = "plasmacytoid dendritic cell", 
  marker_score = 537.7737, childs = list(
    list(cell_id = "CL0001058", cell_name = "plasmacytoid dendritic cell, human", 
  marker_score = 262.985)
  ))
)
formatted_query_values <- cells_search_format(cells, cells_lineages = "both")
print(formatted_query_values)

genular documentation built on Oct. 19, 2024, 9:07 a.m.