Cnv.run_pca#

Cnv.run_pca(attribute: Union[str, numpy.ndarray], components: int, output_label: str = 'pca', show_plot: bool = False, **kwargs: Any) None#

Principal component analysis

Adds output_label to the row attributes.

Parameters
attributeUnion[str, np.ndarray]

The attribute to be used for PCA. Uses _Assay.get_attribute() to retrieve the values constrained by row.

componentsint

The number of PCA components to reduce to.

output_labelstr, default PCA_LABEL

The name of the row attribute to store the data in.

show_plotbool

Show the plot for the explained variance by the PCAs.

kwargsdict

Passed to the PCA.

Raises
ValueError

When both layer and attribute are provided. Only one is permitted at a time.