Bioperl is
• A Set of Perl modules for manipulating genomic and other biological data
• An Open Source Toolkit with many contributors
• A flexible and extensible system for doing bioinformatics data manipulation
Bioperl documentation
1. Bioperl tutorial:
http://www.bioperl.org/wiki/Bptutorial.pl
(you also can run this from the command line perl -w Bptutorial.pl, or read it via perldoc bio::searchIO )2. Mastering Perl for Bioinformatics: Introduction to bioperl (recommended)
http://www.oreilly.com/catalog/mperlbio/chapter/ch09.pdf
3. Bioperl documentation
http://www.bioperl.org/Core/Latest/modules.html
4. Modules listing.
http://doc.bioperl.org/releases/bioperl-1.4/
5. Unix help: man and perldoc.
(e.g. perldoc bio::searchIO)
Object-oriented programming
Abstract Data Types
Implementation of Abstract Data Types
class BioinformaticClass {
attributes:
@students=('Anan', 'John', 'Maria', 'Jack');$teacher='Peter';
%grades=('Ana'=>'good','John'=>'moderate',
'Maria' =>'excellent'
'Jack' => 'satisfactory');
methods:
setGrade(student);
getGrade(student);addStudent;
removeStudent;
}
An object is an instance of a class.
Example 1use Bio::SearchIO;# create a new object my $in = new Bio::SearchIO(-format => 'blast', -file => 'report.blast');# iterate through resultswhile( my $result = $in->next_result ) { while( my $hit = $result->next_hit ) { while( my $hsp = $hit->next_hsp ) { if( $hsp->length('total') > 100 ) { if ( $hsp->percent_identity >= 75 ) { print "Hit= ", $hit->name, ",Length=", $hsp->length('total'), ",Percent_id=", $hsp->percent_identity, "\n"; } } } }See Howto_s at http://bioperl.open-bio.org/wiki/HOWTO:SearchIO
Example 2
use Bio::SearchIO;
my $cutoff = ’0.001’;
my $file = ‘blast.out’,
my $in = new Bio::SearchIO(-format => ‘blast’,
-file => $file);
while( my $r = $in->next_result ) {
print "Query is: ", $r->query_name, " ",
$r->query_description," ",$r->query_length," aa\n";
print " Matrix was ", $r->get_parameter('matrix'), "\n";
while( my $h = $r->next_hit ) {
last if $h->significance > $cutoff;
print "Hit is ", $h->name, "\n";
while( my $hsp = $h->next_hsp ) {
print " HSP Len is ", $hsp->length(’total’), " ",
" E-value is ", $hsp->evalue, " Bit score ",
$hsp->score, " \n",
" Query loc: ",$hsp->query->start, " ",
$hsp->query->end," ",
" Sbject loc: ",$hsp->hit->start, " ",
$hsp->hit->end,"\n";
}
}
}