File: example_functionality.cpp

package info (click to toggle)
seqan2 2.4.0%2Bdfsg-8~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 223,616 kB
  • sloc: cpp: 256,884; ansic: 91,671; python: 8,339; sh: 995; xml: 570; makefile: 242; awk: 51
file content (30 lines) | stat: -rw-r--r-- 752 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
//![appendValue]
#include <seqan/sequence.h>
#include <seqan/stream.h>

using namespace seqan;

int main()
{
    StringSet<DnaString> stringSet;
    DnaString str0 = "TATA";
    DnaString str1 = "CGCG";
    appendValue(stringSet, str0);
    appendValue(stringSet, str1);
//![appendValue]
//![retrieve_id]
    // (1) Access by position
    std::cout << "Owner: " << '\n';
    std::cout << "Position 0: " << value(stringSet, 0) << '\n';

    // Get the corresponding ids
    unsigned id0 = positionToId(stringSet, 0);
    unsigned id1 = positionToId(stringSet, 1);

    // (2) Access by id
    std::cout << "Id 0:  " << valueById(stringSet, id0) << '\n';
    std::cout << "Id 1:  " << valueById(stringSet, id1) << '\n';

    return 0;
}
//![retrieve_id]