pseudobulk

besca.export.pseudobulk(adata: AnnData, outpath: Optional[str] = None, column: str = 'celltype0', label: str = 'celltype0', split_condition: str = 'donor', todrop: list = ['CELL', 'input.path', 'percent_mito', 'n_counts', 'n_genes', 'leiden', 'celltype0', 'celltype1', 'celltype2', 'celltype3', 'dblabel'], main_condition: str = 'CONDITION')[source]

export pseudobulk profiles of cells to .gct files

This is a function with which any type of labeling (i.e. celltype annotation, louvain clustering, etc.) can be written out to several .gct files as well as a single metadata file.

To ensure FAIR compatbility label, and file name should not be changed.

Parameters:
  • adata (AnnData) – the AnnData object containing the labeling

  • directory (outpath str | default = current working) – filepath to the directory in which the results should be outputed, if no directory is specified it outputs the results to the current working directory.

  • column (str | default = ‘celltype0’) – Name of the column in adata.obs that is to be mapped to cell barcodes and written out to file.

  • label (str | default = ‘celltype0’) – label above the column when it is written out to several files

  • split_condition (str | default = ‘experiment’) – the experimental unit, e.g. sample ID

  • todrop (list) – Several column headers to be excluded from metadata

  • main_condition (str | default = ‘CONDITION’) – main condition to be outputed in the metadata file

Returns:

dfmerge – merged dataframe

Return type:

pd.DataFrame