scallops.visualize.heatmap.in_situ_identity_matrix_plot

scallops.visualize.heatmap.in_situ_identity_matrix_plot(cells_df, xlabel='Total reads', ylabel='Top barcode reads', **kwargs)

Generate an identity matrix depicting cellular read distribution categorized by read identity.

This function creates an identity matrix heatmap to illustrate the distribution of cellular reads categorized by read identity. The matrix provides insights into the relationship between different read identity categories, particularly focusing on the total reads and top barcode reads.

Parameters:
  • cells_df (DataFrame) – All cell tables from the output cells folder.

  • xlabel – Set the label for the x-axis of the heatmap.

  • ylabel – Set the label for the y-axis of the heatmap.

  • kwargs – Additional keyword arguments are passed through to matplotlib.pyplot.subplots().

Returns:

Returns the Axes object with the plot drawn onto it.

Example:

Return type:

Axes

import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from scallops.visualize import in_situ_identity_matrix_plot

np.random.seed(42)
data = {
    "barcode_match": np.random.choice([True, False], size=50),
    "barcode_0": [f"BC{i}" for i in range(1, 51)],
    "barcode_count_0": np.random.randint(1, 7, size=50),
}
data["barcode_count"] = [
    np.random.randint(count, 7) for count in data["barcode_count_0"]
]
cells_df = pd.DataFrame(data)

# Generate the in-situ identity matrix heatmap
in_situ_identity_matrix_plot(
    cells_df, xlabel="Total Reads", ylabel="Top Barcode Reads"
)

# Show the plot
plt.show()