scdef.pl.make_graph ¶
make_graph(model: scDEF, hierarchy: Optional[Dict[str, Sequence[str]]] = None, show_all: Optional[bool] = False, factor_annotations: Optional[Dict[str, str]] = None, top_factor: Optional[str] = None, show_signatures: Optional[bool] = True, drop_factors: Optional[List[str]] = None, root_signature: Optional[List[str]] = None, root_ranking: Optional[List[str]] = None, enrichments: Optional[DataFrame] = None, show_enrichments: Optional[bool] = False, top_genes: Optional[Union[int, List[int]]] = None, show_batch_counts: Optional[bool] = False, filled: Optional[Union[str, Dict[str, float]]] = None, wedged: Optional[str] = None, assignments: Optional[bool] = True, color_edges: Optional[bool] = True, show_confidences: Optional[bool] = False, n_cells_label: Optional[bool] = False, n_cells: Optional[bool] = False, node_size_max: Optional[float] = 2.0, node_size_min: Optional[float] = 0.05, scale_level: Optional[bool] = False, show_label: Optional[bool] = True, gene_score: Optional[str] = None, gene_cmap: Optional[str] = 'viridis', gene_score_scale: str = 'factor', path: Optional[Union[Sequence[str], Dict[str, Any]]] = None, path_color: str = 'red', path_node_penwidth: float = 2.5, confident_assignments: bool = False, confident_key: str = 'confident', shell: Optional[bool] = False, r: Optional[float] = 2.0, r_decay: Optional[float] = 0.8, root_shape: Optional[str] = None, bottom_layer: int = 0, **fontsize_kwargs: Any) -> Graph
Make Graphviz-formatted scDEF graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
scDEF
|
scDEF model instance |
required |
hierarchy
|
Optional[Dict[str, Sequence[str]]]
|
dictionary containing the polytree to draw instead of the whole graph |
None
|
show_all
|
Optional[bool]
|
whether to show all factors even post filtering |
False
|
factor_annotations
|
Optional[Dict[str, str]]
|
factor annotations to include in the node labels |
None
|
top_factor
|
Optional[str]
|
only include factors below this factor |
None
|
show_signatures
|
Optional[bool]
|
whether to show the ranked gene signatures in the node labels |
True
|
drop_factors
|
Optional[List[str]]
|
list of factors to drop from the graph |
None
|
root_signature
|
Optional[List[str]]
|
root signature to display |
None
|
root_ranking
|
Optional[List[str]]
|
root ranking to display |
None
|
enrichments
|
Optional[DataFrame]
|
enrichment results dataframe to include in node labels |
None
|
show_enrichments
|
Optional[bool]
|
whether to show enrichment terms in node labels |
False
|
top_genes
|
Optional[Union[int, List[int]]]
|
number of genes from each signature to be shown in the node labels |
None
|
show_batch_counts
|
Optional[bool]
|
whether to show the number of cells from each batch that attach to each factor |
False
|
filled
|
Optional[Union[str, Dict[str, float]]]
|
key from model.adata.obs to use to fill the nodes with, or dictionary of factor scores |
None
|
wedged
|
Optional[str]
|
key from model.adata.obs to use to wedge the nodes with |
None
|
assignments
|
Optional[bool]
|
whether to use the assignments of cells to factors to wedge the nodes, rather than the scores |
True
|
color_edges
|
Optional[bool]
|
whether to color the graph edges according to the upper factors |
True
|
show_confidences
|
Optional[bool]
|
whether to show precomputed signature Jaccard confidence
(from |
False
|
n_cells_label
|
Optional[bool]
|
whether to show the number of cells that attach to the factor |
False
|
n_cells
|
Optional[bool]
|
whether to scale the node sizes by the number of cells that attach to the factor |
False
|
node_size_max
|
Optional[float]
|
maximum node size when scaled by cell numbers |
2.0
|
node_size_min
|
Optional[float]
|
minimum node size when scaled by cell numbers |
0.05
|
scale_level
|
Optional[bool]
|
whether to scale node sizes per level instead of across all levels |
False
|
show_label
|
Optional[bool]
|
whether to show labels on nodes |
True
|
gene_score
|
Optional[str]
|
color the nodes by the score they attribute to a gene. Overrides filled and wedged |
None
|
gene_cmap
|
Optional[str]
|
colormap to use for gene_score |
'viridis'
|
gene_score_scale
|
str
|
|
'factor'
|
path
|
Optional[Union[Sequence[str], Dict[str, Any]]]
|
ordered factor names along a path, or a dict with key |
None
|
path_color
|
str
|
stroke color for highlighted path nodes (border) and edges |
'red'
|
path_node_penwidth
|
float
|
Graphviz |
2.5
|
confident_assignments
|
bool
|
if True, attach cells using |
False
|
confident_key
|
str
|
|
'confident'
|
shell
|
Optional[bool]
|
whether to use shell layout. If the model has a final width-1 root layer, shell layout omits that root and plots the remaining hierarchy. |
False
|
r
|
Optional[float]
|
radius parameter for shell layout |
2.0
|
r_decay
|
Optional[float]
|
radius decay parameter for shell layout |
0.8
|
root_shape
|
Optional[str]
|
Graphviz node shape for root-layer factors (e.g. |
None
|
bottom_layer
|
int
|
lowest layer index to include (default |
0
|
**fontsize_kwargs
|
Any
|
keyword arguments to adjust the fontsizes according to the gene scores |
{}
|
Returns:
| Type | Description |
|---|---|
Graph
|
Graphviz Graph object |