Main.Assignment4 History

Hide minor edits - Show changes to markup

February 19, 2010, at 10:26 PM MST by 71.196.160.210 -
Changed line 11 from:

You are looking for matches of substr in the string s that have up to num_mismatches mismatches, and you are to return the index where it occurs, or -1 if it does not.

to:

You are looking for matches of substr in the string s that have up to num_mismatches mismatches, and you are to return the first index where it occurs, or -1 if it does not.

February 15, 2010, at 12:48 PM MST by 10.84.44.68 -
Changed line 26 from:

In addition, each function should include a useful help message that explains what it does, what kind of input it expects, and what it returns.

to:

In addition, each function should include a comment in triple quotes that explains what it does, what kind of input it expects, and what it returns (such comments are used as help messages).

February 15, 2010, at 12:47 PM MST by 10.84.44.68 -
Added lines 23-26:

Submit the programs by email to your instructor. At the top of each file put a comment that identifies you and the program (use a multi-line comment using triple quotes). In addition, each function should include a useful help message that explains what it does, what kind of input it expects, and what it returns.

February 15, 2010, at 12:39 PM MST by 10.84.44.68 -
Changed lines 3-4 from:

String matching allowing mismatches

to:

Due date: February 22nd.

String matching with mismatches

Changed lines 16-24 from:

Put your function in a file called find_with_mismatches.py.

to:

Put your function in a file called find_with_mismatches.py.

Reverse complement

Write a function that receives as input a DNA sequence and computes its reverse complement. For example, the reverse complement of AGTCATG is CATGACT. In computing the reverse complement assume that any character that is not A,C,G, or T is its own complement. Call your function reverse_complement, and put it in a file called reverse_complement.py.

February 15, 2010, at 12:31 PM MST by 10.84.44.68 -
Added lines 1-14:

Assignment 4

String matching allowing mismatches

The find function we wrote in class determines whether a given string is a substring of another string, and returns the first position where they match. Your task is to write a more general function that allows mismatches to occur. The signature of your function should be:

find_with_mismatches(s, substr, num_mismatches)

You are looking for matches of substr in the string s that have up to num_mismatches mismatches, and you are to return the index where it occurs, or -1 if it does not. For example: the string CGCT occurs in AGGTCACTAG when you allow for a single mismatch in index 4. In the context of motif finding this is very useful, since patterns (motifs) in DNA or protein sequences do not always occur in exactly the same way. Searching with mismatches allows us to capture this variability. Further assume that your function is receiving a DNA sequence as input, and that positions that are not either A,C,G, or T in the string your are searching in (s) do not constitute matches.

Put your function in a file called find_with_mismatches.py.