コード例 #1
0
def timecourse_figure():
    # Get experimental data
    newdata_1 = IfnData("20190108_pSTAT1_IFN_Bcell")
    newdata_2 = IfnData("20190119_pSTAT1_IFN_Bcell")
    newdata_3 = IfnData("20190121_pSTAT1_IFN_Bcell")
    newdata_4 = IfnData("20190214_pSTAT1_IFN_Bcell")

    # Aligned data, to get scale factors for each data set
    alignment = DataAlignment()
    alignment.add_data([newdata_4, newdata_3, newdata_2, newdata_1])
    alignment.align()
    alignment.get_scaled_data()
    mean_data = alignment.summarize_data()

    # Plot
    green = sns.color_palette("deep")[2]
    red = sns.color_palette("deep")[3]
    light_green = sns.color_palette("pastel")[2]
    light_red = sns.color_palette("pastel")[3]
    plot = TimecoursePlot((1, 1))
    plot.add_trajectory(mean_data,
                        'errorbar',
                        'o--', (0, 0),
                        label=r'10 pM IFN$\alpha$2',
                        color=light_red,
                        dose_species='Alpha',
                        doseslice=10.0,
                        alpha=0.5)
    plot.add_trajectory(mean_data,
                        'errorbar',
                        'o--', (0, 0),
                        label=r'6 pM IFN$\beta$',
                        color=light_green,
                        dose_species='Beta',
                        doseslice=6.0,
                        alpha=0.5)
    plot.add_trajectory(mean_data,
                        'errorbar',
                        'o-', (0, 0),
                        label=r'3000 pM IFN$\alpha$2',
                        color=red,
                        dose_species='Alpha',
                        doseslice=3000.0)
    plot.add_trajectory(mean_data,
                        'errorbar',
                        'o-', (0, 0),
                        label=r'2000 pM IFN$\beta$',
                        color=green,
                        dose_species='Beta',
                        doseslice=2000.0)
    fname = os.path.join(os.getcwd(), 'results', 'Figures', 'Figure_4',
                         'Timecourse.pdf')
    plot.axes.set_ylabel('pSTAT1 (MFI)')
    plot.show_figure(show_flag=False, save_flag=True, save_dir=fname)
コード例 #2
0
                                                 'plot', beta_palette[j],
                                                 (0, 1))
    # Add data
    for idx, d in enumerate(doses_alpha):
        # Optional mask:
        if d not in alpha_mask:
            atc = IfnData('custom', df=mean_data.data_set.loc['Alpha', d, :])
            time_course_paper_fig.add_trajectory(atc,
                                                 'scatter',
                                                 'o', (0, 0),
                                                 label='Alpha ' + str(d),
                                                 color=alpha_palette[idx])
            time_course_paper_fig.add_trajectory(atc,
                                                 'errorbar',
                                                 alpha_palette[idx], (0, 0),
                                                 color=alpha_palette[idx])
    for idx, d in enumerate(doses_beta):
        if d not in beta_mask:
            btc = IfnData('custom', df=mean_data.data_set.loc['Beta', d, :])
            time_course_paper_fig.add_trajectory(btc,
                                                 'scatter',
                                                 'o', (0, 1),
                                                 label='Beta ' + str(d),
                                                 color=beta_palette[idx])
            time_course_paper_fig.add_trajectory(btc,
                                                 'errorbar',
                                                 beta_palette[idx], (0, 1),
                                                 color=beta_palette[idx])

    time_course_paper_fig.show_figure()
