ovo.app.utils.protein_qc_plots

Module Contents

Functions

load_histograms

Load precomputed PDB histograms for all tools. The histograms are computed for the data between 1st and 99th percentile.

load_plots_data

get_precomputed_histogram_alt

Create Altair histogram from precomputed data.

update_bins

Given bins for a histogram and a list of values, extend the bins if the values are outside the range of the bins.

get_histogram_alt

Create Altair histogram from values. If bins are provided, the bins are used and extended if the values are outside the range of the bins.

combine_histograms

Vertically stack or overlay two histograms sharing the x-axis.

descriptor_histograms

Create a combined histogram plot for a descriptor. The top histogram is the precomputed histogram and the bottom histogram is the pool histogram from the passed values.

format_threshold_value

Format the threshold values for display.

API

ovo.app.utils.protein_qc_plots.load_histograms() Dict[str, Dict[str, Dict[str, List[float]]]]

Load precomputed PDB histograms for all tools. The histograms are computed for the data between 1st and 99th percentile.

Returns: {‘descriptor’: {‘all’: {‘x’: [0, 1, 2, …], ‘y’: [0.1, 0.2, …]}, ‘non-human_only’: …, ‘human_only’: …, ‘human+non-human}, …}}}} x - bin edges y - bin heights

ovo.app.utils.protein_qc_plots.load_plots_data(file_path: str) dict
ovo.app.utils.protein_qc_plots.get_precomputed_histogram_alt(bins: numpy.ndarray, y: numpy.ndarray, color_by: str = 'density', thresholds: List[float] = None, reverse_colors: bool = False, width: int = None, height: int = None, title: str = None) altair.Chart

Create Altair histogram from precomputed data.

Args: bins: bin edges in the precomputed histograms y: bin heights in the precomputed histograms descriptor: descriptor name in the precomputed histograms color_by: ‘density’, ‘thresholds’ or use green otherwise thresholds: list of thresholds for color_by=’thresholds’ reverse_colors: reverse the color scale width: width of the chart title: title of the chart

ovo.app.utils.protein_qc_plots.update_bins(values: List[float], source_bins: List[float]) List[float]

Given bins for a histogram and a list of values, extend the bins if the values are outside the range of the bins.

ovo.app.utils.protein_qc_plots.get_histogram_alt(values: List[float], bins: List[float] = None, width: int = None, color: str = 'black', title: str = None) altair.Chart

Create Altair histogram from values. If bins are provided, the bins are used and extended if the values are outside the range of the bins.

ovo.app.utils.protein_qc_plots.combine_histograms(histogram1: altair.Chart, histogram2: altair.Chart, how: str, title=None) altair.Chart

Vertically stack or overlay two histograms sharing the x-axis.

ovo.app.utils.protein_qc_plots.descriptor_histograms(histograms: dict, descriptor_name: str, histogram_source: str, color_by: str, thresholds: List[float], reverse_colors: bool, values: List[float], precomputed_histogram_height: int = 250, pool_histogram_height: int = 100, overlay: bool = False)

Create a combined histogram plot for a descriptor. The top histogram is the precomputed histogram and the bottom histogram is the pool histogram from the passed values.

Parameters: histograms (dict): Precomputed histograms descriptor_name (str): Name of the descriptor histogram_source (str): Source of the histogram color_by (str): Color by ‘density’ or ‘thresholds’ thresholds (List[float]): Thresholds for color mapping reverse_colors (bool): Reverse the color mapping values (List[float]): Values for the pool/selected designs histogram precomputed_histogram_height (int): Height of the precomputed histogram pool_histogram_height (int): Height of the pool histogram

ovo.app.utils.protein_qc_plots.format_threshold_value(descriptor_name: str, value) str

Format the threshold values for display.

If the descriptor is a percentage (0-1), multiply by 100 and add a percentage sign. If the descriptor is ‘Sequence length’, round to the nearest integer. Otherwise, round to two decimal places.