Skip to content

Howto: Write a View

Hannes Hauswedell edited this page Feb 27, 2018 · 10 revisions

See Ranges for an explanation of what a view is.

All of these HowTos require:

  • GCC >= 6 or Clang >= 3.7
  • an up-to-date cone of the range-v3 git repository
  • building your apps with -std=c++14 -I/path/to/range-v3/include

Combining existing views

A small tutorial to write basic views as combinations/modifications of existing views. Everyone working on SeqAn3 should understand this.

HowTo write a Small View

Reverse complement view

std::string s{"ACGTTTATGT"};

// make reverse complement view
auto comp_view =                     // TODO: implement
std::cout << comp_view << '\n';      // should print [A,C,A,T,A,A,A,C,G,T]

// create infix from [1, 6)
auto comp_view_inf =                 // TODO: implement
std::cout << comp_view_inf << '\n';  // should print [C,A,T,A,A]

// transform back
auto orig_inf =                      // TODO: implement
std::cout << orig_inf << '\n';       // should print [T,T,A,T,G]

View the HowTo

Translation view

std::string s{"ACGTTTATGTTTACGT"};

auto v =                              // TODO: implement
std::cout << v << '\n';               // should print [T,F,M,F,T,X]

View the HowTo

Tutorial 2 – writing a complete view from scratch

HowTo write a View : An in-depth look at writing complete view implementations. Relevant for people implementing a complete view πŸ˜‰

Clone this wiki locally