Example Program
Maximal Unique Matches
Example for using the MUMs Iterator.
Given a set of sequences, a unique match is a match that occurs exactly once in each sequence.
A maximal unique match (MUM) is a unique match that is not part of any longer unique match. The following
example demonstrates how to iterate over all MUMs and output them.
File "index_mums.cpp"
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 |
We begin with a StringSet that stores multiple strings.
9 | |
10 | |
11 | |
12 | |
13 | |
14 |
15 | |
16 | |
17 |
To find maximal unique matches (MUMs), we use the MUMs Iterator
and set the minimum MUM length to 3.
18 | |
19 | |
20 | |
21 | |
22 |
A multiple match can be represented by positions it occurs at in every sequence
and its length. getOccurrences returns an unordered sequence of pairs
(seqNo,seqOfs) the match occurs at.
23 |
To order them ascending according seqNo we use orderOccurrences.
24 | |
25 | |
26 | |
27 | |
28 |
repLength returns the length of the match.
29 | |
30 |
The match string itself can be determined with representative.
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 |
Output
The only maximal matches that occur in all 3 sequences are "SeqAn" and "sequence" .
They occur exactly once and thus are maximal unique matches.
weese@tanne:~/seqan/demos$ make index_mums
weese@tanne:~/seqan/demos$ ./index_mums
0, 53, 33, 5 "SeqAn"
23, 36, 3, 8 "sequence"
weese@tanne:~/seqan/demos$
SeqAn - Sequence Analysis Library - www.seqan.de