コード例 #3
0
            data_plot_tc.add_trajectory(btc,
                                        'scatter',
                                        beta_palette_new[j], (0, 1),
                                        label='Beta ' + str(dose))
            data_plot_tc.add_trajectory(btc,
                                        'plot',
                                        '--', (0, 1),
                                        color=beta_palette_new[j])
    # original
    #for j, dose in enumerate(beta_doses_20181113):
    #    if dose not in beta_mask:
    #        btc = IfnData('custom', df=olddata.data_set.loc['Beta', dose, :])
    #        data_plot_tc.add_trajectory(btc, 'scatter', beta_palette_old[j], (0, 1), label='Beta '+str(dose))
    #        data_plot_tc.add_trajectory(btc, 'plot', '--', (0, 1), color=beta_palette_old[j])

    # Add titles
    data_plot_tc.axes[3][0].set_title(r"IFN$\alpha$ 2019-02-14 data")
    data_plot_tc.axes[3][1].set_title(r"IFN$\beta$ 2019-02-14 data")
    data_plot_tc.axes[2][0].set_title(r"IFN$\alpha$ 2019-01-21 data")
    data_plot_tc.axes[2][1].set_title(r"IFN$\beta$ 2019-01-21 data")
    data_plot_tc.axes[1][0].set_title(r"IFN$\alpha$ 2019-01-19 data")
    data_plot_tc.axes[1][1].set_title(r"IFN$\beta$ 2019-01-19 data")
    data_plot_tc.axes[0][0].set_title(r"IFN$\alpha$ 2019-01-08 data")
    data_plot_tc.axes[0][1].set_title(r"IFN$\beta$ 2019-01-08 data")
    #data_plot_tc.axes[0][0].set_title(r"IFN$\alpha$ old data")
    #data_plot_tc.axes[0][1].set_title(r"IFN$\beta$ old data")

    tc_fig, tc_axes = data_plot_tc.show_figure(save_flag=False)
    tc_fig.set_size_inches(10.5, 28.5)
    tc_fig.savefig('results/GAB_NewData/compare_data_tc.pdf')
コード例 #4
0
                                   linewidth=2.0)

    for j, dose in enumerate(beta_doses):
        if dose not in beta_mask:
            tc_plot.add_trajectory(beta_IfnData_objects[j],
                                   'plot',
                                   beta_palette[j], (0, 1),
                                   label='Beta ' + str(dose),
                                   linewidth=2.0)
            tc_plot.add_trajectory(beta_IfnData_objects_int[j],
                                   'plot',
                                   beta_palette[j], (1, 1),
                                   label='Beta ' + str(dose),
                                   linewidth=2.0)
            tc_plot.add_trajectory(beta_IfnData_objects_rec[j],
                                   'plot',
                                   beta_palette[j], (2, 1),
                                   label='Beta ' + str(dose),
                                   linewidth=2.0)

    tc_plot.axes[0][0].set_title(r"Baseline")
    tc_plot.axes[0][1].set_title(r"Baseline")
    tc_plot.axes[1][0].set_title(
        r"Internalization Rate Increased by {}".format(internalization_sf))
    tc_plot.axes[1][1].set_title(
        r"Internalization Rate Increased by {}".format(internalization_sf))
    tc_plot.axes[2][0].set_title(r"R2 Recycling Rate x {}".format(recycle_sf))
    tc_plot.axes[2][1].set_title(r"R2 Recycling Rate x {}".format(recycle_sf))

    tc_plot.show_figure()
コード例 #5
0
                                   'plot',
                                   beta_palette[j + 2], (0, 1),
                                   label='Beta ' + str(dose))
    # Add data
    for idx, d in enumerate([5, 50, 250, 500, 5000, 25000, 50000]):
        # Optional mask:
        if d not in alpha_mask:
            atc = IfnData('custom', df=newdata.data_set.loc['Alpha', d, :])
            new_fit.add_trajectory(atc,
                                   'scatter',
                                   alpha_palette[idx + 2], (0, 0),
                                   label='Alpha ' + str(d))
            new_fit.add_trajectory(atc,
                                   'plot',
                                   '--', (0, 0),
                                   color=alpha_palette[idx + 2])
    for j, dose in enumerate([0.1, 1, 5, 10, 100, 200, 1000]):
        if dose not in beta_mask:
            btc = IfnData('custom', df=newdata.data_set.loc['Beta', dose, :])
            new_fit.add_trajectory(btc,
                                   'scatter',
                                   beta_palette[j + 2], (0, 1),
                                   label='Beta ' + str(dose))
            new_fit.add_trajectory(btc,
                                   'plot',
                                   '--', (0, 1),
                                   color=beta_palette[j + 2])

    new_fit.show_figure()
    print(Mixed_Model.parameters)
