scallops.visualize.heatmap.base_call_mismatches_heatmap

scallops.visualize.heatmap.base_call_mismatches_heatmap(base_call_mismatches_df)

Plot base call mismatches in a heatmap.

This function generates a heatmap to visualize base call mismatches in a tabular format. Base call mismatches typically occur in sequencing data, where the called bases might differ from the expected or true bases.

The heatmap is organized to display the counts of base call mismatches across different whitelist bases, read positions, and called bases. It provides insights into the patterns of mismatches and their distribution within the dataset.

Parameters:

base_call_mismatches_df (DataFrame) – Data frame containing base call mismatches. The DataFrame should have columns [‘whitelist_base’, ‘read_position’, ‘called_base’, ‘count’].

Returns:

A Seaborn ClusterGrid instance representing the base call mismatches heatmap.

Example:

Return type:

ClusterGrid

import pandas as pd
from scallops.visualize import base_call_mismatches_heatmap

# Create a sample DataFrame with base call mismatches
data = {
    "whitelist_base": ["A", "A", "A", "C", "C"],
    "read_position": [1, 2, 1, 3, 2],
    "called_base": ["T", "A", "G", "C", "A"],
    "count": [5, 8, 2, 3, 7],
}
base_call_mismatches_df = pd.DataFrame(data)

# Generate the base call mismatches heatmap
base_call_mismatches_heatmap(base_call_mismatches_df)