class _Assay(*args, **kwargs)#

Abstract class for all assays

Each of Dna, Cnv, and Protein are inherited from this base class, hence all of them have the following functionality:

_Assay objects can be filtered using Python’s slice notation. It requires two keys (barcodes, ids). Both could be a list of positions, a Boolean list, or a list of the respective values.

Load the sample.

>>> import missionbio.mosaic.io as mio
>>> sample = mio.load('/path/to/h5')

Select the first 250 cells (these aren’t necessarily the cells with the highest reads, they’re arbitrary cells) and the dna variants obtained from filtering.

>>> select_bars = sample.dna.barcodes()[: 250]
>>> select_vars = sample.dna.filter_variants()

Slice the dna assay for the selected cells and variants.

>>> filtered_dna = sample.dna[select_bars, select_vars]

Note: This example is for DNA, but the same can be done for any _Assay object.



The ids selected on the heatmap


The barcodes selected on the scatterplot

Modifying data#

add_layer(name, array)

Add layer to the assay

add_row_attr(name, value)

Add row attribute to the assay

add_col_attr(name, value)

Add column attribute to the assay

add_metadata(name, value)

Add metadata to the assay


Delete a layer from the assay layers.


Delete an attribute from the row_attrs.


Delete an attribute from the col_attrs.


Delete an attribute from the metadata.

Selecting data#


Get the list of barcodes.

clustered_barcodes([orderby, splitby, ...])

Hierarchical clustering of barcodes.


Get the list of ids.

clustered_ids(orderby[, features, override])

Hierarchical clustering of ids.


Rename the ids based on columns


Resets ids if they were modified using set_ids_from_cols()

drop(values[, value_type])

Drops the given values from the assay.


Get the label color palette.


Set the label color palette.


Get the labels corresponding to the barcodes.

set_labels(clusters[, default_label])

Set the labels for the barcodes.


Custom clustering from scatter plots.


Change the name of the labels.

get_attribute(attribute[, constraint, features])

Retrieve any attribute in the assay

hierarchical_cluster(dat[, index])

Get the hierarchical clustering order of the index of the dataframe.

Transforming data#

convolve(data, labels, convolve)

Convolve the data in-place based on the given labels.

scale_data(layer[, output_label])

Z-score normalization

run_pca(attribute, components[, ...])

Principal component analysis

run_umap(attribute[, output_label])

Perform UMAP on the given data.

run_lda(layer, attribute, output_label[, cycles])

Perform LDA on a row attribute using a layer to type clusters.

cluster(attribute[, method])

Identify clusters of cells.


Relabel clusters based on expression.


scatterplot(attribute[, colorby, features, ...])

Scatter plot for all barcodes.

heatmap(attribute[, splitby, features, ...])

Heatmap of all barcodes and ids.

signaturemap(attribute[, kind, nan_value, ...])

Flattened heatmap showing the signature profile for each unique label

crosstabmap(columns[, index, normalize, ...])

Crosstab heatmap for all barcodes.

violinplot(attribute[, splitby, features, title])

Violin plot for all barcodes.

ridgeplot(attribute[, splitby, features, title])

Ridge plot for all barcodes.

stripplot(attribute[, colorby, features, title])

Strip plot for all barcodes.


Rank-ordered barcodes vs total reads.

feature_scatter(layer, ids, **kwargs)

Plot for given data across 2 ids.


signature(attribute[, kind, splitby, ...])

The chosen signature for each cluster and feature.

test_signature(attribute[, kind])

Run a statistical test on the clusters

crosstab(columns[, index, normalize])

Compute a simple cross-tabulation of two attributes.


To be passed to missionbio.h5.data.Assay class.


To be passed to missionbio.h5.data.Assay class.