scirpy.pl.logoplot_cdr3_motif

scirpy.pl.logoplot_cdr3_motif#

scirpy.pl.logoplot_cdr3_motif(adata, *, chains='VDJ_1', airr_mod='airr', airr_key='airr', chain_idx_key='chain_indices', cdr3_col='junction_aa', to_type='information', pseudocount=0, background=None, center_weights=False, font_name='sans', color_scheme='chemistry', vpad=0.05, width=0.9, ax=None, fig_kws=None, **kwargs)#

Generates logoplots of CDR3 sequences

This is a user friendly wrapper function around the logomaker python package. Enables the analysis of potential amino acid motifs by displaying logo plots. Subsetting of AnnData/MuData has to be performed manually beforehand (or while calling) and only cells with equal cdr3 sequence lengths are permitted.

Parameters:
  • adata (Union[AnnData, MuData, DataHandler]) – AnnData or MuData object that contains AIRR information.

  • chains (Union[Literal['VJ_1', 'VJ_2', 'VDJ_1', 'VDJ_2'], Sequence[Literal['VJ_1', 'VJ_2', 'VDJ_1', 'VDJ_2']]] (default: 'VDJ_1')) – One or up to two chains from which to use CDR3 sequences i.e. primary and/or secondary VJ/VDJ chains. Mixing VJ and VDJ chains will likely not lead to a meaningful result.

  • airr_mod (str (default: 'airr')) – Name of the modality with AIRR information is stored in the MuData object. if an AnnData 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.

  • chain_idx_key (str (default: 'chain_indices')) – Key under which the chain indices are stored in adata.obsm. If chain indices are not present, index_chains() is run with default parameters.

  • cdr3_col (str (default: 'junction_aa')) – Key inside awkward array to retrieve junction information (should be in aa)

  • to_type (Literal['information', 'counts', 'probability', 'weight'] (default: 'information')) – Choose one of matrix types as defined by logomaker: * "information" * "counts" * "probability" * "weight"

  • pseudocount (float (default: 0)) – Pseudocount to use when converting from counts to probabilities

  • background (Union[ndarray, DataFrame, None] (default: None)) – Background probabilities. Both arrays with the same length as ouput or df with same shape as ouput are permitted.

  • center_weights (bool (default: False)) – Whether to subtract the mean of each row, but only if to_type == weight

  • font_name (str (default: 'sans')) – customize the font face. You can list all available fonts with logomaker.list_font_names().

  • color_scheme (str (default: 'chemistry')) – customize the color scheme. You can list all available color schemes with logomaker.list_color_schemes().

  • vpad (float (default: 0.05)) – The whitespace to leave above and below each character within that character’s bounding box.

  • width (float (default: 0.9)) – x coordinate span of each character

  • ax (Optional[Axes] (default: None)) – Add the plot to a predefined Axes object.

  • fig_kws (Optional[dict] (default: None)) – Parameters passed to the matplotlib.pyplot.figure() call if no ax is specified.

  • **kwargs – Additional arguments passed to logomaker.Logo() for comprehensive customization. For a full list of parameters please refer to logomaker documentation

Return type:

Logo

Returns:

Returns a object of class logomaker.Logo (see here for more information https://logomaker.readthedocs.io/en/latest/implementation.html#matrix-functions)