metalsinglecell.pp.neighbors#

metalsinglecell.pp.neighbors(adata, n_neighbors=15, n_pcs=None, *, use_rep=None, random_state=0, copy=False)[source]#

kNN graph (sc.pp.neighbors); writes obsp['distances']/['connectivities'], uns['neighbors'].

Signature mirrors scanpy: n_pcs is positional after n_neighbors and use_rep is keyword-only, so sc.pp.neighbors(adata, 15, 40) truncates the representation to 40 PCs (previously that 40 bound use_rep and silently ran on raw .X). use_rep=None resolves to X_pca when present, else .X.

Parameters:
  • n_neighbors (int)

  • n_pcs (int | None)

  • use_rep (str | None)

  • random_state (int)

  • copy (bool)