| Example Program Longest Common Subsequence Longest common subsequence code example File "graph_algo_lcs.cpp" A tutorial about the longest common subsequence algorithm.
1 | #include <iostream>
2 | #include <seqan/graph_algorithms.h>
3 | #include <seqan/graph_align.h>
4 |
5 | using namespace seqan;
6 |
7 | int main() {
Create two sequences
8 | String<char> seq1("abacx");
9 | String<char> seq2("baabca");
10 | typedef StringSet<String<char>, Dependent<> > TStringSet;
11 | TStringSet string_set;
12 | appendValue(string_set, seq1);
13 | appendValue(string_set, seq2);
14 | Graph<Alignment<TStringSet> > alignment_graph(string_set);
Compute the longest common subsequence
15 | ::std::cout << "Score = " << globalAlignment(alignment_graph, Lcs()) << ::std::endl;
16 | ::std::cout << alignment_graph << ::std::endl;
17 | return 0;
18 | }
See Graph, longestCommonSubsequence SeqAn - Sequence Analysis Library - www.seqan.de