campa.tl.FeatureExtractor

class FeatureExtractor(exp, data_dir, cluster_name, cluster_dir=None, cluster_col=None, adata=None)[source]

Extract features from clustering.

Parameters
  • exp (Experiment) – Experiment to extract features from.

  • data_dir (str) – Name of data to cluster. Relative to {exp.full_path}/aggregated/full_data.

  • cluster_name (str) – Name of clustering to use.

  • cluster_dir (Optional[str]) – Dir of subsampled clustering to load annotation. Relative to exp.full_path`. Default is taking first of {exp.full_path}/aggregated/sub-*.

  • cluster_col (Optional[str]) – Cluster annotation to use. Defaults to cluster_name.

  • adata (Optional[AnnData]) – If existing, the features adata object containing extracted features.

Attributes

mpp_data

MPPData object containing pixel-wise clustered data from data_dir.

Methods

extract_co_occurrence(interval[, algorithm, ...])

Extract co-occurrence for each cell individually.

extract_co_occurrence_csv([obs, clusters])

Extract csv files of co_occurrence scores for every cluster-cluster pair.

extract_intensity_csv([obs])

Extract csv file containing obj_id, mean cluster intensity and size for each channel.

extract_intensity_size([force, fname])

Calculate per cluster mean intensity and size for each object.

extract_object_stats([features, ...])

Extract features from connected components per cluster for each cell.

extract_object_stats_csv([obs, features, ...])

Extract csv files of object stats.

from_adata(fname)

Initialise from existing features ad.AnnData object.

get_intensity_adata()

Adata object with intensity per cluster combined in X.

get_object_stats([area_threshold, agg, save])

Aggregate object stats per obj_id.