File: ConsensusAlignment.rst

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 (71 lines) | stat: -rw-r--r-- 2,525 bytes parent folder | download | duplicates (9)
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
62
63
64
65
66
67
68
69
70
71
.. sidebar:: ToC

    .. contents::

.. _tutorial-algorithms-consensus-alignment:

Consensus Alignment
===================

Learning Objective
  You will learn how to perform a consensus alignment of sequences (e.g. NGS reads) stored in a FragmentStore.
  After completing this tutorial, you will be able to perform a consensus alignment of reads with and without using alignment information.
  This is useful for the consensus step in sequence assembly.

Difficulty
  Advanced

Duration
  1 h

Prerequisites
  :ref:`tutorial-datastructures-store-fragment-store`

The SeqAn module ``<seqan/consensus.h>`` allows the computation of consensus alignments based on the method by Rausch et al. :cite:`Rausch2009`.
It can be used for the consensus step in Overlap-Layout-Consensus assemblers.

Consensus with Approximate Positions
------------------------------------

The consensus module has two modes.
The first one is applicable when approximate positions of the reads are known.
The following program demonstrates this functionality.

First, we include the necessary headers.

.. includefrags:: demos/tutorial/consensus_alignment/with_positions.cpp
   :fragment: includes

Next, the fragment store is filled with reads and approximate positions.
The true alignment is shown in the comments.

.. includefrags:: demos/tutorial/consensus_alignment/with_positions.cpp
   :fragment: fill_store

This is followed by computing the consensus alignment using the function :dox:`consensusAlignment`.

.. includefrags:: demos/tutorial/consensus_alignment/with_positions.cpp
   :fragment: compute_consensus

Finally, the alignment is printed using an :dox:`AlignedReadLayout` object.

.. includefrags:: demos/tutorial/consensus_alignment/with_positions.cpp
   :fragment: print_layout

Here is the program's output:

.. includefrags:: demos/tutorial/consensus_alignment/with_positions.cpp.stdout

Consensus without Approximate Positions
---------------------------------------

When setting the ``useContigID`` member of the :dox:`ConsensusAlignmentOptions` object to ``false`` then we can also omit adding approximate positions for the reads.
In this case, the consensus step performs an all-to-all alignment of all reads and then computes a consensus multi-read alignment for all of them.
This is demonstrated by the following program.


.. includefrags:: demos/tutorial/consensus_alignment/without_positions.cpp

Here is this modified programs' output:

.. includefrags:: demos/tutorial/consensus_alignment/without_positions.cpp.stdout