nichecompass.data.load_spatial_adata_from_csv

nichecompass.data.load_spatial_adata_from_csv(counts_file_path, adj_file_path, cell_type_file_path=None, adj_key='spatial_connectivities', cell_type_col='cell_type', cell_type_key='cell_type')

Create AnnData object from two csv files containing gene expression feature matrix and adjacency matrix respectively. Optionally, a third csv file with cell types can be provided.

Parameters:
  • counts_file_path (str) – File path of the csv file which contains gene expression feature matrix data.

  • adj_file_path (str) – File path of the csv file which contains adjacency matrix data.

  • cell_type_file_path (Optional[str] (default: None)) – File path of the csv file which contains cell type data.

  • adj_key (str (default: 'spatial_connectivities')) – Key under which the sparse adjacency matrix will be stored in ´adata.obsp´.

  • cell_type_col (str (default: 'cell_type')) – Column under wich the cell type is stored in the ´cell_type_file´.

  • cell_type_key (str (default: 'cell_type')) – Key under which the cell types will be stored in ´adata.obs´.

Return type:

AnnData

Returns:

adata: AnnData object with gene expression data stored in ´adata.X´ and sparse adjacency matrix (coo format) stored in ´adata.obps[adj_key]´.