def SuffixArray(text, k): # generate suffix array bwt_genome = sort_matrix(generate_matrix(text)) suffix_array = bwt_genome[SUFFIX_ARRAY] # extract partial suffix array partial_suffix_array = list() for i in xrange(0, len(suffix_array)): if suffix_array[i] % k == 0: partial_suffix_array.append([i, suffix_array[i]]) return partial_suffix_array
results.append(suffix_array[i]) return results input = """AATCGGGTTCAATCGGGGT ATCG GGGT""" correct_answer = "1 4 11 15" split_input = input.split("\n") string = split_input[0] patterns = split_input[1:] bwt_genome = sort_matrix(generate_matrix(string)) suffix_array = bwt_genome[SUFFIX_ARRAY] last_column = extract_last_column(bwt_genome[MATRIX]) first_column = generate_first_column(last_column) first_occurrence = generate_first_occurrence(first_column[FIRST_COLUMN]) count = generate_count(last_column, first_column[COLUMN_TYPE]) results = list() results.extend( MultipleBetterBWMatching( first_occurrence[FIRST_OCCURRENCE], last_column, patterns[0], count, first_column[COLUMN_TYPE], suffix_array