scirpy.pp.merge_airr_chains(adata, adata2)

Merge two AnnData objects with IR information (e.g. BCR with TCR).

Decomposes the IR information back into objects and merges them on a chain-level. If both objects contain the same cell-id, and the same chains, the corresponding row in adata.obs will be unchanged. If both objects contain the same cell-id, but different chains, the chains will be merged into a single cell such that it can be annotated as ambiguous or multi-chain if appropriate. If a cell contains both TCR and BCR chains, they will both be kept and can be identified as ambiguous using the function.

The function performs a “left join”, i.e. all cells not present in adata will be discarded. Of adata2 the function only retains information from obs.

To simply add IR information onto an existing AnnData object with transcriptomics data, see merge_with_ir() (this function can do this, too, but merge_with_ir is more efficient).

Modifies adata inplace.

adata : AnnData

first AnnData object containing IR information

adata2 : AnnData

second AnnData object containing IR information

Return type