cell2home.construct_signatures

cell2home.construct_signatures(adata, obs_to_bulk, interactions, source_col='source')

Construct a reference signature based on an AnnData object and a data frame specifying the interactions. Will pseudobulk the AnnData based on provided .obs keys, and extract the source gene expression for each pseudobulks, resulting in the interactions data frame having each of its rows copied as many times as there are pseudobulks to report the corresponding expression.

Input

adataAnnData

The object to use for pseudobulk construction, with raw counts in .X stored as a sparse matrix.

obs_to_bulklist of str

Column names in .obs to use to construct the pseudobulks. A pseudobulk will be constructed for each unique value combination of the columns.

interactionspd.DataFrame

Must have at least two columns - the source_col, specifying the gene in the reference to extract the expression for, and a target gene column for later use. All contents will be retained in the output.

source_colstr, optional (default: "source")

The column in interactions to use to extract the relevant source gene expression from the reference. Interactions where the gene is absent from the object will be omitted.