CS 5263 & 4233 Midterm Project - Motif Finding

Electronic submission due Friday 11:59pm, March 24, 2017.


For problem 3 or 4, at least one is required. If you do problem 3 you should 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 results.


1. (15 points) Write a program that takes as input an alignment, and outputs the PWM and the information content of the PWM. To prevent prob = 0 from happening, add a pseducount 1 for each nucleotide. i.e., p_A = (c_A + 1) / (c_A + c_C + c_G + c_T + 4), where c_A is the number of A's observed in the column. (It is best to implement the main functionality as a function so that you can reuse it in Problem 4 or possibly also Problem 3.) 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?


2. (25 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. (Again, it is best to implement the main functionality as a function so that you can reuse it in Problem 4 or Problem 3.)

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 Problem 1: try to get a new PWM using the matched subsequences - does it look similar to your input PWM?)

3. (40 points) Combinatorial motif finding.

(a). 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 wall-clock 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.

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

4. (40 points) Probabilistic motif finding.

Utilize the code you wrote for 1 and 2 to implement a Viterbi-like probabilistic 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 Problem 3.

5. (Bonus, 10-50 points) download the following program to generate some synthetic data sets and try your programs developed in Problem 3 and/or 4, and report the results. Submissions will be graded based on comprehensiveness of results and discussion.

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.

For debugging, generate some simpler test cases using motifLen = 7 and nMismatches = 0 or motifLen = 9 and nMismatches = 1, or turning off the flag "-e".