Loading...
Searching...
No Matches
seqan3::align_cfg::method_global Class Reference
Sequence Alignment » Configuration

Sets the global alignment method. More...

`#include <seqan3/alignment/configuration/align_config_method.hpp>`

Inheritance diagram for seqan3::align_cfg::method_global:
[legend]

## Public Member Functions

Constructors, destructor and assignment
| method_global ()=default
| Defaulted.
| method_global (method_global const &)=default
| Defaulted.
| method_global (method_global &&)=default
| Defaulted.
method_global & | operator= (method_global const &)=default
| Defaulted.
method_global & | operator= (method_global &&)=default
| Defaulted.
| ~method_global ()=default
| Defaulted.
constexpr | method_global (seqan3::align_cfg::free_end_gaps_sequence1_leading free_sequence1_leading, seqan3::align_cfg::free_end_gaps_sequence2_leading free_sequence2_leading, seqan3::align_cfg::free_end_gaps_sequence1_trailing free_sequence1_trailing, seqan3::align_cfg::free_end_gaps_sequence2_trailing free_sequence2_trailing) noexcept
| Construct method_global with a specific free end gap configuration.

## Public Attributes

bool | free_end_gaps_sequence1_leading {false}
| If set to true, leading gaps in sequence1 are not penalised when computing the optimal alignment.
bool | free_end_gaps_sequence1_trailing {false}
| If set to true, trailing gaps in sequence1 are not penalised when computing the optimal alignment.
bool | free_end_gaps_sequence2_leading {false}
| If set to true, leading gaps in sequence2 are not penalised when computing the optimal alignment.
bool | free_end_gaps_sequence2_trailing {false}
| If set to true, trailing gaps in sequence2 are not penalised when computing the optimal alignment.

## Detailed Description

Sets the global alignment method.

There are several methods for sequence alignment. We distinguish between local and global alignments. The semi-global alignment is implemented as a variation of the global alignment.

Global Alignment:

--T--CC-C-AGT--TATGT-CAGGGGACACG-A-GCATGCAGA-GAC
| || | || | | | ||| || | | | | |||| |
AATTGCCGCC-GTCGT-T-TTCAG----CA-GTTATG-T-CAGAT--C

Finding the optimal global alignment of two sequences is solved by the Needleman-Wunsch algorithm.

Semi-global Alignment (e.g. overlapping sequences):

TCCCAGTTATGTCAGgggacacgagcatgcagagac
|||||||||||||||
aattgccgccgtcgttttTCCCAGTTATGTCAG

The semi-global alignment is a specially configured global alignment, namely we do not penalize gaps at the ends of the alignment. Semi-global alignments are often used in genome assembly applications when trying to find matching overlaps.

### Example

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <seqan3/alignment/configuration/align_config_method.hpp>
#include <seqan3/alignment/configuration/align_config_scoring_scheme.hpp>
#include <seqan3/alignment/pairwise/align_pairwise.hpp>
#include <seqan3/alignment/scoring/nucleotide_scoring_scheme.hpp>
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/core/debug_stream.hpp>
using namespace seqan3::literals;
int main()
{
// configure a global alignment for DNA sequences
auto min_cfg = seqan3::align_cfg::method_global{}
| seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{seqan3::match_score{4},
seqan3::mismatch_score{-5}}}
| seqan3::align_cfg::gap_cost_affine{seqan3::align_cfg::open_score{-10},
seqan3::align_cfg::extension_score{-1}};
auto seq1 = "TCGT"_dna4;
auto seq2 = "ACGA"_dna4;
for (auto res : seqan3::align_pairwise(std::tie(seq1, seq2), min_cfg))
seqan3::debug_stream << res.score() << '\n'; // print out the alignment score
}
align_config_method.hpp
Provides global and local alignment configurations.
align_config_scoring_scheme.hpp
Provides seqan3::align_cfg::scoring_scheme.
align_pairwise.hpp
Provides pairwise alignment function.
seqan3::align_cfg::gap_cost_affine
A configuration element for the affine gap cost scheme.
Definition align_config_gap_cost_affine.hpp:72
seqan3::align_cfg::method_global
Sets the global alignment method.
Definition align_config_method.hpp:119
seqan3::align_cfg::scoring_scheme
Sets the scoring scheme for the alignment algorithm.
Definition align_config_scoring_scheme.hpp:42
seqan3::nucleotide_scoring_scheme
A data structure for managing and computing the score of two nucleotides.
Definition nucleotide_scoring_scheme.hpp:35
debug_stream.hpp
Provides seqan3::debug_stream and related types.
dna4.hpp
Provides seqan3::dna4, container aliases and string literals.
seqan3::align_pairwise
constexpr auto align_pairwise(sequence_t &&seq, alignment_config_t const &config)
Computes the pairwise alignment for a pair of sequences or a range over sequence pairs.
Definition align_pairwise.hpp:130
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:38
seqan3::literals
The SeqAn namespace for literals.
nucleotide_scoring_scheme.hpp
Provides seqan3::nucleotide_scoring_scheme.
seqan3::align_cfg::extension_score
A strong type of underlying type int32_t that represents the score (usually negative) of any characte...
Definition align_config_gap_cost_affine.hpp:48
seqan3::align_cfg::open_score
A strong type of underlying type int32_t that represents a score (usually negative) that is incurred ...
Definition align_config_gap_cost_affine.hpp:31
seqan3::match_score
A strong type of underlying type score_type that represents the score of two matching characters.
Definition scoring_scheme_base.hpp:38
seqan3::mismatch_score
A strong type of underlying type score_type that represents the score two different characters.
Definition scoring_scheme_base.hpp:63
std::tie
T tie(T... args)

Remarks
  For a complete overview, take a look at Pairwise Alignments.

## Constructor & Destructor Documentation

## method_global()

seqan3::align_cfg::method_global::method_global | ( | seqan3::align_cfg::free_end_gaps_sequence1_leading | free_sequence1_leading,
|  | seqan3::align_cfg::free_end_gaps_sequence2_leading | free_sequence2_leading,
|  | seqan3::align_cfg::free_end_gaps_sequence1_trailing | free_sequence1_trailing,
|  | seqan3::align_cfg::free_end_gaps_sequence2_trailing | free_sequence2_trailing )

inline constexpr noexcept

Construct method_global with a specific free end gap configuration.

Parameters

  [in] | free_sequence1_leading | An instance of seqan3::align_cfg::free_end_gaps_sequence1_leading that indicates whether leading gaps in sequence1 should be free (not penalised).
  [in] | free_sequence2_leading | An instance of seqan3::align_cfg::free_end_gaps_sequence2_leading that indicates whether leading gaps in sequence2 should be free (not penalised).
  [in] | free_sequence1_trailing | An instance of seqan3::align_cfg::free_end_gaps_sequence1_trailing that indicates whether trailing gaps in sequence1 should be free (not penalised).
  [in] | free_sequence2_trailing | An instance of seqan3::align_cfg::free_end_gaps_sequence2_trailing that indicates whether trailing gaps in sequence2 should be free (not penalised).

The documentation for this class was generated from the following file:

- align_config_method.hpp

Hide me