60 likes | 339 Views
Introduction to Perl. The Perl programming language is: A scripting language Uses C-style formatting Very good at manipulating strings Object-oriented As of Perl 5 Open source Available from www.perl.org Available for most platforms Great portability. Perl Formatting.
E N D
Introduction to Perl • The Perl programming language is: • A scripting language • Uses C-style formatting • Very good at manipulating strings • Object-oriented • As of Perl 5 • Open source • Available from www.perl.org • Available for most platforms • Great portability
Perl Formatting • Perl uses C-like formatting • Lines end in semicolons (‘;’) • White space is ignored • Variables start with a symbol • Dollar sign ($) for scalars • At symbol (@) for arrays • Percent sign (%) for hash arrays • Variables have no type • Control blocks (e.g. while, if, for) require curly brackets (‘{‘ and ‘}’) • Use the pound sign (‘#’) instead of slashes to comment a line • Multi-line comments are not supported • # This is a comment. We will show comments in red
Calling Subroutines • Subroutines (functions) from a different class or library are called using ‘->’ • E.g. classA->subroutine1() • Objects are instantiated using the new subroutine • E.g. $instance=ClassA->new()
Subroutines in BioPerl • BioPerl uses named parameters • Parameters are actually passed as a hash array • Each entry in the form • key=>value • Value is a string or number • Order or parameters doesn’t matter • E.g. Bio::Seq->new(-seq=>’ACTG’, -primary_id=>’1’); is the same as Bio::Seq->new(-primary_id=>’1’, -seq=>’ACTG’);
Useful BioPerl Classes • Bio::Seq • The main class used for handling sequence data • Bio::SeqIO • Sequential input and output to various sequence file types • Bio::DB::Genbank • Allows retrieval of sequences from GenBank • Bio::Tools::RemoteBlast • Make a BLAST query against GenBank databases via the Internet • Bio::SeqFeatureI • An interface that allows for features to be associated with sequences • Bio::Tools::SeqStats • Retrieves various statistics (e.g molecular weight) for a given sequence • Bio::SimpleAlign • Manipulate alignment data