File: concatenated_sequences.cpp

package info (click to toggle)
seqan3 3.0.2%2Bds-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 16,052 kB
  • sloc: cpp: 144,641; makefile: 1,288; ansic: 294; sh: 228; xml: 217; javascript: 50; python: 27; php: 25
file content (32 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download
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
#include <vector>

#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/core/debug_stream.hpp>
#include <seqan3/range/container/concatenated_sequences.hpp>

int main()
{
    using seqan3::operator""_dna4;

    seqan3::concatenated_sequences<seqan3::dna4_vector> concat1{"ACGT"_dna4, "GAGGA"_dna4};
    seqan3::debug_stream << concat1[0] << '\n'; // "ACGT"

    std::vector<seqan3::dna4_vector> concat2{"ACTA"_dna4, "AGGA"_dna4};

    concat1 = concat2;               // you can assign from other ranges

    concat2[0] = "ATTA"_dna4;        // this works for vector of vector
    concat1[0][1] = 'T'_dna4;        // and this works for concatenated_sequences
    seqan3::debug_stream << concat1[0] << '\n'; // "ATTA"

    // if you know that you will be adding ten vectors of length ten:
    std::vector<seqan3::dna4> vector_of_length10{"ACGTACGTAC"_dna4};

    concat1.reserve(10);
    concat1.concat_reserve(10 * vector_of_length10.size());
    while (concat1.size() < 10)
    {
        // ...
        concat1.push_back(vector_of_length10);
    }
}