Ejemplo n.º 1
0
def run_decode_lcp_yuta(input_folder_path, output_folder_path):
    e = experiment_data()
    e.experiment_name = "DECODE-SAIS-LCP-YUTA"
    input_filename = os.listdir(input_folder_path)
    for f in input_filename:
        input_file = os.path.join(input_folder_path, f)
        output_file = os.path.join(output_folder_path, f + '-decode-yuta')
        compressed_file = os.path.join(output_folder_path, f + '.gcis')

        print("GCIS Compressing: ", f)
        if (os.path.isfile(compressed_file)):
            print(compressed_file, 'already exists, skipping')
        else:
            gcis.compress_gc_is(input_file, compressed_file)

        print("GCIS Decoding and SAIS Yuta + LCP")
        dt = []
        st = []
        tt = []
        for i in range(number_of_samples):
            (decode_time,
             saca_time) = sais.decode_sais_lcp_yuta(compressed_file,
                                                    output_file)
            dt.append(float(decode_time))
            st.append(float(saca_time))
            tt.append(float(decode_time) + float(saca_time))
            print("Decode Time =", decode_time, 'seconds')
            print("Saca LCP Yuta Time =", saca_time, 'seconds')

        e.experiment_input.append(f)
        e.experiment_time.append(('{:.2f}'.format(statistics.mean(dt)),
                                  '{:.2f}'.format(statistics.mean(st)),
                                  '{:.2f}'.format(statistics.mean(tt))))

    return e
Ejemplo n.º 2
0
def run_decode(input_folder_path, output_folder_path):
    e = experiment_data()
    e.experiment_name = "GCIS-DECODE"
    input_filename = os.listdir(input_folder_path)
    for f in input_filename:
        input_file = os.path.join(input_folder_path, f)
        compressed_file = os.path.join(output_folder_path, f + '.gcis')
        decompressed_file = os.path.join(output_folder_path, f + '.tmp.txt')

        print("GCIS Compressing: ", f)
        if (os.path.isfile(compressed_file)):
            print(compressed_file, 'already exists, skipping')
        else:
            gcis.compress_gc_is(input_file, compressed_file)

        print("GCIS Decoding")
        tt = []
        for i in range(number_of_samples):
            total_time = gcis.decompress_gc_is(compressed_file,
                                               decompressed_file)
            tt.append(total_time)
            print("Time Decode =", "{:.2f}".format(total_time))
            print('Removing tmp file', decompressed_file)
            os.remove(decompressed_file)
        e.experiment_input.append(f)
        e.experiment_time.append("{:.2f}".format(statistics.mean(tt)))

    return e
Ejemplo n.º 3
0
def run_decode_saca_lcp(input_folder_path, output_folder_path):

    e = experiment_data()
    e.experiment_name = "GCIS-SACA-LCP"
    input_filename = os.listdir(input_folder_path)
    for f in input_filename:
        input_file = os.path.join(input_folder_path, f)
        compressed_file = os.path.join(output_folder_path, f + '.gcis')
        output_file = os.path.join(output_folder_path, f + '-gcis')

        print("GCIS Compressing: ", f)
        if (os.path.isfile(compressed_file)):
            print(compressed_file, 'already exists, skipping')
        else:
            gcis.compress_gc_is(input_file, compressed_file)

        print("GCIS Decoding + SAIS + LCP: ", f)
        tt = []
        for i in range(number_of_samples):
            start_time = time.perf_counter()  # Start time
            gcis.decompress_saca_lcp(compressed_file, output_file)
            end_time = time.perf_counter()  # End time
            total_time = end_time - start_time
            print("Time GCIS + LCP =", "{:.2f}".format(total_time))
            tt.append(total_time)

        e.experiment_input.append(f)
        e.experiment_time.append("{:.2f}".format(statistics.mean(tt)))

    return e
Ejemplo n.º 4
0
def run_decode_divsufsort_lcp(input_folder_path, output_folder_path):
    e = experiment_data()
    e.experiment_name = "DECODE-SAIS-DIVSUFSORT-LCP"
    input_filename = os.listdir(input_folder_path)
    for f in input_filename:

        # Divsufsort + LCP have
        # Terrible behaviour on artificial sequences, skip.
        if (f == 'fib41' or f == 'rs.13' or f == 'tm29'):
            print("Divsufort + LCP: Artificial Sequence", f, "skipping")
            tt = [-1.0]
            st = [-1.0]
            dt = [-1.0]
            e.experiment_input.append(f)
            e.experiment_time.append(('{:.2f}'.format(statistics.mean(dt)),
                                      '{:.2f}'.format(statistics.mean(st)),
                                      '{:.2f}'.format(statistics.mean(tt))))
            continue

        input_file = os.path.join(input_folder_path, f)
        output_file = os.path.join(output_folder_path,
                                   f + '-decode-divsufsort')
        compressed_file = os.path.join(output_folder_path, f + '.gcis')

        print("GCIS Compressing: ", f)
        if (os.path.isfile(compressed_file)):
            print(compressed_file, 'already exists, skipping')
        else:
            gcis.compress_gc_is(input_file, compressed_file)

        print("GCIS Decoding and Divsufsort + LCP")
        dt = []
        st = []
        tt = []
        for i in range(number_of_samples):
            (decode_time, saca_time) = sais.decode_sais_divsufsort_lcp(
                compressed_file, output_file)
            dt.append(float(decode_time))
            st.append(float(saca_time))
            tt.append(float(decode_time) + float(saca_time))
            print("Decode Time =", decode_time, 'seconds')
            print("Saca Divsufsort Time =", saca_time, 'seconds')

        e.experiment_input.append(f)
        e.experiment_time.append(('{:.2f}'.format(statistics.mean(dt)),
                                  '{:.2f}'.format(statistics.mean(st)),
                                  '{:.2f}'.format(statistics.mean(tt))))

    return e