(Q, T, p, excl_zone, max_distance)
| 20 | |
| 21 | |
| 22 | def naive_aamp_match(Q, T, p, excl_zone, max_distance): |
| 23 | m = Q.shape[0] |
| 24 | D = naive.aamp_distance_profile(Q, T, m, p) |
| 25 | |
| 26 | # Finds all indices that have a lower distance profile value `D` |
| 27 | # than `atol + rtol * D` |
| 28 | matches = [] |
| 29 | for i in range(D.size): |
| 30 | dist = D[i] |
| 31 | if dist <= max_distance: |
| 32 | matches.append(i) |
| 33 | |
| 34 | # Removes indices that are inside the exclusion zone of some occurrence with |
| 35 | # a smaller distance to the query |
| 36 | matches.sort(key=lambda x: D[x]) |
| 37 | result = [] |
| 38 | while len(matches) > 0: |
| 39 | o = matches[0] |
| 40 | result.append([D[o], o]) |
| 41 | matches = [x for x in matches if x < o - excl_zone or x > o + excl_zone] |
| 42 | |
| 43 | return np.array(result, dtype=object) |
| 44 | |
| 45 | |
| 46 | def test_aamp_motifs_one_motif(): |
no outgoing calls
no test coverage detected