コード例 #6
0
def experimental_panel(cell_densities,
                       IFNAlpha_panel,
                       IFNBeta_panel,
                       times,
                       IFN_in_concentration=True):
    # ----------
    # Run model
    # ----------
    predictions = run_smooth_trajectories(cell_densities, IFNAlpha_panel,
                                          IFNBeta_panel, times)
    # -------------------------------
    # Plot model dose response curves
    # -------------------------------
    alpha_palette = sns.color_palette("deep", 6)
    beta_palette = sns.color_palette("deep", 6)

    # pSTAT plot
    STAT_plot = TimecoursePlot((len(IFNAlpha_panel), 2))
    for dose_idx, dose in enumerate(IFNAlpha_panel):
        color_counter = -1
        for density_idx, density in enumerate(cell_densities):
            color_counter += 1
            STAT_plot.add_trajectory(
                predictions[density][0],
                'plot',
                '-',
                subplot_idx=(dose_idx, 0),
                label=r'IFN$\alpha$ at {}$\times 10^6$ cells/mL'.format(
                    cell_densities[density_idx] / 1E9),
                doseslice=dose,
                dose_species='Alpha',
                color=alpha_palette[color_counter],
                linewidth=2)
    for dose_idx, dose in enumerate(IFNBeta_panel):
        color_counter = -1
        for density_idx, density in enumerate(cell_densities):
            color_counter += 1
            STAT_plot.add_trajectory(
                predictions[density][1],
                'plot',
                '-',
                subplot_idx=(dose_idx, 1),
                label=r'IFN$\beta$ at {}$\times 10^6$ cells/mL'.format(
                    cell_densities[density_idx] / 1E9),
                doseslice=dose,
                dose_species='Beta',
                color=beta_palette[color_counter],
                linewidth=2)
    fig, axes = STAT_plot.show_figure()
    for i in range(len(IFNAlpha_panel)):
        axes[i][0].set_title(r'IFN$\alpha$ at {} pM'.format(IFNAlpha_panel[i]))
        axes[i][1].set_title(r'IFN$\beta$ at {} pM'.format(IFNBeta_panel[i]))
    fig.set_size_inches(12, 9)
    fig.tight_layout()
    fig.savefig('varying_reaction_volume_STATtc.pdf')

    # Free extracellular IFN plot
    IFN_plot = TimecoursePlot((len(IFNAlpha_panel), 2))
    for ax in IFN_plot.axes.flat:
        ax.set_yscale('log')
    for i in range(len(IFNAlpha_panel)):
        if IFN_in_concentration:
            IFN_plot.axes[i][0].set_ylim(bottom=1E-3,
                                         top=max(IFNAlpha_panel) * 1E-2)
            IFN_plot.axes[i][1].set_ylim(bottom=1E-3,
                                         top=max(IFNBeta_panel) * 1E-2)
        else:
            IFN_plot.axes[i][0].set_ylim(bottom=1,
                                         top=max(IFNAlpha_panel) * 10**-12 *
                                         max(volume_panel) * 6.022E23)
            IFN_plot.axes[i][1].set_ylim(bottom=1,
                                         top=max(IFNBeta_panel) * 10**-12 *
                                         max(volume_panel) * 6.022E23)

    # Add fits
    for dose_idx, dose in enumerate(IFNAlpha_panel):
        color_counter = -1
        for density_idx, density in enumerate(cell_densities):
            color_counter += 1
            IFN_plot.add_trajectory(predictions[density][2],
                                    'plot',
                                    '-',
                                    subplot_idx=(dose_idx, 0),
                                    label=r'{}$\times 10^6$ cells/mL'.format(
                                        cell_densities[density_idx] / 1E9),
                                    doseslice=dose,
                                    dose_species='Alpha',
                                    color=alpha_palette[color_counter],
                                    linewidth=2)
    for dose_idx, dose in enumerate(IFNBeta_panel):
        color_counter = -1
        for density_idx, density in enumerate(cell_densities):
            color_counter += 1
            IFN_plot.add_trajectory(predictions[density][3],
                                    'plot',
                                    '-',
                                    subplot_idx=(dose_idx, 1),
                                    label=r'{}$\times 10^6$ cells/mL'.format(
                                        cell_densities[density_idx] / 1E9),
                                    doseslice=dose,
                                    dose_species='Beta',
                                    color=beta_palette[color_counter],
                                    linewidth=2)
    fig, axes = IFN_plot.show_figure()
    for i in range(len(IFNAlpha_panel)):
        axes[i][0].set_title(r'IFN$\alpha$ at {} pM'.format(IFNAlpha_panel[i]))
        axes[i][0].set_ylabel(r'Free IFN$\alpha$ (nM)')
        axes[i][1].set_title(r'IFN$\beta$ at {} pM'.format(IFNBeta_panel[i]))
        axes[i][1].set_ylabel(r'Free IFN$\beta$ (nM)')

    fig.set_size_inches(16, 12)
    fig.tight_layout()
    fig.savefig('varying_reaction_volume_IFNtc.pdf')
