nGraph
nGraph ¶
nGraph(
data,
layer="raw",
standardScale=False,
runPCA=False,
kNeighbors=15,
nPcs=20,
sdataTable=None,
)
Build a k-nearest-neighbour graph from the expression matrix.
Returns a bare igraph.Graph rather than modifying the object, so it is a
building block: sp.tl.cluster with method='leiden'
builds its own graph internally, and this is here for when you want to run
igraph's own algorithms — betweenness, communities, shortest paths — over the
same structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(AnnData | SpatialData | str, required)
|
The cell table. An |
required |
layer
|
str
|
Which matrix to build the graph from. |
'raw'
|
standardScale
|
bool
|
Z-score each marker before computing neighbours, so markers with large dynamic range do not dominate the distances. |
False
|
runPCA
|
bool
|
Reduce to |
False
|
kNeighbors
|
int
|
Neighbours per cell. |
15
|
nPcs
|
int
|
Components to keep when |
20
|
sdataTable
|
str
|
Which |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
graph |
Graph
|
An undirected graph with one vertex per cell, in |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |