Monday, April 14, 2008

Perl for Bioinformatics.



visit 123Bioinformatics.com for more updates





CPAN offers two command-line utility modules. Perl-Tidy module to beautify, indent, and reformat a messy Perl script and Perl-Critic module to test/analyze Perl scripts.

a. Perl::Tidy
When a Perl script is given as an input to perltidy, it creates a intended, structured Perl script and saves it as a separate file using the same name but with a .ty extension. Perltidy does not change the input script.

Steps to follow,
1. Install Perl::Tidy. It can be run on any system with perl 5.004 or later and used on Unix, Windows, VMS and MacPerl.
2. To execute perltidy,
$ perltidy -[option] test_perl_script.pl
This will create a temporary file test_perl_.pl.ty. The test_perl_script.pl .ty file will contain the well structured perl script. There are many options that can be used indent, to take a back-up etc. For more information on installation and execution see, http://perltidy.sourceforge.net/tutorial.html


b. Perl::Critic


Perl-Critic criticizes/analyses the input Perl script and enforces the user to follow various coding guidelines (or policies). The coding guidelines are based on Damian Conway's book Perl Best Practices. The user can enable/disable or create and customize the modules through the Perl::Critic interface.
The user can set the severity levels. There are 5 severity levels: severity "5" is the most or least restrictive level ie Perl::Critic follow the basic policies/guidelines. The five levels are Gentle (equivalent to 5), stern (equivalent to 4), harsh (equivalent to 3), cruel (equivalent to 2), brutal (equivalent to 1).
Perl::Critic requires a few modules to be pre-installed for it to execute. See http://search.cpan.org/~elliotjs/Perl-Critic-1.082/lib/Perl/Critic.pm


Steps to follow,

1. Install Perl::Critic.
2. Execute Perl::Critic
$ perlcritic –1 test_perl_script.pl

For more information see, http://search.cpan.org/dist/Perl-Critic/