コード例 #7
0
def testing_specific_values():
    volEC1 = 1 / (25E9)
    volEC2 = 1E-5
    # --------------------
    # Set up Model
    # --------------------
    # Parameters found by stepwise fitting GAB mean data
    # Note: can remove multiplicative factors on all K1, K2, K4 and still get very good fit to data (worst is 5 min beta)
    initial_parameters = {
        'k_a1': 4.98E-14 * 2,
        'k_a2': 8.30e-13 * 2,
        'k_d4': 0.006 * 3.8,
        'kpu': 0.00095,
        'ka2': 4.98e-13 * 2.45,
        'kd4': 0.3 * 2.867,
        'kint_a': 0.000124,
        'kint_b': 0.00086,
        'krec_a1': 0.0028,
        'krec_a2': 0.01,
        'krec_b1': 0.005,
        'krec_b2': 0.05
    }
    dual_parameters = {
        'kint_a': 0.00052,
        'kSOCSon': 6e-07,
        'kint_b': 0.00052,
        'krec_a1': 0.001,
        'krec_a2': 0.1,
        'krec_b1': 0.005,
        'krec_b2': 0.05
    }
    scale_factor = 1.227

    Mixed_Model = DualMixedPopulation('Mixed_IFN_ppCompatible', 0.8, 0.2)
    Mixed_Model.model_1.set_parameters(initial_parameters)
    Mixed_Model.model_1.set_parameters(dual_parameters)
    Mixed_Model.model_1.set_parameters({'R1': 12000.0, 'R2': 1511.1})
    Mixed_Model.model_2.set_parameters(initial_parameters)
    Mixed_Model.model_2.set_parameters(dual_parameters)
    Mixed_Model.model_2.set_parameters({'R1': 6755.56, 'R2': 1511.1})

    # ---------------------------------
    # Make theory dose response curves
    # ---------------------------------
    # Make predictions
    times = np.arange(0, 120, 0.5)  # [2.5, 5.0, 7.5, 10.0, 20.0, 60.0]
    alpha_doses_20190108 = [0, 10, 100, 300, 1000, 3000, 10000, 100000]
    beta_doses_20190108 = [0, 0.2, 6, 20, 60, 200, 600, 2000]

    # 1 uL
    ka1 = Mixed_Model.model_1.parameters['ka1']
    ka2 = Mixed_Model.model_1.parameters['ka2']
    k_a1 = Mixed_Model.model_1.parameters['k_a1']
    k_a2 = Mixed_Model.model_1.parameters['k_a2']
    Mixed_Model.set_global_parameters({
        'volEC': volEC1,
        'ka1': ka1 * 1E-5 / volEC1,
        'ka2': ka2 * 1E-5 / volEC1,
        'k_a1': k_a1 * 1E-5 / volEC1,
        'k_a2': k_a2 * 1E-5 / volEC1
    })
    dradf = Mixed_Model.mixed_dose_response(times,
                                            'TotalpSTAT',
                                            'Ia',
                                            list(logspace(1, 5.2)),
                                            parameters={'Ib': 0},
                                            sf=scale_factor)
    drbdf = Mixed_Model.mixed_dose_response(times,
                                            'TotalpSTAT',
                                            'Ib',
                                            list(logspace(-1, 4)),
                                            parameters={'Ia': 0},
                                            sf=scale_factor)

    dra15uL = IfnData('custom', df=dradf, conditions={'Alpha': {'Ib': 0}})
    drb15uL = IfnData('custom', df=drbdf, conditions={'Beta': {'Ia': 0}})

    # 1 mL
    Mixed_Model.set_global_parameters({
        'volEC': volEC2,
        'ka1': ka1 * 1E-5 / volEC2,
        'ka2': ka2 * 1E-5 / volEC2,
        'k_a1': k_a1 * 1E-5 / volEC2,
        'k_a2': k_a2 * 1E-5 / volEC2
    })
    dradf = Mixed_Model.mixed_dose_response(times,
                                            'TotalpSTAT',
                                            'Ia',
                                            list(logspace(1, 5.2)),
                                            parameters={'Ib': 0},
                                            sf=scale_factor)
    drbdf = Mixed_Model.mixed_dose_response(times,
                                            'TotalpSTAT',
                                            'Ib',
                                            list(logspace(-1, 4)),
                                            parameters={'Ia': 0},
                                            sf=scale_factor)

    dra5mL = IfnData('custom', df=dradf, conditions={'Alpha': {'Ib': 0}})
    drb5mL = IfnData('custom', df=drbdf, conditions={'Beta': {'Ia': 0}})

    # -------------------------------
    # Plot model dose response curves
    # -------------------------------
    alpha_palette = sns.color_palette("deep", 6)
    beta_palette = sns.color_palette("deep", 6)

    new_fit = DoseresponsePlot((2, 2))

    alpha_mask = [2.5, 5.0, 10.0, 20.0, 60.0]
    beta_mask = [2.5, 5.0, 10.0, 20.0, 60.0]
    # Add fits
    color_counter = -1
    for idx, t in enumerate(times):
        if t in alpha_mask:
            color_counter += 1
            new_fit.add_trajectory(dra15uL,
                                   t,
                                   'plot',
                                   alpha_palette[color_counter], (0, 0),
                                   'Alpha',
                                   label=str(t) + ' min',
                                   linewidth=2)
            new_fit.add_trajectory(dra5mL,
                                   t,
                                   'plot',
                                   alpha_palette[color_counter], (1, 0),
                                   'Alpha',
                                   label=str(t) + ' min',
                                   linewidth=2)

        if t in beta_mask:
            new_fit.add_trajectory(drb15uL,
                                   t,
                                   'plot',
                                   beta_palette[color_counter], (0, 1),
                                   'Beta',
                                   label=str(t) + ' min',
                                   linewidth=2)
            new_fit.add_trajectory(drb5mL,
                                   t,
                                   'plot',
                                   beta_palette[color_counter], (1, 1),
                                   'Beta',
                                   label=str(t) + ' min',
                                   linewidth=2)

    dr_fig, dr_axes = new_fit.show_figure()
    dr_axes[0][0].set_title(r'IFN$\alpha$ at {} L'.format(volEC1))
    dr_axes[0][1].set_title(r'IFN$\beta$ at {} L'.format(volEC1))
    dr_axes[1][0].set_title(r'IFN$\alpha$ at {} L'.format(volEC2))
    dr_axes[1][1].set_title(r'IFN$\beta$ at {} L'.format(volEC2))
    dr_fig.tight_layout()
    dr_fig.savefig('varying_reaction_volume_dr.pdf')

    # -------------------------------
    # Plot model dose response curves
    # -------------------------------
    tc_figure = TimecoursePlot((1, 2))

    alpha_testdose = list(logspace(1, 5.2))[24]
    beta_testdose = list(logspace(-1, 4))[17]
    print("Using {} for IFNalpha".format(alpha_testdose))
    print("Using {} for IFNbeta".format(beta_testdose))

    tc_figure.add_trajectory(dra15uL,
                             'plot',
                             '-',
                             subplot_idx=(0, 0),
                             label=r'IFN$\alpha$ at {} L'.format(volEC1),
                             doseslice=alpha_testdose,
                             dose_species='Alpha',
                             color=alpha_palette[1])
    tc_figure.add_trajectory(dra5mL,
                             'plot',
                             '-',
                             subplot_idx=(0, 0),
                             label=r'IFN$\alpha$ at {} L'.format(volEC2),
                             doseslice=alpha_testdose,
                             dose_species='Alpha',
                             color=alpha_palette[4])

    tc_figure.add_trajectory(drb15uL,
                             'plot',
                             '-',
                             subplot_idx=(0, 1),
                             label=r'IFN$\beta$ at {} L'.format(volEC1),
                             doseslice=beta_testdose,
                             dose_species='Beta',
                             color=beta_palette[0])
    tc_figure.add_trajectory(drb5mL,
                             'plot',
                             '-',
                             subplot_idx=(0, 1),
                             label=r'IFN$\beta$ at {} L'.format(volEC2),
                             doseslice=beta_testdose,
                             dose_species='Beta',
                             color=beta_palette[2])
    tc_figure.show_figure(save_flag=True,
                          save_dir='varying_reaction_volume_tc.pdf')

    # ------------------------------------
    # Now let's quickly look at IFN levels
    # ------------------------------------
    # 1 uL
    Mixed_Model.set_global_parameters({
        'volEC': volEC1,
        'ka1': ka1 * 1E-5 / volEC1,
        'ka2': ka2 * 1E-5 / volEC1,
        'k_a1': k_a1 * 1E-5 / volEC1,
        'k_a2': k_a2 * 1E-5 / volEC1
    })
    dradf = Mixed_Model.mixed_dose_response(times,
                                            'Free_Ia',
                                            'Ia',
                                            list(logspace(1, 5.2)),
                                            parameters={'Ib': 0},
                                            sf=scale_factor)
    drbdf = Mixed_Model.mixed_dose_response(times,
                                            'Free_Ib',
                                            'Ib',
                                            list(logspace(-1, 4)),
                                            parameters={'Ia': 0},
                                            sf=scale_factor)

    dra15uL = IfnData('custom', df=dradf, conditions={'Alpha': {'Ib': 0}})
    drb15uL = IfnData('custom', df=drbdf, conditions={'Beta': {'Ia': 0}})

    # 1 mL
    Mixed_Model.set_global_parameters({
        'volEC': volEC2,
        'ka1': ka1 * 1E-5 / volEC2,
        'ka2': ka2 * 1E-5 / volEC2,
        'k_a1': k_a1 * 1E-5 / volEC2,
        'k_a2': k_a2 * 1E-5 / volEC2
    })
    dradf = Mixed_Model.mixed_dose_response(times,
                                            'Free_Ia',
                                            'Ia',
                                            list(logspace(1, 5.2)),
                                            parameters={'Ib': 0},
                                            sf=scale_factor)
    drbdf = Mixed_Model.mixed_dose_response(times,
                                            'Free_Ib',
                                            'Ib',
                                            list(logspace(-1, 4)),
                                            parameters={'Ia': 0},
                                            sf=scale_factor)

    dra5mL = IfnData('custom', df=dradf, conditions={'Alpha': {'Ib': 0}})
    drb5mL = IfnData('custom', df=drbdf, conditions={'Beta': {'Ia': 0}})

    tc_figure = TimecoursePlot((1, 2))

    tc_figure.add_trajectory(dra15uL,
                             'plot',
                             '-',
                             subplot_idx=(0, 0),
                             label=r'IFN$\alpha$ at {} L'.format(volEC1),
                             doseslice=alpha_testdose,
                             dose_species='Alpha',
                             color=alpha_palette[1])
    tc_figure.add_trajectory(dra5mL,
                             'plot',
                             '-',
                             subplot_idx=(0, 0),
                             label=r'IFN$\alpha$ at {} L'.format(volEC2),
                             doseslice=alpha_testdose,
                             dose_species='Alpha',
                             color=alpha_palette[4])

    tc_figure.add_trajectory(drb15uL,
                             'plot',
                             '-',
                             subplot_idx=(0, 1),
                             label=r'IFN$\beta$ at {} L'.format(volEC1),
                             doseslice=beta_testdose,
                             dose_species='Beta',
                             color=beta_palette[0])
    tc_figure.add_trajectory(drb5mL,
                             'plot',
                             '-',
                             subplot_idx=(0, 1),
                             label=r'IFN$\beta$ at {} L'.format(volEC2),
                             doseslice=beta_testdose,
                             dose_species='Beta',
                             color=beta_palette[2])
    for ax in tc_figure.axes.flatten():
        ax.set_yscale('log')
    ifn_fig, ifn_axes = tc_figure.show_figure()
    ifn_axes[0].set_ylabel('IFN-alpha2')
    ifn_axes[1].set_ylabel('IFN-beta')
    ifn_fig.savefig('varying_reaction_volume_tc_IFN.pdf')
