Example Program
Motif Finder
Examples for how to start a motif search using SeqAn's Motif Finder.
File "find_motif.cpp"
A tutorial about motif search.

1 | #include <iostream>
2 | #include "seqan/find_motif.h"
3 |
4 | using namespace seqan;
5 |

Function to output found motifs.

6 | template <typename TMotifFinder>
7 | void printMotifs(TMotifFinder & finder)
8 | {
9 | for (int i = 0; i < (int) motifCount(finder); ++i)
10 | {
11 | ::std::cout << i << ": " << getMotif(finder, i) << ::std::endl;
12 | }
13 | }
14 |
15 | int main()
16 | {
17 | ::std::srand((unsigned) time(NULL));
18 |

Motif search on a small set of nucleotide sequences.

19 | unsigned int t = 3; //number of input sequences
20 | unsigned int n = 6; //length of sequence
21 | unsigned int l = 4; //length of motif
22 | unsigned int d = 1; //number of substitutions
23 | bool is_exact = true; //size of Hamming distance
24 | unsigned int h = 0; //size of the neighborhood considering at first
25 |
26 | String<DnaString> dataset;
27 | appendValue(dataset,DnaString("ACAGCA"));
28 | appendValue(dataset,DnaString("AGGCAG"));
29 | appendValue(dataset,DnaString("TCAGTC"));
30 |

Application of ePatternBranching (h=0)

31 | MotifFinder<Dna, EPatternBranching> finder_epb1(t,l,d,is_exact,h);
32 | findMotif(finder_epb1,dataset,Omops());
33 | ::std::cout << getMotif(finder_epb1) << ::std::endl;
34 |

Application of ePatternBranching (h=0)

35 | MotifFinder<Dna, EPatternBranching> finder_epb2(t,l,d,is_exact,h);
36 | findMotif(finder_epb2,dataset,Oops());
37 | ::std::cout << getMotif(finder_epb2) << ::std::endl;
38 |

Application of Pms1-Zoops

39 | MotifFinder<Dna, Pms1> finder_pms1(l,d,is_exact);
40 | findMotif(finder_pms1,dataset,Zoops());
41 | printMotifs(finder_pms1);
42 |

Application of Pmsp-Tcm

43 | MotifFinder<Dna, Pmsp> finder_pmsp(l,d,is_exact);
44 | findMotif(finder_pmsp,dataset,Tcm());
45 | printMotifs(finder_pmsp);
46 |

Application of PROJECTION-Oops

47 | unsigned int m = t*(n-l+1);
48 | MotifFinder<Dna, Projection> finder_proj(t,l,m,d,is_exact);
49 | findMotif(finder_proj, dataset, Oops());
50 | printMotifs(finder_proj);
51 |

Application of PROJECTION-Omops

52 | MotifFinder<Dna, Projection> finder_proj_omops(t,l,m,d,is_exact);
53 | findMotif(finder_proj_omops, dataset, Omops());
54 | printMotifs(finder_proj_omops);
55 |

Application of PROJECTION-Zoops

56 | MotifFinder<Dna, Projection> finder_proj_zoops(t,l,m,d,is_exact);
57 | findMotif(finder_proj_zoops, dataset, Zoops());
58 | printMotifs(finder_proj_zoops);
59 |

Application of PROJECTION-Tcm

60 | MotifFinder<Dna, Projection> finder_proj_tcm(t,l,m,d,is_exact);
61 | findMotif(finder_proj_tcm, dataset, Tcm());
62 | printMotifs(finder_proj_tcm);
63 |
64 | return 0;
65 | }
66 |

Output
[0]: AGCC
[0]: AGCC
[0]: AAGC
[1]: ACAG
[2]: AGAC
[3]: AGCC
[4]: AGGA
[5]: AGTA
[6]: CAGA
[7]: CAGG
[8]: CCAG
[9]: CGCA
[10]: CGGC
[11]: GCAG
[12]: TCAG
[13]: TGCA
[0]: AAGC
[1]: AAGT
[2]: AATC
[3]: ACAG
[4]: ACGC
[5]: ACTC
[6]: AGAC
[7]: AGCA
[8]: AGCC
[9]: AGGA
[10]: AGGC
[11]: AGGG
[12]: AGGT
[13]: AGTA
[14]: AGTC
[15]: AGTG
[16]: AGTT
[17]: ATGC
[18]: ATTC
[19]: CAAT
[20]: CACT
[21]: CAGA
[22]: CAGC
[23]: CAGG
[24]: CATT
[25]: CCAG
[26]: CCGT
[27]: CGCA
[28]: CGGC
[29]: CGGT
[30]: CGTC
[31]: CTGT
[32]: GAAG
[33]: GACA
[34]: GAGT
[35]: GCAA
[36]: GCAC
[37]: GCAG
[38]: GCAT
[39]: GCCA
[40]: GCCG
[41]: GCGG
[42]: GCTG
[43]: GGAA
[44]: GGAG
[45]: GGCC
[46]: GGCG
[47]: GGCT
[48]: GGGA
[49]: GGGC
[50]: GGTA
[51]: GGTC
[52]: GTAG
[53]: GTCA
[54]: TAAG
[55]: TAGT
[56]: TCAA
[57]: TCAC
[58]: TCAG
[59]: TCAT
[60]: TCCG
[61]: TCGG
[62]: TCTG
[63]: TGAG
[64]: TGCA
[65]: TGGC
[66]: TGTC
[67]: TTAG
AGCC
AGCC
TCAG
TCAG
See
MotifFinder, findMotif
SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2012/03/14 16:34:46