import pandas as pd
import argparse
import os

if __name__=='__main__':
    """
    Merge benchmark output for all scenarios, methods and settings
    """

    parser = argparse.ArgumentParser(description='Collect all benchmarks')

    parser.add_argument('-o', '--output', required=True, help='output file')
    parser.add_argument('-r', '--root', required=True,
                        help='root directory for scIB output')
    args = parser.parse_args()

    bench_files = []
    for path, dirs, files in os.walk(args.root):
        for file in files:
            if 'integration' in path and file.endswith('.benchmark'):
                bench_files.append(os.path.join(path, file))

    res_list = []
    for file in bench_files:

        if os.stat(file).st_size == 0:
            print(f'{file} is empty and will be skipped')
            continue

        clean_name = file.replace(args.root, "").replace(".benchmark", "")
        res = pd.read_csv(file, sep='\t')
        res.rename(columns={res.columns[1]: 'h_m_s'}, inplace=True)
        res['scenario'] = clean_name
        res.set_index('scenario', inplace=True)
        res_list.append(res)

    results = pd.concat(res_list)
    results.to_csv(args.output, index_label='scenario')


@@ -452,16 +452,64 @@
 args()%0A%0A
+%0A    print(%22Searching for .benchmark files...%22)%0A
     benc
@@ -728,16 +728,110 @@
  file))%0A
+    print(f%22Found %7Blen(bench_files)%7D .benchmark files%22)%0A%0A    print(%22Collecting benchmarks...%22)
 %0A    res
@@ -1290,16 +1290,72 @@
 d(res)%0A%0A
+    print(f%22Saving merged benchmarks to %7Bargs.output%7D%22)%0A
     resu
@@ -1433,12 +1433,32 @@
 scenario')%0A%0A
+    print(%22Done!%22)%0A%0A

Add progress messages to merge_benchmarks.py