Scirpy stores AIRR rearrangement data as an awkward array in adata.obsm["airr"]. This allows for a lossless representation of the AIRR standard where one cell can have multiple receptor chains of variable length.
Structure of adata.obsm["airr"]:
- 1st dimension: Cells (aligned to
adata.obs). - 2nd dimension: Number of chains per cell (variable length).
- 3rd dimension: Fields defined in the AIRR rearrangement standard (e.g.,
locus, junction_aa).
Example structure:
[
# cell0: 2 chains
[
{"locus": "TRA", "junction_aa": "CADASGT..."},
{"locus": "TRB", "junction_aa": "CTFDD..."},
],
# cell1: 1 chain
[{"locus": "IGH", "junction_aa": "CDGFFA..."}],
# cell2: 0 chains
[],
]
# adata.obsm["airr"]
[
# cell0: 2 chains
[
{"locus": "TRA", "junction_aa": "CADASGT..."},
{"locus": "TRB", "junction_aa": "CTFDD..."},
],
# cell1: 1 chain
[{"locus": "IGH", "junction_aa": "CDGFFA..."}],
# cell2: 0 chains
[],
]