Correlation analysis across preprocessing tools#

Requires

Generated by alevin_coll_decoy_gtr_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_coll_decoy_gtr_velovi.npy

Generated by alevin_coll_decoy_gtr_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_coll_decoy_gtr_em.pickle

  • DATA_DIR/spermatogenesis/velocities/alevin_coll_decoy_gtr_steady_state.pickle

Generated by alevin_coll_gtr_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_coll_gtr_velovi.npy

Generated by alevin_coll_gtr_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_coll_gtr_em.pickle

  • DATA_DIR/spermatogenesis/velocities/alevin_coll_gtr_steady_state.pickle

Generated by alevin_sep_decoy_gtr_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_sep_decoy_gtr_velovi.npy

Generated by scvelo_alevin_sep_decoy_gtr.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_sep_decoy_gtr_em.pickle

  • DATA_DIR/spermatogenesis/velocities/alevin_sep_decoy_gtr_steady_state.pickle

Generated by alevin_sep_gtr_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_sep_gtr_velovi.npy

Generated by alevin_sep_gtr_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_sep_gtr_em.pickle

  • DATA_DIR/spermatogenesis/velocities/alevin_sep_gtr_steady_state.pickle

Generated by alevin_spliced_unspliced_gtr_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_spliced_unspliced_velovi.npy

Generated by alevin_spliced_unspliced_gtr_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/alevin_spliced_unspliced_em.pickle

  • DATA_DIR/spermatogenesis/velocities/alevin_spliced_unspliced_steady_state.pickle

Generated by kallisto_dropest_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/dropest_velovi.npy

Generated by kallisto_dropest_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/dropest_em.pickle

  • DATA_DIR/spermatogenesis/velocities/dropest_steady_state.pickle

Generated by isocollapse_exclude_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/kallisto_isocollapse_exclude_velovi.npy

Generated by isocollapse_exclude_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/kallisto_isocollapse_exclude_em.pickle

  • DATA_DIR/spermatogenesis/velocities/kallisto_isocollapse_exclude_steady_state.pickle

Generated by kallisto_isocollapse_include_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/kallisto_isocollapse_include_velovi.npy

Generated by kallisto_isocollapse_include_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/kallisto_isocollapse_include_em.pickle

  • DATA_DIR/spermatogenesis/velocities/kallisto_isocollapse_include_steady_state.pickle

Generated by kallisto_isoseparate_exclude_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/kallisto_isoseparate_exclude_velovi.npy

Generated by kallisto_isoseparate_exclude_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/kallisto_isoseparate_exclude_em.pickle

  • DATA_DIR/spermatogenesis/velocities/kallisto_isoseparate_exclude_steady_state.pickle

Generated by starsolo_subtr_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/starsolo_subtr_velovi.npy

Generated by starsolo_subtr_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/starsolo_subtr_em.pickle

  • DATA_DIR/spermatogenesis/velocities/starsolo_subtr_steady_state.pickle

Generated by starsolo_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/starsolo_velovi.npy

Generated by starsolo_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/starsolo_em.pickle

  • DATA_DIR/spermatogenesis/velocities/starsolo_steady_state.pickle

Generated by velocyto_vi.ipynb

  • DATA_DIR/spermatogenesis/velocities/velocyto_velovi.npy

Generated by velocyto_em_ss.ipynb

  • DATA_DIR/spermatogenesis/velocities/velocyto_scvelo.pickle

  • DATA_DIR/spermatogenesis/velocities/velocyto_steady_state.pickle

Output

Library imports#

import os
import sys
from tqdm import tqdm

import matplotlib.pyplot as plt
import seaborn as sns
import mplscience

import numpy as np
import pandas as pd
from scipy.stats import pearsonr

sys.path.insert(0, "../../../")
from paths import DATA_DIR, FIG_DIR

General settings#

sns.reset_defaults()
sns.reset_orig()

Constants#

