API#

Workflows#

nichepca.workflows

nichepca.workflows.nichepca(adata[, knn, ...])

Run the general NichePCA workflow.

Clustering#

nichepca.clustering

nichepca.clustering.leiden_unique(adata[, ...])

Perform Leiden clustering with duplicate embeddings.

nichepca.clustering.leiden_multires(adata, ...)

Perform Leiden clustering at multiple resolutions in parallel.

nichepca.clustering.leiden_with_nclusters(...)

Perform Leiden clustering with a fixed number of clusters.

Graph Construction#

nichepca.graph_construction

nichepca.graph_construction.knn_graph(adata, knn)

Construct a k-nearest neighbors graph.

nichepca.graph_construction.delaunay_graph(adata)

Construct a delaunay graph.

nichepca.graph_construction.distance_graph(adata)

Construct a spatial graph based on a distance threshold.

nichepca.graph_construction.construct_multi_sample_graph(...)

Construct a multi-sample graph from AnnData.

nichepca.graph_construction.from_squidpy(adata)

Convert the graph stored in squidpy format to pyg format.

nichepca.graph_construction.to_squidpy(adata)

Convert the pyg graph stored in adata.uns to squidpy format.

nichepca.graph_construction.remove_long_links([...])

Remove links with a distance larger than a given percentile.

nichepca.graph_construction.calc_graph_stats([...])

Calculate basic graph statistics.

nichepca.graph_construction.print_graph_stats([...])

Print statistics about the graph.

nichepca.graph_construction.resolve_graph_constructor([...])

Resolves and returns the graph constructor based on the provided parameters.

Neighborhood Embedding#

nichepca.nhood_embedding

nichepca.nhood_embedding.aggregate(adata[, ...])

Aggregate data in an AnnData object based on a previously constructed graph.

Utilities#

nichepca.utils

nichepca.utils.check_for_raw_counts(adata)

Check whether adata contains raw counts.

nichepca.utils.normalize_per_sample(adata, ...)

Normalize the per-sample counts in the adata object based on the given sample_key.

nichepca.utils.to_numpy(X)

Convert input to numpy array.

nichepca.utils.to_torch(X)

Convert input to torch tensor.