Bioperl Training Exercise 10

From BITS wiki
Jump to: navigation, search
  • In aggregation, an object contains a reference to another object, e.g. an attribute of the object is a reference to another object. In this exercise, bioperl comes into the picture. Make changes to BITS::Training::Primer and use a Bio::Seq object as attribute to store primer sequence information. Have a look at the Bio::Seq constructor in perldoc.
  • Delegation is the simple concept of an object handing the task to another object. Use delegation in the getLength() method.
  • Also add a method to fetch the embedded sequence object, say getSeqObject().


  • OK, now we have created an issue because if you can lay your hands on the embedded Bio::Seq object, it is possible to change the sequence itself and thus the primer sequence. We do not want that, we want to make the primer sequence immutable: new sequence = new primer. A trick that is often used to prevent tampering with an embedded object is simply to create a deep copy of the embedded object and return that instead of the original. The consumer may make changes to the object at wish, the primer object will not be changed.
    Use the FreezeThaw module and make the appropriate changes in the getSeqObject() to return a copy. Alternatively, have a look at the available methods that a Bio::Seq object can call. There is an inherited method available that does just that.


  • At this point, Tm calculation is not dealing with degeneracy. Create a method to return a list of all possible non-degenerate primers, say getUniquePrimers(). perldoc Bio::Tools::IUPAC.
  • Adjust getTm() in such way that the mean Tm is returned.