Due date: 10/4/16 by 10 am
When you define a function, be sure to test it. You can do so using whatever method you prefer but I encourage you to try several methods during the assignment: 1) Define it in a script and import it into the Python interpretor. 2) Define it in the Python interpretor. 3) Define it in iPython notebook, like we have done in class. 4) Execute it as a script from the command line as we did in class by modifying it with an if name == 'main': statement - required for Exercise 5.
Define a function that determines (by returning True or False) if a DNA sequence contains an EcoRI restriction enzyme recognition site where the enzyme cuts. The recognition sequence for EcoRI is GAATTC.
a. Define a function that returns the sum of 3 numbers.
b. Modify the function in part 2a so that it takes anywhere from 1-3 numbers as arguments.
a. Define a function that prints a polyA tail (a string of As added to the end of an mRNA) of any length passed as an argument to the function (e.g. to produce a string of 8 As, you would multiply 8 * 'A': 8 * 'A' → AAAAAAAA).
b. Write a script that prompts the user for a sequence and then using the function from 3a, adds a polyA tail of a specified length to the sequence and prints the result.
a. Create a module that includes a function that sums 2 numbers and a second function that determines the absolute value of a number, like the one we defined in class.
b. Write a script that prompts a user for two numbers, imports the module from 4a, and by calling the functions from the module, determines the sum of the absolute value of each number, and prints the result. The script should have no more than 7 lines of code (comments don't count).
Create a module that can also act as a standalone program that accepts an argument from the command line.
The function within the module should help the user identify which marker to use on a Western blot depending on the size of their protein of interest as follows:
The function should take as an argument the mass of a protein in kDa.
The return value should be the marker (low_range, high_range, either, or neither).
The two markers available are: 1) a low-range protein marker (e.g. 5-100 kDa) and 2) a high-range protein marker (e.g. 50-250 kDa), but it is possible for the protein to lie outside the range of either marker or within the range of both markers.
When used as a module, the function should return a value but not print anything.
When used as a standalone program, it should print which marker should be used on the gel. Arguments should be supplied at execution from the command line when run as a standalone program.
To submit your assignment, combine the scripts into one text file with each exercise clearly labeled and upload it to Canvas.