Introduction to Bioinformatics

Practice with Subroutines and Regular Expressions in Perl


Prep readings:

In this assignment, we wish to:


Getting More Practice

  1. First, begin reading the pages of Chapters 5-6 indicated above. As you encounter example code, execute the Perl programs provided.
  2. Next, download and review the two new versions of the vowel counting program provided above. Run the programs and observe what happens. Carefully review the files and all the commenting within them. The program vowels5.pl provides your first example of using simple subroutines, where there is at most one variable passed to/from a subroutine. The program vowels6.pl provides an additional example of using subroutines, where multiple variables are passed to/from a subroutine.
  3. Compare the code in both vowels5.pl and vowels6.pl to vowels4.pl from the previous assignment. What code in the new files adds the functionality of looping the menu until the user chooses to exit? What code corresponds to an example of a "subroutine call"? Similarly, what code corresponds to an example of a "subroutine body"?
  4. Note that these files show you the type of formatting and modularity that is expected in future code you submit for this class. Consider how modularity could clean up the code you have already developed in your nucleotide-counting2.pl program. What code do you tend to repeat across options that might make sense to put into a subroutine?

Getting Credit for Your Progress

To get credit for this assignment, your program must meet several additional specifications in a new program called nucleotide-counting3.pl, as follows:
  1. Your program must redisplay the menu after each menu option is acted upon, until the user enters the option to exit the program. Test this version of your program before you add any additional functionality.
  2. Your program must contain and call a subroutine to count nucleotides in the provided sequence, and indicate the count of any errors encountered. Again, test this version before you move on.
  3. Your program must contain and call a subroutine to write results to an output file, with the name of the file provided by the user. Test your new code before continuing to the next step.
  4. As you are modifying your code, make sure you make it readable. Again, a good way to get a handle on the overall readability of your program is to print out multiple pages on a sheet of paper. In Notepad you can do this by selecting Print-Preferences and then selecting 2 or 4 under "Pages Per Sheet". Click "OK", then "Print." Study the overall structure of your program and specifically double-check that you have been consistent with indentation.
  5. Next, your program must include a new menu option to search for a motif provided by the user. This will be the new "Option 3" in your code, and a new "Option 4" will be used for exiting. Before adding this functionality, complete these additional steps:
  6. Include a link to your new Perl program on your course Webpage, under a heading titled, "Lab: Practice with Subroutines and Regular Expressions (includes motif searching)."
  7. Finally, visit the opening page of PROSITE and then click on the words "MotifScan." Review the documentation and directions on these pages and then perform several scans. How does the output provided by their program compare to your program? Does this Website provide any ideas for how your program could be improved? To get credit for this portion of the assignment, on your course Webpage, provide a brief paragraph summarizing your experience with this site and answer these questions.
Feel free to work with other students in the class if you struggle with any parts of the assignments. Also, bring questions to class next week, and if we need to cover material in class and work through items together, we can!
These pages are optimized for viewing under Netscape.
© Copyright 2003. Melanie A. Sutton, Ph.D. (msutton@uwf.edu) All rights reserved.