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
.obskeys, 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
- adata
AnnData The object to use for pseudobulk construction, with raw counts in
.Xstored as a sparse matrix.- obs_to_bulklist of
str Column names in
.obsto use to construct the pseudobulks. A pseudobulk will be constructed for each unique value combination of the columns.- interactions
pd.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_col
str, optional (default:"source") The column in
interactionsto use to extract the relevant source gene expression from the reference. Interactions where the gene is absent from the object will be omitted.
- adata