Homework 2 Homeworks should be submitted as follows: A text file with all the solutions fully annotated and explained. Separate program files for each piece of code. Homework should be submitted electronically to your TA and to myself. The subject line of the email should be “BioE142 Home #2”. 1) A bubble sort. A bubble sort is an algorithm for sorting objects in an array. It works by starting at the second element of the array. This element is compared to the one above it if it is less than the one above it then the two are swapped. Going back to the third element, it is compared in turn to the second element and if less, swapped. If swapped, then do the same for the second element and so on. In the end you get a list sorted in ascending order. and comparing the nth last object to the ones above it until. Write a bubble sort routine that can sort an array of arbitrary data in place based on being passed the array itself and another subroutine to compare two elements in the array. Document your program carefully as well as the API for the compare subroutine. Demonstrate it with an array of numbers and an array of scalar strings. 2) Objects. a) Write a protein sequence object that has object variables “sequence” and “annotation” and object methods, “print” that prints it out, “composition” that calculates the percent of each amino acid in the sequence, “cut” that takes a regular expression and returns the fragments that would result from cutting the sequence at matching substrings in an array. b) Add a Needleman-Wunsch alignment routine that compares the object’s sequence to that passed into the routine within another sequence object. c) Does it make sense to place the alignment algorithm into the sequence object? What does BioPERL do? 3) Write a program using BioPERL to download a GenBank record specified by some database ID on the command line. The type of ID should be specified using a command line flag—For example: “GetGenBank –a AF303112” for getting a record by its accession number. Have the program print out as much of the data it got back as possible.