-------------------------------------

**Do problem 3 or 4 but not both.** (Or get a bonus if you do both). If you pick 3 you have to do both 3a and 3b.

Your submission should include:

a. Source code.

b. A text file containing brief instructions on how to compile and execute your programs.

c. A brief report of your experimental results.

-------------------------------------

**1.** (15 points) Write a program that takes as input an alignment, and outputs the PWM and the information content of the PWM. Apply your program on the following alignment and report the results. Also use the web tool enoLogos to compute the sequence logo. Make sure you set %GC to "equiprobable". Click on textout to check the probability matrix and information content there. Do they match your results?

GTGTAGC

GTGTTGT

GGGTTGC

GTGTAGC

GTGCTGC

GTGTAGC

TTGTTGC

GTGTAGC

ATGTTGC

GTGGTGC

GTGTTCC

GCGTTGC

GTGTTAC

GCGTTGC

GTGCTGC

GTTTTGC

TTGTTGC

GTCTTGC

GTGATGC

GTGTTGA

**2.** (15 points) Write a program that takes as input a set of input sequences and a PWM, and outputs the best matches from each sequence. Report both the locations of the matches and the matched subsequences.

Apply your program to the input sequences in this file and the PWM you computed above.

(You can verify your results using the program you developed in 1: try to get a new PWM using the matched subsequences - does it look similar to your input PWM?)

**3.** (30 points) Combinatorial motif finding (optional: pick 3 or 4. If you pick 3 you have to do both 3a and 3b).

3a. Implement the sample-based motif finding algorithm (slide #35). Your program should take as input a set of sequences and a parameter k (motif length), and output the consensus with the smallest total number of mismatches to all sequences. Your program should also report the total number of mismatches, the matched subsequences and locations on each sequence, and the amount of CPU time taken by your program to find the consensus.

Apply your program to the input sequences in this file, with k = 7. Also try k = 9. Report both the consensus and the sequence logo.

3b. Repeat problem 3a with the pattern-based motif finding algorithm (slide #34).

**4.** (30 points) Probabilistic motif finding (optional: pick 3 or 4).

Utilize the code you wrote for 1 and 2 to implement a Viterbi-like probabilisic motif finding algorithm (i.e., always pick the locations with the best matches to the current PWM as your next set of starting points). Do the same experiment as in 3.

**5.** (Bonus, 10 points) download the following program to generate some synthetic data sets and try your programs developed in 3 or 4 and report the results.

Usage: java -cp motifGen.jar model.MotifGen -L *SeqLen* -n *nSeqs* -l *motifLen* -d *nMismatches* -e | java -cp motifGen.jar util.FastaOneLine > *outputFile*

You can replace the parameters with, for example: SeqLen = 200, nSeqs = 20, motifLen = 7, *nMismatches* = 1. These are the parameters I used to generate the test file for 3 and 4. For more challenging test case you can choose seqLen = 600, nSeqs = 20, motifLen = 11, nMismatches = 2.