File: with_positions.cpp

package info (click to toggle)
seqan2 2.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 228,748 kB
  • sloc: cpp: 257,602; ansic: 91,967; python: 8,326; sh: 1,056; xml: 570; makefile: 229; awk: 51; javascript: 21
file content (61 lines) | stat: -rw-r--r-- 2,380 bytes parent folder | download | duplicates (2)
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
55
56
57
58
59
60
61
//![includes]
#include <iostream>

#include <seqan/store.h>
#include <seqan/consensus.h>

using namespace seqan2;

int main()
{
//![includes]
//![fill_store]
    FragmentStore<> store;
    // Resize contigStore and contigNameStore (required for printing the first layout).
    resize(store.contigStore, 1);
    appendValue(store.contigNameStore, "ref");

    // Actual read layout.
    //
    // AATGGATGGCAAAATAGTTGTTCCATGAATACATCTCTAAAGAGCTTT
    //           AAAATAGTTGTTCCATGAATACATCTCTAAAGAGCTTTGATGCTAATTT
    //                AGTTGTTCCATGAATACATCTCTAAAGAGCTTTGATGCTAATTTAGTCAAATTTTCAATACTGTA
    //                               ACATCTCTAAAGAGCTTTGATGCTAATTTAGTCAAATT
    //                                         AGAGCTTTGATGCTAATTTAGTCAAATTTTCAATACTGTACAATCTTCTCTAG

    // Append reads (includes small errors).
    appendRead(store, "AATGGATGGCAAAATAGTTGTTCCATGAATACATCTCTAAAGAGCTTT");
    appendRead(store, "AAAGTAGTTGTTCCATGAATACATCTCTAAAGAGCTTTGATGCTAATTT");
    appendRead(store, "AGTTGTCCATGAATACATCTCTAAAGAGCTTTGATGCTAATTTAGTCAATTTTCAATACTGTA");
    appendRead(store, "ACATCTCTTAAAGAGCTTTGATGCTAATTTAGTCAAATT");
    appendRead(store, "AGAGCTTTGATGCTAATTTAGTCAAATTTTCAATACTGTACAATCTTCTCTAG");

    // The position used in the following are only approximate and would
    // not lead to the read layout above.
    appendAlignedRead(store, 0, 0, 0, (int)length(store.readSeqStore[0]));
    appendAlignedRead(store, 1, 0, 12, 12 + (int)length(store.readSeqStore[1]));
    appendAlignedRead(store, 2, 0, 14, 14 + (int)length(store.readSeqStore[2]));
    appendAlignedRead(store, 3, 0, 18, 18 + (int)length(store.readSeqStore[3]));
    appendAlignedRead(store, 4, 0, 25, 25 + (int)length(store.readSeqStore[4]));

    // Print the (wrong) alignment.
    std::cout << "Initial alignment\n\n";
    AlignedReadLayout layout;
    layoutAlignment(layout, store);
    printAlignment(std::cout, layout, store, /*contigID=*/ 0, /*beginPos=*/ 0, /*endPos=*/ 80, 0, 30);
//![fill_store]

//![compute_consensus]
    ConsensusAlignmentOptions options;
    options.useContigID = true;
    consensusAlignment(store, options);
//![compute_consensus]

//![print_layout]
    std::cout << "Final alignment\n\n";
    layoutAlignment(layout, store);
    printAlignment(std::cout, layout, store, /*contigID=*/ 0, /*beginPos=*/ 0, /*endPos=*/ 80, 0, 30);

    return 0;
}
//![print_layout]