exit(-1) task = sys.argv[3] fasta_file = FASTA(sys.argv[1]) fasta_file.read() alphabet = list(set(fasta_file.data)) alphabet.sort() tree = WaveletTree() tree.build(alphabet, fasta_file.data) if task == 'access': index = int(sys.argv[4]) result = tree.access(index) elif task == 'rank': position = int(sys.argv[4]) character = sys.argv[5] result = tree.rank(position, character) elif task == 'select': nth_occurence = int(sys.argv[4]) character = sys.argv[5] result = tree.select(nth_occurence, character) elif task == 'build': result = 'OK' # Save result to out file
exit(-1) task = sys.argv[3] fasta_file = FASTA(sys.argv[1]) fasta_file.read() alphabet = list(set(fasta_file.data)) alphabet.sort() tree = WaveletTree() tree.build(alphabet, fasta_file.data) if task == 'access': index = int(sys.argv[4]) result = tree.access(index) elif task == 'rank': position = int(sys.argv[4]) character = sys.argv[5] result = tree.rank(position, character) elif task == 'select': nth_occurence = int(sys.argv[4]) character = sys.argv[5] result = tree.select(nth_occurence, character) elif task == 'build': result = 'OK' # Save result to out file
if sys.argv[2] == 'query': data_size = len(fasta_file.data) test_idx = data_size / 2 test_character = fasta_file.data[0] test_nth_occurence = math.floor(math.sqrt(test_idx)) test_runs = int(sys.argv[3]) stopwatch = Utils.Stopwatch() time_access = 0 time_select = 0 time_rank = 0 for i in xrange(test_runs): # Access stopwatch.restart() stopwatch.start() tree.access(test_idx) stopwatch.stop() time_access = time_access + stopwatch.elapsed_ms() # Select stopwatch.restart() stopwatch.start() tree.select(test_nth_occurence, test_character) stopwatch.stop() time_select = time_select + stopwatch.elapsed_ms() stopwatch.restart() # Rank stopwatch.start() tree.rank(test_idx, test_character) stopwatch.stop()
if sys.argv[2] == 'query': data_size = len(fasta_file.data) test_idx = data_size / 2 test_character = fasta_file.data[0] test_nth_occurence = math.floor(math.sqrt(test_idx)) test_runs = int(sys.argv[3]) stopwatch = Utils.Stopwatch() time_access = 0 time_select = 0 time_rank = 0 for i in xrange(test_runs): # Access stopwatch.restart() stopwatch.start() tree.access(test_idx) stopwatch.stop() time_access = time_access + stopwatch.elapsed_ms() # Select stopwatch.restart() stopwatch.start() tree.select(test_nth_occurence, test_character) stopwatch.stop() time_select = time_select + stopwatch.elapsed_ms() stopwatch.restart() # Rank stopwatch.start() tree.rank(test_idx, test_character) stopwatch.stop()