Example Program
Longest Common Subsequence
Longest common subsequence code example
A tutorial about the longest common subsequence algorithm.
1#include <iostream>
2#include <seqan/graph_algorithms.h>
3#include <seqan/graph_align.h>
4
5using namespace seqan;
6
7int 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}
SeqAn - Sequence Analysis Library - www.seqan.de