object oriented perl l.
Skip this Video
Loading SlideShow in 5 Seconds..
Object Oriented Perl PowerPoint Presentation
Download Presentation
Object Oriented Perl

Loading in 2 Seconds...

play fullscreen
1 / 27

Object Oriented Perl - PowerPoint PPT Presentation

  • Uploaded on

Object Oriented Perl. Object Oriented Perl. Object Oriented Programming is a common method for encapsulation of code Object Oriented Programming allows you to use very complex methods without ever having to write them or even understand them

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Object Oriented Perl' - niveditha

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
object oriented perl2
Object Oriented Perl
  • Object Oriented Programming is a common method for encapsulation of code
  • Object Oriented Programming allows you to use very complex methods without ever having to write them or even understand them
  • We will cover Object Oriented Perl because BioPerl is written as Object Oriented
object oriented perl3
Object Oriented Perl


  • Object: a collection of data that logically belongs together
  • Method: a subroutine that is associated with an object
  • Class: object definition and the collection of methods available to an object define a class
object oriented perl4
Object Oriented Perl
  • For Example: a Genbank object would be a collection of data that logically belong together
    • sequence
    • accession
    • description
    • features
    • journal reference
  • Objects are often implemented as hashes
object oriented perl5
Object Oriented Perl
  • Class methods are the subroutines that are associated with an object
  • Class methods are the only methods that may be used
  • This makes sure that objects behave as they are intended
  • You don't have to understand the internal workings of a method in order to use it
object oriented perl6
Object Oriented Perl
  • BioPerl is a collection of Classes that are useful for bioinformatics
  • use perldoc to get information about the classes and their methods
  • perldoc Bio::Perl
  • perldoc Bio::Seq
  • perldoc Bio::SeqIO
object oriented perl7
Object Oriented Perl
  • In order to use an Object and its associated methods, you must include a 'use' statement

use Bio::Perl;

go to biotest1.pl

object oriented perl8
Object Oriented Perl
  • Bio::Perl can read sequence files in multiple different formats and interchange them easily
  • For instance: take a GenBank file and convert it to a fasta file

go to biotest2.pl

object oriented perl9
Object Oriented Perl

go to biotest2_1.pl

object oriented perl10
Object Oriented Perl

perldoc Bio::Perl

object oriented perl11
Object Oriented Perl
  • Advantages to reading a library of fasta files with Bio::Perl
  • Don't have to write subs to open files and parse individual entries
  • Don't have to write subs to extract sequence, accession or features
object oriented perl13
Object Oriented Perl
  • Methods are called by invoking the method through the object using the -> operator


$acc = $seq_object->accession_number();

  • accession_number is a method defined in the class Bio::Perl and invoked with the -> operator
object oriented perl15
Object Oriented Perl
  • Note the difference between substring and subseq
  • substr is a perl function that can be called on any string
  • subseq is a Bio::Perl method that can only be called on a Bio::Perl object
  • substr index starts at 0 << typical computer science
  • subseq index starts at 1 << typical for DNA sequences
object oriented perl16
Object Oriented Perl
  • Accessor methods: give the user access to data in an object
  • Get information (call method with no argument)

$acc = $seq_object->accession_number();

  • Set information (call method with argument)


object oriented perl17
Object Oriented Perl
  • Bio::Perl uses LWP to access databases and programs over the web
  • You can get sequences from standard databases like GenBank, EMBL, Swissprot, etc
  • You can run blast searches using Bio::Perl
object oriented perl18
Object Oriented Perl

go to biotest3.pl

object oriented perl19
Object Oriented Perl
  • Bio::Perl Methods

Read one or more sequences from a file

$seq_object = read_sequence($filename);

@seq_object_array =


Get Information about a sequence

$id = $seq_object->display_id();

$acc = $seq_object->accession_number();

$seq = $seq_object->subseq(1,5);

$seq = $seq_object->seq();

object oriented perl20
Object Oriented Perl
  • Bio::Perl Methods

Write a Sequence to a file



Get a Sequence from a Database

$seq_object = get_sequence('swissprot',"ROA1_HUMAN");

$seq_object = get_sequence('embl',"AI129902");

$seq_object = get_sequence('genbank',"AI129902");

object oriented perl21
Object Oriented Perl
  • Bio::Perl Methods

BLAST a sequence

$blast_report = blast_sequence($seq_object);


Sequence mainpulations

$seqobj = translate($seq_or_string_scalar);

$seqstring = translate_as_string($seq_or_string_scalar);

$seqobj = reverse_complement($seq_or_string_scalar);

$string =


object oriented perl22
Object Oriented Perl
  • The Bio::Perl package is written for "people who don't know objects"
  • Syntax and usage are not typical for OO programs
  • Easy to use without much knowledge
  • But limited.
  • Better to learn some OO syntax and use the more sophisticated objects
object oriented perl23
Object Oriented Perl
  • Bio::Seq and Bio::SeqIO are Classes of sequence objects that have many excellent methods
  • To use these classes you also need to include a "use" statement
  • You also need to "instantiate" an object (create an instance of an object)
object oriented perl24
Object Oriented Perl
  • Most objects contain a method called the "constructor".
  • The constructor is used to create new instances of an object
  • Usually the method name for the constructor is "new"
object oriented perl25
Object Oriented Perl
  • Create a sequence object from a file

go to biotest4.pl

object oriented perl26
Object Oriented Perl
  • Create a sequence object from a file
object oriented perl27
Object Oriented Perl
  • The Bio::SeqIO package lets you set up a stream of sequence objects using library files

go to biotest5.pl