Example #1
0
def main(args):
    bench = 'arbtkf91-bench'
    data_path = os.path.realpath(args.bench_data)
    samples = args.samples
    model_params = {
            "pa" : rat(27, 100),
            "pc" : rat(24, 100),
            "pg" : rat(26, 100),
            "pt" : rat(23, 100),
            "lambda" : rat(1, 1),
            "mu" : rat(2, 1),
            "tau" : rat(1, 10)}
    for name, fin in data_source.gen_files(data_path):
        print(name)
        total_ticks = 0
        for a, b in data_source.gen_sequence_pairs(fin):
            d = dict(
                precision=args.precision,
                rtol=0.0,
                samples=samples,
                parameters=model_params,
                sequence_a=a,
                sequence_b=b)
            elapsed = bench_pair(bench, d)
            print(len(a), len(b), elapsed)
            total_ticks += sum(elapsed)
        print(total_ticks / samples)
        print()
Example #2
0
def main(args):
    align = os.path.realpath(args.exe)
    data_path = os.path.realpath(args.bench_data)
    for name, fin in gen_files(data_path):
        ncanon = 0
        nopt = 0
        k = 0
        for a, b in gen_sequence_pairs(fin, force_acgt=True):
            out, err = align_pair(align, a, b)
            lines = [x.strip() for x in out.splitlines()]
            nlines = len(lines)
            found = False
            for i in range(nlines):
                if lines[i] == 'log_caching_round_up':
                    a_aln = lines[i+1]
                    b_aln = lines[i+2]
                    found = True
                    break
            if not found:
                raise Exception('failed to understand the output')
            js = check_pair(a_aln, b_aln)
            if js['alignment_is_canonical']:
                ncanon += 1
            if js['alignment_is_optimal']:
                nopt += 1
            k += 1
        print(name)
        print('total number of alignments:', k)
        print('number of optimal alignments:', nopt)
        print('number that are also canonical:', ncanon)
        print()
Example #3
0
def main(args):
    align = os.path.realpath(args.exe)
    data_path = os.path.realpath(args.bench_data)
    for name, fin in gen_files(data_path):
        ncanon = 0
        nopt = 0
        k = 0
        for a, b in gen_sequence_pairs(fin, force_acgt=True):
            out, err = align_pair(align, a, b)
            # print(out)
            # print(err)
            lines = [x.strip() for x in out.splitlines()]
            a_aln = lines[2]
            b_aln = lines[3]
            js = check_pair(a_aln, b_aln)
            if js["alignment_is_canonical"]:
                ncanon += 1
            if js["alignment_is_optimal"]:
                nopt += 1
            k += 1
        print(name)
        print("total number of alignments:", k)
        print("number of optimal alignments:", nopt)
        print("number that are also canonical:", ncanon)
        print()
Example #4
0
def main(args):
    data_path = os.path.realpath(args.bench_data)
    model_params = {
            "pa" : rat(27, 100),
            "pc" : rat(24, 100),
            "pg" : rat(26, 100),
            "pt" : rat(23, 100),
            "lambda" : rat(1, 1),
            "mu" : rat(2, 1),
            "tau" : rat(1, 10)}
    for name, fin in gen_files(data_path):
        print(name)
        print('precision={} rtol={}'.format(args.precision, args.rtol))
        sequence_pairs = list(gen_sequence_pairs(fin, force_acgt=True))
        ncanon = 0
        nopt = 0
        k = 0
        for a, b in sequence_pairs:
            j_in = dict(
                parameters=model_params,
                rtol=args.rtol,
                precision=args.precision,
                sequence_a=a,
                sequence_b=b)
            d = runjson([align], j_in)
            j_in = dict(
                parameters=model_params,
                sequence_a=d['sequence_a'],
                sequence_b=d['sequence_b'])
            d = runjson([check], j_in)
            if d['alignment_is_canonical']:
                ncanon += 1
            if d['alignment_is_optimal']:
                nopt += 1
            k += 1
        print('total number of alignments:', k)
        print('number of optimal alignments:', nopt)
        print('number that are also canonical:', ncanon)
        print()