scirpy.pp.merge_airr
- scirpy.pp.merge_airr(adata, adata2, *, airr_mod='airr', airr_mod2='airr', airr_key='airr', airr_key2='airr', drop_duplicate_chains=True, **kwargs)
Merge two AnnData objects with IR information (e.g. BCR with TCR).
Decomposes the IR information back into
scirpy.io.AirrCellobjects and merges them on a chain-level. If both objects contain the same cell-id, and the same chains, the corresponding row inadata.obsm["airr"]will be unchanged (ifdrop_duplicate_chainsisTrue). 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 asambiguoususing thescirpy.tl.chain_qc()function.The function performs a “outer join”, i.e. all cells from both objects will be retained. All information except
.obsm[airr_key]and.obswill be lost.Note
There is no need to use this function for the following use-cases:
If you want to merge AIRR data with transcriptomics data, use
MuDatainstead, as shown in Working with multimodal data.If you want to concatenante mutliple
AnnDataobjects, useanndata.concat()instead, as shown in Combining multiple samples.
- Parameters
- adata :
AnnData|MuData|DataHandlerUnion[AnnData,MuData,DataHandler] first AnnData object containing IR information
- adata2 :
AnnData|MuData|DataHandlerUnion[AnnData,MuData,DataHandler] second AnnData object containing IR information
- airr_mod
Name of the modality with AIRR information is stored in the
MuDataobject. if anAnnDataobject is passed to the function, this parameter is ignored.- airr_mod2
Like
airr_mod, but for adata2- airr_key
Key under which the AIRR information is stored in adata.obsm as an awkward array.
- airr_key2
Like
airr_key, but for adata2- drop_duplicate_chains
If True, if there are identical chains associated with the same cell only one of them is kept.
- **kwargs
passed to
from_airr_cells()
- adata :
- Return type
- Returns
new AnnData object with merged AIRR data.