scirpy.pp.merge_with_ir(adata, adata_ir, on=None, **kwargs)

Merge adaptive immune receptor (IR) data with transcriptomics data into a single AnnData object.

Reading in IR data results in an AnnData object with IR information stored in obs. Use this function to merge it with another AnnData containing transcriptomics data. To add additional IR data on top of on top of an AnnData object that already contains IR information (e.g. BCR on top of TCR data.), see merge_airr_chains().

Merging keeps all objects (e.g. neighbors, umap) from adata and integrates obs from adata_ir into adata. Everything other than .obs from adata_ir will be discarded.

This function is a thin wrapper around pandas.merge(). The function performs a “left join”, i.e. all cells not present in adata will be discarded.

Modifies adata inplace.

adata : AnnData

AnnData with the transcriptomics data. Will be modified inplace.

adata_ir : AnnData

AnnData with the adaptive immune receptor (IR) data

on : List[str] | NoneOptional[List[str]] (default: None)

Merge on columns in addition to ‘index’. Defaults to “batch” if present in both obs data frames.


Passed to pandas.merge().

Return type