dandelion.base.tools.concat

dandelion.base.tools.concat(arrays, check_unique=True, collapse_cells=True, sep='_', suffixes=None, prefixes=None, remove_trailing_hyphen_number=False, verbose=True)[source]

Concatenate data frames and return as Dandelion object.

If both suffixes and prefixes are None and check_unique is True, then a sequential number suffix will be appended.

Parameters:
  • arrays (list[pd.DataFrame | Dandelion] | dict[pd.DataFrame | Dandelion]) – List or dictionary of Dandelion objects or pandas DataFrames to concatenate.

  • check_unique (bool, optional) – Check the new index for duplicates. Otherwise defer the check until necessary. Setting to False will improve the performance of this method.

  • collapse_cells (bool, optional) – whether or not to collapse multiple contigs per cell into one row in the metadata. By default True.

  • sep (str, optional) – the separator to append suffix/prefix.

  • suffixes (list[str] | None, optional) – List of suffixes to append to sequence_id and cell_id.

  • prefixes (list[str] | None, optional) – List of prefixes to append to sequence_id and cell_id.

  • remove_trailing_hyphen_number (bool, optional) – whether or not to remove the trailing hyphen number e.g. ‘-1’ from the cell/contig barcodes.

  • verbose (bool, optional) – Whether to print the messages, by default True.

Returns:

concatenated Dandelion object

Return type:

Dandelion

Raises:

ValueError – if both prefixes and suffixes are provided.