rapids_singlecell.tl.draw_graph#
- rapids_singlecell.tl.draw_graph(adata, *, init_pos=None, max_iter=500, rng=None, use=None, out=False, key_added=None)[source]#
Force-directed graph drawing [FR91, JVHB14].
Uses cugraph’s implementation of Force Atlas 2. This is a reimplementation of scanpys function for GPU compute.
- Parameters:
- adata
AnnData annData object with ‘neighbors’ field.
- init_pos
str|bool|None(default:None) 'paga'/True,None/False, or any valid 2d-.obsmkey. Use precomputed coordinates for initialization. IfFalse/None(the default), initialize randomly.- max_iter
int(default:500) This controls the maximum number of levels/iterations of the Force Atlas algorithm. When specified the algorithm will terminate after no more than the specified number of iterations. No error occurs when the algorithm terminates in this manner. Good short-term quality can be achieved with 50-100 iterations. Above 1000 iterations is discouraged.
- rng
int|integer|Sequence[int] |SeedSequence|Generator|BitGenerator|None(default:None) Random seed or
Generatorused when initializing layout and generating samples. Defaults to 0. IfNoneis passed, a hash of process id, time, and hostname is used bycugraph. The supersededrandom_stateargument is still accepted.- use
GraphAcc|str|None(default:None) The neighborhood graph (connectivities) to lay out, e.g.
A.obsp['k']. Strings are resolved byanndata.acc.AdAcc.resolve(), e.g.'obsp.k'. IfNone, the oneneighbors()wrote by default.- out
MultiAcc|str|bool(default:False) Where to write the coordinates, e.g.
A.obsm['fa']; the parameters go to.unsunder the same key. IfTrue, the coordinates are returned instead. IfFalse, they are written to.obsm['X_draw_graph_fa']and.uns['draw_graph'].
- adata
- Return type:
- Returns:
The coordinates if
out=True, else updatesadatawith the following fields (seeoutfor other keys).- X_draw_graph_layout_fa
adata.obsm Coordinates of graph layout.
- X_draw_graph_layout_fa