PROTOCOLS = [
    'alevin_coll_decoy_gtr',
    'alevin_coll_gtr',
    'alevin_sep_decoy_gtr',
    'alevin_sep_gtr',
    'alevin_spliced_unspliced',
    'dropest',
    'kallisto_isocollapse_exclude',
    'kallisto_isocollapse_include',
    'kallisto_isoseparate_exclude',
    'kallisto_isoseparate_include',
    'starsolo_subtr',
    'starsolo',
    'velocyto'
]
SAVE_FIGURES = True
if SAVE_FIGURES:
    os.makedirs(FIG_DIR / 'comparison', exist_ok=True)

Data loading#

velocities_velovi = {
    protocol: np.load(file=DATA_DIR / 'spermatogenesis' / 'velocities' / f'{protocol}_velovi.npy')
    for protocol in PROTOCOLS
}
velocities_em = {protocol: pd.read_pickle(DATA_DIR / 'spermatogenesis' / 'velocities' / f'{protocol}_em.pickle') for protocol in PROTOCOLS}
velocities_steady_state = {protocol: pd.read_pickle(DATA_DIR / 'spermatogenesis' / 'velocities' / f'{protocol}_steady_state.pickle') for protocol in PROTOCOLS}
N_OBS = velocities_velovi['alevin_coll_decoy_gtr'].shape[0]
_var_names = velocities_em[PROTOCOLS[0]].columns[~velocities_em[PROTOCOLS[0]].isnull().any()]

for protocol in PROTOCOLS[1:]:
    _var_names = _var_names.intersection(velocities_em[protocol].columns[~velocities_em[protocol].isnull().any()])

_var_names_idx = np.where(velocities_em[protocol].columns.isin(_var_names))[0]
for protocol in tqdm(PROTOCOLS):
    velocities_em[protocol] = velocities_em[protocol][_var_names]
    velocities_steady_state[protocol] = velocities_steady_state[protocol][_var_names]
    velocities_velovi[protocol] = velocities_velovi[protocol][:, _var_names_idx]
100%|██████████| 13/13 [00:00<00:00, 60.52it/s]
corr_velovi = {
    PROTOCOLS[protocol_id]: pd.DataFrame(columns=PROTOCOLS[protocol_id + 1:]) for protocol_id in range(len(PROTOCOLS))
}
corr_em = {
    PROTOCOLS[protocol_id]: pd.DataFrame(columns=PROTOCOLS[protocol_id + 1:]) for protocol_id in range(len(PROTOCOLS))
}
corr_steady_state = {
    PROTOCOLS[protocol_id]: pd.DataFrame(columns=PROTOCOLS[protocol_id + 1:]) for protocol_id in range(len(PROTOCOLS))
}
for ref_protocol in tqdm(PROTOCOLS):
    for protocol in corr_velovi[ref_protocol]:
        # velovi
        corr_velovi[ref_protocol][protocol] = np.array(
            [
                pearsonr(
                    velocities_velovi[ref_protocol][row_id, :],
                    velocities_velovi[protocol][row_id, :]
                )[0]
                for row_id in range(N_OBS)
            ]
        )

        # EM
        corr_em[ref_protocol][protocol] = np.array(
            [
                pearsonr(
                    velocities_em[ref_protocol].values[row_id, :],
                    velocities_em[protocol].values[row_id, :]
                )[0]
                for row_id in range(N_OBS)
            ]
        )

        # steady-state
        corr_steady_state[ref_protocol][protocol] = np.array(
            [
                pearsonr(
                    velocities_steady_state[ref_protocol].values[row_id, :],
                    velocities_steady_state[protocol].values[row_id, :]
                )[0]
                for row_id in range(N_OBS)
            ]
        )
100%|██████████| 13/13 [00:39<00:00,  3.07s/it]

Correlation plots#

combined_corr = {}

alevin_coll_decoy_gtr#

