scirpy.pp.index_chains
- scirpy.pp.index_chains(adata, *, productive=True, require_junction_aa=True, sort_chains_by=mappingproxy({'duplicate_count': 0, 'consensus_count': 0, 'junction': '', 'junction_aa': ''}), airr_mod='airr', airr_key='airr', key_added='chain_indices')
Selects primary/secondary VJ/VDJ cells per chain according to the Immune receptor (IR) model.
This function iterates through all chains stored in the awkward array in
adata.obsm[airr_key]
andlabels chains as primary/secondary VJ/VDJ chains
labels cells as multichain cells
based on the expression level of the chains and if they are labelled as “productive” or not.
For more details, please refer to the Immune receptor (IR) model and the data structure.
- Parameters
- adata :
AnnData
|MuData
|DataHandler
Union
[AnnData
,MuData
,DataHandler
] AnnData or MuData object that contains AIRR information.
- productive :
bool
(default:True
) If True, ignore non-productive chains. In that case, non-productive chains will also not count towards calling “multichain” cells.
- require_junction_aa :
bool
(default:True
) If True, ignore chains that don’t have a junction_aa (CDR3) amino acid sequence. In that case, these chains will also not count towards calling “multichain” cells
- sort_chains_by :
Mapping
Mapping
[str
,Any
] (default:mappingproxy({'duplicate_count': 0, 'consensus_count': 0, 'junction': '', 'junction_aa': ''})
) A list of sort keys used to determine an ordering of chains. The chain with the highest value of this tuple willl be the primary chain, second-highest the secondary chain. If there are more chains, they will not be indexed, and the cell receives the “multichain” flag.
- airr_mod :
str
(default:'airr'
) Name of the modality with AIRR information is stored in the
MuData
object. if anAnnData
object is passed to the function, this parameter is ignored.- airr_key :
str
(default:'airr'
) Key under which the AIRR information is stored in adata.obsm as an awkward array.
- key_added :
str
(default:'chain_indices'
) Key under which the chain indicies will be stored in
adata.obsm
and metadata will be stored inadata.uns
.
- adata :
- Return type
- Returns
Nothing, but adds a dataframe to
adata.obsm[chain_indices]