1 // FRAGMENT(includes)
2 #include <iostream>
3 #include <seqan/find_motif.h>
4
5 using namespace seqan;
6
7 // FRAGMENT(typedefs)
main()8 int main()
9 {
10 typedef MotifFinder<char, Projection> TMotifFinder;
11 typedef String<CharString > TString;
12 typedef Size<TString>::Type TSize;
13
14 // FRAGMENT(sequences)
15 TString dataset;
16 appendValue(dataset, CharString("hatpins"));
17 appendValue(dataset, CharString("low-fat"));
18 appendValue(dataset, CharString("habitat"));
19 TSize seqCount = length(dataset);
20
21 // FRAGMENT(initialization)
22 ::std::srand((unsigned) time(NULL));
23
24 TSize seqLength = length(dataset[0]); // length of sequences
25 TSize motifLength = 3; // length of motif
26 TSize mm = 1; // number of mismatches
27 bool is_exact = true; // occurences of motif need to have exactly mm mismatches
28 TSize numPos = seqCount * (seqLength - motifLength + 1);
29
30 TMotifFinder finder_proj(seqCount, motifLength, numPos, mm, is_exact);
31
32 // FRAGMENT(search)
33 findMotif(finder_proj, dataset, Oops());
34
35 for (int i = 0; i < (int) motifCount(finder_proj); ++i)
36 std::cout << i << ": " << getMotif(finder_proj, i) << ::std::endl;
37
38 return 0;
39 }
40
41