This function runs the analysis for multiple input settings

def analyze_multiple(
            benchmark_runs,
            analysis_sets = [],
            # Singleton arguments
            analysis_directory = None,
            remove_existing_analysis_directory = True,
            quick_plots = False,
            use_multiprocessing = True,
            verbose = True,
            compile_pdf = True,
            limit_to_complete_presence = True,
            all_by_all_comparisons = False,
    ):
        '''This function runs the analysis for multiple input settings'''
        if remove_existing_analysis_directory and os.path.isdir(analysis_directory):
            shutil.rmtree(analysis_directory)

        unique_ajps = BenchmarkRun.get_unique_ajps( benchmark_runs )

        if limit_to_complete_presence:
            BenchmarkRun.get_common_subset( benchmark_runs, verbose = not use_multiprocessing )

        unique_ajps = BenchmarkRun.get_unique_ajps( benchmark_runs )

        ###  Process each benchmark run object individually
        if use_multiprocessing:
            pool = mp.Pool()
        singleton_chapters = []
        calculated_brs = []
        def save_latex_report(t):
            br, unique_name, latex_report = t
            latex_report.set_title_page( title = unique_name )
            singleton_chapters.append( latex_report )
            calculated_brs.append( br )
        for br in benchmark_runs:
            for analysis_set in analysis_sets:
                unique_name = br.get_definitive_name(unique_ajps, join_character = '\n')
                filepath_unique_name = br.get_definitive_name(unique_ajps, join_character = '-')
                subdir = os.path.join(analysis_directory, os.path.join('analysis_sets', os.path.join(analysis_set, filepath_unique_name) ) )
                if use_multiprocessing:
                    pool.apply_async( _full_analysis_mp_alias, ( br, analysis_set, subdir, unique_name, False, quick_plots ), callback = save_latex_report )
                else:
                    print 'Individual report saving in:', subdir
                    save_latex_report( _full_analysis_mp_alias( br, analysis_set, subdir, unique_name, True, quick_plots ) )
        if use_multiprocessing:
            pool.close()
            pool.join()
        benchmark_runs = calculated_brs

        ### Pointwise all-by-all comparison
        comparison_chapters = []
        if all_by_all_comparisons:
            if use_multiprocessing:
                pool = mp.Pool()
            def save_latex_report(t):
                latex_report = t
                comparison_chapters.append( latex_report )
            comparisons_subdir = os.path.join(analysis_directory, 'comparison_analysis_sets')
            for analysis_set in analysis_sets:
                analysis_set_subdir = os.path.join(comparisons_subdir, analysis_set)
                for i, br_i in enumerate(benchmark_runs):
                    for j, br_j in enumerate(benchmark_runs):
                        if i > j:
                            if use_multiprocessing:
                                br_i_copy = copy.deepcopy( br_i )
                                br_j_copy = copy.deepcopy( br_j )
                                pool.apply_async( _compare_mp_alias, (br_i_copy, br_j_copy, analysis_set, analysis_set_subdir, unique_ajps, False), callback = save_latex_report )
                            else:
                                save_latex_report( _compare_mp_alias(br_i, br_j, analysis_set, analysis_set_subdir, unique_ajps, True) )
            if use_multiprocessing:
                pool.close()
                pool.join()

        intro_report = lr.LatexReport()
        intro_report.set_title_page('All data comparison')
        # All data series comparison
        # Get joined stats comparison dataframe
        stats_df = BenchmarkRun.get_stats_comparison_dataframe(
            benchmark_runs, unique_ajps,
            output_csv = os.path.join(analysis_directory, 'analysis_metrics.csv'),
        )
        intro_report.add_section_page( title = 'Case comparison tables' )
        intro_report.content.extend( BenchmarkRun.make_case_description_tables( stats_df ) )

        intro_report.add_section_page('All data plots')
        subplot_directory = os.path.join(analysis_directory, 'subplots')
        if not os.path.isdir( subplot_directory ):
            os.makedirs(subplot_directory)
        runtime_df = benchmark_runs[0]._get_dataframe_columns( ['RunTime'] )
        runtime_df.columns = [ benchmark_runs[0].get_definitive_name(unique_ajps, join_character = '\n', prepend_label = False) ]
        for br in benchmark_runs[1:]:
            inner_runtime_df = br._get_dataframe_columns( ['RunTime'] )
            inner_runtime_df.columns = [ br.get_definitive_name(unique_ajps, join_character = '\n', prepend_label = False) ]
            runtime_df = runtime_df.merge(
                inner_runtime_df,
                left_index = True,
                right_index = True,
            )

        intro_report.add_plot(
            general_matplotlib.plot_box(
                runtime_df,
                output_directory = subplot_directory,
                plot_title = 'Prediction Run Times',
                output_name = 'runtimes',
                fig_height = 6.7,
                fig_width = 10,
                ylabel = 'Run time (minutes)',
                xlabel = 'Prediction Set',
                verbose = verbose,
                xtick_fontsize = 4,
                log_y = True,
                label_n = False,
                rotation_angle = 45,
            ),
            plot_title = 'Run times'
        )

        # Report concatenation
        main_latex_report = lr.LatexReport()
        main_latex_report.set_title_page('$\Delta\Delta G$ Report')
        main_latex_report.add_chapter(intro_report)
        for chapter in comparison_chapters:
            main_latex_report.add_chapter(chapter)
        for chapter in singleton_chapters:
            main_latex_report.add_chapter(chapter)
        main_latex_report.generate_pdf_report(
            os.path.join( analysis_directory, 'report.pdf' ),
            verbose = verbose,
            compile_pdf = compile_pdf,
        )
        print os.path.join( analysis_directory, 'report.pdf' )