netmap.utils.data_utils.merge_all_to_obs¶
- netmap.utils.data_utils.merge_all_to_obs(target_adata, source_adata, replace=True)[source]¶
Copies all variables from source_adata into target_adata.obs for convenient Scanpy plotting.
All columns in
source_adata.var_namesare appended as new columns totarget_adata.obs. When columns named'regulon'are already present intarget_adata.obsandreplace=True, those existing regulon columns are dropped before the new values are concatenated.- Parameters:
target_adata – AnnData object whose
obsDataFrame will be extended. Must have the same number of cells assource_adata.source_adata – AnnData object whose
Xmatrix (cells x variables) is used as the source of newobscolumns.replace – If
True(default), any existing columns whose name contains'regulon'intarget_adata.obsare removed before adding the new columns. IfFalse, the merge is skipped when overlapping column names are detected and a message is printed.
- Returns:
The input
target_adatawith updatedobscolumns.- Return type:
target_adata
- Raises:
ValueError – If the cell counts of
target_adataandsource_adatado not match.