コード例 #8
0
    for d_idx, dataset in enumerate(alignment.scaled_data):
        colour_palette = sns.color_palette(clist[d_idx], 1)
        for spec_idx, spec in enumerate(species):
            for dose_idx, dose in enumerate(recorded_doses[spec]):
                dose_dataset = pd.concat([dataset.data_set.loc[spec, dose, :]],
                                         keys=[spec],
                                         names=['Dose_Species'])
                dose_IfnData = IfnData('custom',
                                       df=dose_dataset,
                                       conditions=dataset.conditions)
                tc_plot.add_trajectory(dose_IfnData,
                                       'plot',
                                       colour_palette[0], (dose_idx, spec_idx),
                                       label=dataset.name[0:8])
    tc_fig, tc_axes = tc_plot.show_figure(save_flag=False)
    tc_fig.set_size_inches(10.5, 7.1 * num_doses)
    tc_fig.savefig('results/GAB_NewData/align_tc.pdf')

    # -------------------------------------
    # Plot mean Dose Response & Time Course
    # -------------------------------------
    alpha_palette = sns.color_palette("Reds", 6)
    beta_palette = sns.color_palette("Greens", 6)
    times = newdata_4.get_times('Alpha')

    mean_dr_plot = DoseresponsePlot((1, 2))
    alpha_mask = [0.0, 7.5]
    beta_mask = [0.0, 7.5]
    # Add data
    for idx, t in enumerate(times):