nichepca.graph_construction.construct_multi_sample_graph#
- nichepca.graph_construction.construct_multi_sample_graph(adata, sample_key, knn=None, radius=None, delaunay=False, return_graph=False, keep_local_edge_index=False, verbose=True, **kwargs)#
Construct a multi-sample graph from AnnData.
- Parameters:
adata (
AnnData) – Annotated data object.sample_key (
str) – Key inadata.obswhere sample information is stored.knn (
int|None(default:None)) – Number of nearest neighbors. Defaults to None.radius (
float|None(default:None)) – Radius for the distance graph constructor. Defaults to None.delaunay (
bool(default:False)) – Whether to use the delaunay graph constructor. Defaults to False.return_graph (
bool(default:False)) – Whether to return the graph instead of storing it inadata. Defaults to False.keep_local_edge_index (
bool(default:False)) – Whether to keep the local edge index. Defaults to False.verbose (
bool(default:True)) – Whether to print graph statistics. Defaults to True.**kwargs – Additional keyword arguments passed to the graph constructor.
- Returns:
edge_index, edge_weight : torch.Tensor, torch.Tensor Edge index and edge weight of the constructed graph if
return_graphis True.