Perl introductionary training
Contents
Why Perl for Bioinformatics ?
- Novice programmers can learn fast to write small yet useful programs.
- Perl regular expressions and hashes provide a powerful tool to parse through text and put it into new format or extract the interesting content. Perl provides the "glue" to connect various databanks en software into a workflow.
- Easy parsing through files, starting software and retrieving the output, as well as retrieving data from the Internet.
- Runs under Windows as well as MacOS X, Linux and other flavours of UNIX.
- Freeware and OpenSource
- Availability of collection of free software, among other things for Bioinformatics (BioPerl, Ensembl Perl,...), easy download with management of dependencies (using cpan, ppm, biocLite,...)
Introduction
During these two sessions you will be invited to perform a series of exercises with the Perl scripting language in a Windows environment. There exist two versions of the Perl interpreter for Windows : Strawberry Perl and ActivePerl. The first one is a freeware and OpenSource software developed by a community of volunteers, the second belongs to ActiveState (Vancouver, Canada) and exists in a freeware basic version and a commercial version with enhancements for business purpose. We will use Strawberry Perl, which is the favorite of Larry Wall, the main developer of Perl.
You can (as you will see) always write a Perl script using any text editor and run it by simply typing a command in a "DOS box", but you will be invited to do most of the exercises using using Padre, an editor specifically designed to write Perl programs and run them right away.
Course material
Day 1
Day 2
Cheat sheets
- A quick guide to Perl
- A quick guide to Perl regular expressions
- Quick reference guide to Perl programming
Exercises
- Day 1 : preliminary - Installing Strawberry Perl and Padre in Windows
- Day 1 : exercise 1 - my first Perl program
- Day 1 : exercise 2 - matching text with regular expressions
- Day 1 : exercise 3 - parsing files
- Day 1 : exercise 4 - the Perl associative arrays
- recapitulation exercise - Perl exercise on a Prosite pattern
- recapitulation exercise - Decoding DNA with Perl
- debugging exercise - Debug this little perl program
- Day 2 : exercise 5 - an example about parsing through a list of files
- Day 2 : exercise 6 - introduction into Perl one-liners
- Day 2 : exercise 7 - subroutines and libraries
- Day 2 : exercise 8 - downloading and using libraries
Check your Perl Installation
- to obtain the current version of Perl
perl –v
- To execute Perl statements from the comment line
perl –e "print 42;" Perl –e "print \"Two\nlines\n\";"
- To execute and print warnings
perl –we "print 'hello';x++;"
Some further test and example of Perl flow control
- Loops and cycles
- Conditional Statements
Data
Recommended Perl books
the "Perl bible" :
- Tom Christiansen, brian d foy & Larry Wall, with Jon Orwant : Programming Perl (4th edition, Covers Version 5.14). O'Reilly Media, 2012, ISBN 978-0-596-00492-7
recommended for beginners (covers also other stuff) :
- Conrad Bessant, Darren Oakley, and Ian Shadforth : Building Bioinformatics Solutions with Perl, R and SQL (second edition). Oxford, 214, ISBN 978-0-19-965855-8
can be read on-line for free :
- brian d foy, Randal L. Schwartz, Tom Phoenix : Learning Perl (7th Edition). All IT eBooks, 2016, ISBN 978-1-491-95432-4
- chromatic : Modern Perl (4th edition, updated for Perl 5.22). The Pragmatic Bookshelf, 2015, ISBN 978-1-68050-088-2
old but still potentially useful :
- James Tisdall : Beginning Perl for Bioinformatics. O'Reilly Media, 2001, ISBN 978-0-596-00080-6
- James Tisdall : Mastering Perl for Bioinformatics. O'Reilly Media, 2003, ISBN 978-0-596-00307-4
Additional links
- Perl : http://www.perl.org
- Strawberry Perl :http://strawberryperl.com
- ActivePerl : http://www.activestate.com/activeperl
- Padre : http://padre.perlide.org
- DWIMP : http://dwimperl.com/windows.html
- CPAN : http://www.cpan.org
- BioPerl : http://bioperl.org
- Ensembl Perl : http://github.com/Ensembl
- The EMBnet QuickGuides : http://www.embnet.org/embnet-quickguides
- The Perl QuickGuide from Squirrel Consultancy: http://www.squirrel.nl/pub/perlref-5.004.1.pdf