df_velovi = corr_velovi[PROTOCOLS[0]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[0]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[0]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[0]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[0]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[0]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[0]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[0]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/356c7483075eee2514be29ed8e9dc636b006c158e4b1bf124ae11c4d6ee08d6e.png

alevin_coll_gtr#

df_velovi = corr_velovi[PROTOCOLS[1]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[1]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[1]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[1]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[1]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[1]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[1]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[1]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/b8202833f04fc0a8e2548e505a2d621232889f43dbbb919b9d468ee8faf7b28b.png

alevin_sep_decoy_gtr#

df_velovi = corr_velovi[PROTOCOLS[2]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[2]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[2]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[2]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[2]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[2]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[2]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[2]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/48c575418b52f720eee56a9952789e955e58cc11d81c1705f3a47a3a36f5f1e3.png

alevin_sep_gtr#

df_velovi = corr_velovi[PROTOCOLS[3]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[3]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[3]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[3]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[3]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[3]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[3]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[3]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/8da5791e083dda5baf04bbc2e3b16158eaa727d7e42b22b655df1b78543f7ea9.png

alevin_spliced_unspliced#

df_velovi = corr_velovi[PROTOCOLS[4]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[4]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[4]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[4]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[4]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[4]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[4]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[4]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/e49ec2629a56b07bb753a232a4f34caf46500d3c8913de322a6156ec000859d4.png

dropest#

df_velovi = corr_velovi[PROTOCOLS[5]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[5]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[5]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[5]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[5]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[5]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[5]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[5]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/05c23f2366fc81c3e58df7cfd057b20844d141535aec5c909bac35c0e553af67.png

kallisto_isocollapse_exclude#

df_velovi = corr_velovi[PROTOCOLS[6]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[6]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[6]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[6]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[6]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[6]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[6]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[6]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/f417c30836b7225de6fd51f5eaa26cf0c24b18fc7016f9f663476ef5705bd4cb.png

kallisto_isocollapse_include#

df_velovi = corr_velovi[PROTOCOLS[7]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[7]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[7]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[7]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[7]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[7]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[7]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[7]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/920f9ec414c55c91649f76aec74b0b4e7c059f236e85163c50584ea332a8ac90.png

kallisto_isoseparate_exclude#

df_velovi = corr_velovi[PROTOCOLS[8]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[8]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[8]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[8]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[8]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[8]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[8]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[8]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/20edddf4f88f9351673b5a4d8c08b658ac12179a77f76f21e925cb9690e24216.png

kallisto_isoseparate_include#

df_velovi = corr_velovi[PROTOCOLS[9]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[9]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[9]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[9]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[9]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[9]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[9]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[9]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/b4f5e02d7cb05ac80f610f0314fc05a57c8dd15f60f5e699bdb3117dd74a646b.png

starsolo_subtr#

df_velovi = corr_velovi[PROTOCOLS[10]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[10]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[10]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[10]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[10]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[10]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[10]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[10]], palette='colorblind', ax=ax[col_id])
    ax[col_id].set_xticklabels(ax[col_id].get_xticklabels(), rotation=45)
../../_images/603e87c9f931563b13f6febc538db8105aeae83ba22792c2797201b782d8430b.png

starsolo#

df_velovi = corr_velovi[PROTOCOLS[11]]
df_velovi["Method"] = 'VI'

df_em = corr_em[PROTOCOLS[11]]
df_em["Method"] = 'EM'

df_steady_state = corr_steady_state[PROTOCOLS[11]]
df_steady_state["Method"] = 'Steady-state'

combined_corr[PROTOCOLS[11]] = pd.concat([df_velovi, df_em, df_steady_state,])

fig, ax = plt.subplots(ncols=combined_corr[PROTOCOLS[11]].shape[1] - 1, figsize=((combined_corr[PROTOCOLS[11]].shape[1] - 1) * 6, 4))
for col_id, col in enumerate(combined_corr[PROTOCOLS[11]].columns[:-1]):
    sns.boxplot(x="Method", y=col, data=combined_corr[PROTOCOLS[11]], palette='colorblind', ax=ax)
    ax.set_xticklabels(ax.get_xticklabels(), rotation=45)
../../_images/5c4c0349ed18fcf1879d7bd09007266cc9804a98a20f1c907193d034e419b973.png

Summary figures#

with mplscience.style_context():
    sns.set_style(style="whitegrid")
    fig, ax = plt.subplots(nrows=len(PROTOCOLS[:-1]), ncols=len(PROTOCOLS[:-1]), figsize=(len(PROTOCOLS[:-1]) * 6, len(PROTOCOLS[:-1]) * 6))
    for row_id, ref_protocol in enumerate(PROTOCOLS[:-1]):
        for col_id, protocol in enumerate(combined_corr[ref_protocol].columns[:-1]):
            df = combined_corr[ref_protocol]

            sns.boxplot(x="Method", y=protocol, data=df, palette='colorblind', ax=ax[row_id, row_id + col_id])
            if col_id == 0:
                ax[row_id, row_id + col_id].set_xticklabels(ax[row_id, row_id + col_id].get_xticklabels(), rotation=45)
            if col_id > 0:
                ax[row_id, row_id + col_id].set_xlabel('')
                ax[row_id, row_id + col_id].set_xticklabels([])
                ax[row_id, row_id + col_id].set_ylabel('')
            ax[row_id, row_id].set_ylabel("Pearson correlation")
        if row_id == 0:
            ax[row_id, row_id + col_id].set_title(protocol)
        if row_id < (len(PROTOCOLS[:-1]) - 1):
            ax[row_id, len(PROTOCOLS[:-1]) - 1].yaxis.set_label_position("right")
            ax[row_id, len(PROTOCOLS[:-1]) - 1].set_ylabel(ref_protocol, rotation=270, labelpad=15)
        else:
            _ax = ax[row_id, row_id].twinx()
            _ax.set_yticks([])
            _ax.yaxis.set_label_position("right")
            _ax.set_ylabel(ref_protocol, rotation=270, labelpad=15)

        for col_id in range(len(PROTOCOLS[:-1])):
            if col_id < row_id:
                ax[row_id, col_id].axis('off')

if SAVE_FIGURES:
    fig.savefig(
        FIG_DIR / 'comparison' / "preprocessing_spermatogenesis.pdf",
        bbox_inches="tight",
        dpi=300
    );
    fig.savefig(
        FIG_DIR / 'comparison' / "preprocessing_spermatogenesis.svg",
        bbox_inches="tight",
        format='svg'
    )
../../_images/7b1a48125b082bc44bf567e0a6c0593e1335ea9b3181f372ffd9aaccadb61797.png
agg_corr = pd.DataFrame(
    combined_corr[PROTOCOLS[0]].iloc[:, :-1].mean(axis=1),
    columns=[PROTOCOLS[0]]
)
for ref_protocol in PROTOCOLS[1:-1]:
    agg_corr = pd.concat(
        [
            agg_corr, 
            pd.DataFrame(
                combined_corr[ref_protocol].iloc[:, :-1].mean(axis=1),
                columns=[ref_protocol]
            )
        ],
        axis=1
    )

agg_corr = pd.DataFrame(
    {
        'Mean correlation': agg_corr.mean(axis=1).values,
        "Method": combined_corr[PROTOCOLS[0]]["Method"].values
    }
)

with mplscience.style_context():
    sns.set_style(style="whitegrid")
    fig, ax = plt.subplots(figsize=(6, 4))
    sns.boxplot(x="Method", y='Mean correlation', data=agg_corr, palette='colorblind', ax=ax);
    ax.set_xticklabels(ax.get_xticklabels(), rotation=45);

if SAVE_FIGURES:
    fig.savefig(
        FIG_DIR / 'comparison' / "preprocessing_spermatogenesis_aggregated.pdf",
        bbox_inches="tight",
        dpi=300
    );
    fig.savefig(
        FIG_DIR / 'comparison' / "preprocessing_spermatogenesis_aggregated.svg",
        bbox_inches="tight",
        format="svg",
    );
../../_images/9cec027f25955e6a85e0993a8a28be50b47c86fa05fe819a70127ac9d0257f3e.png