File: align_pairwise.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 (48 lines) | stat: -rw-r--r-- 1,526 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//![start]
#include <vector>

#include <seqan3/alignment/configuration/align_config_edit.hpp>
#include <seqan3/alignment/pairwise/align_pairwise.hpp>
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/core/debug_stream.hpp>

int main()
{
    using seqan3::operator""_dna4;
//![start]

    // Configure the alignment kernel.
    auto config = seqan3::align_cfg::method_global{} | seqan3::align_cfg::edit_scheme;

    {
    //![example1]
    std::pair p{"ACGTAGC"_dna4, "AGTACGACG"_dna4};
    auto result = seqan3::align_pairwise(p, config);
    //![example1]
    }

    {
    //![example2]
    std::vector vec{"ACCA"_dna4, "ATTA"_dna4};
    auto result = seqan3::align_pairwise(std::tie(vec[0], vec[1]), config);
    //![example2]
    }

    //![example3]
    std::vector vec{std::pair{"AGTGCTACG"_dna4, "ACGTGCGACTAG"_dna4},
                    std::pair{"AGTAGACTACG"_dna4, "ACGTACGACACG"_dna4},
                    std::pair{"AGTTACGAC"_dna4, "AGTAGCGATCG"_dna4}};

    // Compute the alignment of a single pair.
    auto edit_config = seqan3::align_cfg::method_global{} | seqan3::align_cfg::edit_scheme;

    for (auto const & res : seqan3::align_pairwise(std::tie(vec[0].first, vec[0].second), edit_config))
        seqan3::debug_stream << "The score: " << res.score() << "\n";

    // Compute the alignment over a range of pairs.
    for (auto const & res : seqan3::align_pairwise(vec, edit_config))
        seqan3::debug_stream << "The score: " << res.score() << "\n";
    //![example3]
//![end]
}
//![end]