mmcci.CCIData

class mmcci.CCIData(cci_scores: Dict | None = None, p_values: Dict | None = None, n_spots: int | None = None, platform: str | None = None, network: DataFrame | None = None, network_p_values: DataFrame | None = None, adata: AnnData | None = None, other_metadata: Dict | None = None, assays: Dict | None = None)[source]

Class to store and manage Cell-Cell Interaction (CCI) data

metadata

Metadata for sample

Type:

Dict

n_spots

Number of spots in the sample

Type:

int

cci_scores

CCI score dataframe for each LR pair

Type:

Dict

p_values

P-values dataframe for each LR pair

Type:

Dict

adata

AnnData object

Type:

AnnData

networks

Calculated CCI networks

Type:

Dict

other_metadata

Other metadata

Type:

Dict

assays

Assays for the sample

Type:

Dict

__init__(cci_scores: Dict | None = None, p_values: Dict | None = None, n_spots: int | None = None, platform: str | None = None, network: DataFrame | None = None, network_p_values: DataFrame | None = None, adata: AnnData | None = None, other_metadata: Dict | None = None, assays: Dict | None = None)[source]

Methods

__init__([cci_scores, p_values, n_spots, ...])

calc_overall([assay, name, normalize])

Calculates the overall CCI scores in a CCIData object.

copy()

Create a copy of the CCIData object

create_pathway_assay([assay, gsea_results, ...])

Creates a pathway assay from GSEA results.

filter_by_p_vals([cutoff, assay, new_assay])

Filters the CCI scores in a CCIData object by p-value.

get_adata()

Get AnnData object

get_cell_types([assay])

Get cell types in a sample

get_lr_proportions([sender, reciever, ...])

Calculates the proportion of each LR pair in a sample for a specific cell type sender and receiver.

get_p_vals([assay, key, sender, reciever])

Returns the p-values for each LR pair in a sample for a specific sender and receiver cell type.

get_sample_cci_scores(sample_id)

Get CCI scores for a sample

get_sample_metadata(sample_id)

Get metadata for a sample

get_sample_n_spots(sample_id)

Get number of spots for a sample

get_sample_p_values(sample_id)

Get p-values for a sample

merge_cell_types(cell_types, new_cell_type)

Merges cell types in a CCIData.

rename_cell_types(replacements[, assay])

Renames cell types in a CCIData.

save(path)

Saves CCIData object to JSON or pkl file.

scale(scale_factor[, assay, new_assay])

Scales the CCI scores in a CCIData object.

scale_by_nspots([assay, new_assay])

Scales the CCI scores in a CCIData object by the number of spots.

subset_lrs(lr_pairs[, assay, new_assay])

Subsets the LR pairs in a CCIData object.

to_dict()

Convert CCIData object to a JSON-serializable dictionary.