File: extend_alignment.cpp

package info (click to toggle)
seqan2 2.4.0%2Bdfsg-16
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 224,180 kB
  • sloc: cpp: 256,886; ansic: 91,672; python: 8,330; sh: 995; xml: 570; makefile: 252; awk: 51; javascript: 21
file content (54 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>

#include <seqan/align.h>
#include <seqan/align_extend.h>
#include <seqan/sequence.h>

using namespace seqan;

int main()
{
    Score<int> sc(2, -1, -2);

    Align<Infix<CharString const>::Type> align;
    resize(rows(align), 2);

    // We create the following initial situation with subject/query and the
    // infixes thereof.
    //
    //                         infixes/seeds
    //                             <-->
    // subject  NNNNNNNNNNTTCCGGGACGGTACACACACGGGGGGGGGG
    // query               CTCGGGACGGTACAGGCACGGTTTTTTTT
    CharString subject = "NNNNNNNNNNTTCCGGGACGGTACACACACGGGGGGGGGG";
    CharString query   = "CTCGGGACGGTACAGGCACGGTTTTTTTT";
    assignSource(row(align, 0), infix(subject, 19, 23));
    assignSource(row(align, 1), infix(query, 8, 12));
    int score = globalAlignment(align, sc);

    std::cout << "Initial alignment of infixes (score == " << score << ")\n\n"
              << align;

    // The alignment starts at diagonal (23 - 19) = 4.  A band of 4 in each direction has
    // the following diagonals.
    int lDiag = 0, uDiag = 8;
    // Set the x-Drop value to 5.
    int xDrop = 5;
    Tuple<unsigned, 4> positions = { {19u, 8u, 23u, 12u} };
    score = extendAlignment(align, score, subject, query, positions, EXTEND_BOTH,
                            lDiag, uDiag, xDrop, sc);

    std::cout << "Resulting alignment (score == " << score << ")\n\n"
              << align;

    std::cout << "source(row(align, 0)) == " << source(row(align, 0)) << " (full sequence)\n"
              << "source(row(align, 1)) == " << source(row(align, 1)) << " (full sequence)\n"
              << "\n"
              << "clipping positions of row 0: " << clippedBeginPosition(row(align, 0))
              << ", " << clippedEndPosition(row(align, 0)) << "\n"
              << "clipping positions of row 1: " << clippedBeginPosition(row(align, 1))
              << ", " << clippedEndPosition(row(align, 1)) << "\n";


    return 0;
}