Some guidelines and help for you:

1) Do good print outs – not too much and not too less, so that somebody can follow the code in an easy way, what is going on.

2) Do error handling e.g. what is the “else” case ? What can happen additionally ? Do an exit of the program where necessary e.g. if important pre-conditions for the program are not met.

3) Write inline functions/constructors/destructors for small functions.

4) Comment your code.

5) Design your functions, so that they are not too big. Optimal is that you can see on one screen, what is going on. If the function gets too big use other functions, design them so that they could be reused by possible other parts of the program. Design those “helper functions” so that they show certain functionality of the main program, not just arbitrary parts of the main function. Think, what is the input, processing part and the output of your function.

6) If you name your own variables and functions, name them reasonable short, but recognizable for what purpose they are.

7) IDENT your code properly e.g.

function file_parser(…) {

for (…) {

code …



ident with tabs. vim does this by default. You can also ident your file afterwards with Shift-0 in vim. Create a .vimrc in your home dir with

:set autoindent
:set cindent

8) The class: Image the class you design has input, processing and output. What are the input functions, what processing and what output functions. This unit input, processing and output of the class with its functions can be called a flow.

Exercise 1:


When you create a pointer, it points to an arbitrary address. Keep that in mind. When you allocate space, you have to have at any time at least one pointer on that memory space !

2 f) the recursive hash structure is accessing something like a[from_node][to_node].push_back(weight).

3 c) the GDF GUESS file format is the format. the following simplifications can be made: nodes are integers from 0 to n-1


Exercise 2:

The main routine (in sfg.cpp) can look like

int main(int argc, char *argv[])
int exitcode = 0;


int mainfunc(int argc, char** argv) {

// here is your actual main code


You can use shared pointer to shared memory.

You have to lock access to the shared pointer.


Exercise 3:

Task 1:Look at the command line parsing of on Look at the way wants to have its input files, what input files in what order. In 1 c) use the element functions in your switch cases of get_opts. See, what the command line parameters mean.

e.g. reads.fa genome.fa reads_vs_genome.arf mautre_ref_miRNAs.fa mature_other_miRNAs.fa  hairpin_ref_miRNAs -t Mouse


Task 2 + 3:

Several sequences should be allowed. Think, that you are having different arf, fa files as input, that should be put in different subclasses/substructures, because each file has a purpose. e.g. the “reads” file contains deep sequences in fasta format. Output fa files could output a set of files.