dandelion.polars.tools.setup_vdj_pseudobulk

dandelion.polars.tools.setup_vdj_pseudobulk(adata, vdj, mode='abT', subsetby=None, groups=None, allowed_chain_status=['Single pair', 'Extra pair', 'Extra pair-exception', 'Orphan VDJ', 'Orphan VDJ-exception'], productive_vdj=True, productive_vj=True, extract_cols=None, productive_cols=None, check_vdj_mapping=['v_call', 'j_call'], check_vj_mapping=['v_call', 'j_call'], check_extract_cols_mapping=None, filter_pattern=',|None|No_contig', remove_missing=True)[source]

Function to prepare AnnData for computing pseudobulk vdj feature space.

Parameters:
  • adata (AnnData) – cell adata before constructing anndata.

  • vdj (DandelionPolars) – Dandelion object containing VDJ data

  • mode (Literal[“B”, “abT”, “gdT”] | None, optional) – Optional mode for extractin the V(D)J genes. If set as None, it requires the option extract_cols to be specified with a list of column names where this will be used to retrieve the main call.

  • subsetby (str | None, optional) – If provided, only the groups/categories in this column will be used for computing the VDJ feature space.

  • groups (list[str] | None, optional) – If provided, only the following groups/categories will be used for computing the VDJ feature space.

  • allowed_chain_status (list[str] | None, optional) – If provided, only the ones in this list are kept from the chain_status column.

  • productive_vdj (bool, optional) – If True, cells will only be kept if the main VDJ chain is productive.

  • productive_vj (bool, optional) – If True, cells will only be kept if the main VJ chain is productive.

  • extract_cols (list[str] | None, optional) – Column names where VDJ/VJ information is stored so that this will be used instead of the standard columns.

  • productive_cols (list[str] | None, optional) – Column names where contig productive status is stored so that this will be used instead of the standard columns.

  • check_vdj_mapping (list[Literal[“v_call”, “d_call”, “j_call”]] | None, optional) – Only columns in the argument will be checked for unclear mapping (containing comma) in VDJ calls. Specifying None will skip this step.

  • check_vj_mapping (list[Literal[“v_call”, “j_call”]] | None, optional) – Only columns in the argument will be checked for unclear mapping (containing comma) in VJ calls. Specifying None will skip this step.

  • check_extract_cols_mapping (list[str] | None, optional) – Only columns in the argument will be checked for unclear mapping (containing comma) in columns specified in extract_cols. Specifying None will skip this step.

  • filter_pattern (str | None, optional) – pattern to filter from object. If None, does not filter.

  • remove_missing (bool, optional) – If True, will remove cells with contigs matching the filter from the object. If False, will mask them with a uniform value dependent on the column name.

Returns:

filtered cell adata object.

Return type:

AnnData