dandelion.polars.core.Dandelion.update_metadata

Dandelion.update_metadata(retrieve=None, clone_key=None, split=True, join=True, unique=False, first=False, average=False, key_added=None, strip_alleles=True, reinitialize=True, init_cols=None, productive_only=True, check_rearrangement_status=True, genotyped_v_call=True, update_isotype_dict=None, lazy=True, as_pandas=False)

A Dandelion initialisation function to update and populate the .metadata slot.

Parameters:
  • retrieve (list[str] | str | None, optional) – column name(s) in .data to retrieve and update the metadata.

  • clone_key (str | None, optional) – column name of clone id. None defaults to ‘clone_id’.

  • split (bool, optional) – whether to split the retrieved values into separate VDJ and VJ columns. Defaults to True.

  • join (bool, optional) – whether to join multiple values per cell with |. Defaults to True.

  • unique (bool, optional) – whether to keep only unique values when joining. Defaults to False.

  • first (bool, optional) – whether to return only the first value per cell rather than joining all values. Defaults to False.

  • average (bool, optional) – whether to average numeric columns instead of summing them. Defaults to False.

  • key_added (list[str] | str | None, optional) – custom output column name(s) for the retrieved values. If None, the original column name(s) from retrieve are used.

  • strip_alleles (bool, optional) – returns the V(D)J genes without allelic calls if True. Defaults to True.

  • reinitialize (bool, optional) – whether or not to reinitialize the current metadata. Useful when updating older versions of dandelion to newer version.

  • init_cols (list[str] | None, optional) – columns to initialize the metadata with. If None, uses the default set of columns.

  • productive_only (bool, optional) – whether or not to use only productive contigs to initialize metadata. Defaults to True.

  • check_rearrangement_status (bool, optional) – whether or not to check and update the rearrangement status. Defaults to True.

  • genotyped_v_call (bool, optional) – whether or not to use genotyped v_call data to initialize metadata if available. Defaults to True.

  • update_isotype_dict (dict[str, str] | None, optional) – custom isotype dictionary to update the default isotype dictionary.

  • lazy (bool, optional) – whether to keep the metadata as a Polars LazyFrame after updating. Defaults to True.

  • as_pandas (bool, optional) – whether to convert the Dandelion object back to the pandas backend after updating. Defaults to False.

Raises:
  • KeyError – if columns provided not found in Dandelion.data.

  • ValueError – if missing columns in Dandelion.data.

Return type:

None