Escolar Documentos
Profissional Documentos
Cultura Documentos
<H16-1>
INTRODUCTION
Josep F. Abril
jabril@imim.es
MSc BioInformatics
HG16.1 1/12
Algorithms
PROGRAM
INPUT
READ INPUT
ALGORITHM
ALGORITHM
IMPLEMENTATION
OUTPUT
MSc BioInformatics
WRITE OUTPUT
HG16.1 2/12
Algorithms in Biology
Homo sapiens leptin mRNA
INPUT
DNA
SEQUENCE
ALGORITHM
GENETIC
CODE
OUTPUT
PROTEIN
SEQUENCE
MSc BioInformatics
ATGCATTGGGGAACCCTGTGCGGATTCTTGTGGCTTTGGCCCTATCTT
TTCTATGTCCAAGCTGTGCCCATCCAAAAAGTCCAAGATGACACCAAA
ACCCTCATCAAGACAATTGTCACCAGGATCAATGACATTTCACACACG
CAGTCAGTCTCCTCCAAACAGAAAGTCACCGGTTTGGACTTCATTCCT
GGGCTCCACCCCATCCTGACCTTATCCAAGATGGACCAGACACTGGCA
GTCTACCAACAGATCCTCACCAGTATGCCTTCCAGAAACGTGATCCAA
ATATCCAACGACCTGGAGAACCTCCGGGATCTTCTTCACGTGCTGGCC
TTCTCTAAGAGCTGCCACTTGCCCTGGGCCAGTGGCCTGGAGACCTTG
GACAGCCTGGGGGGTGTCCTGGAAGCTTCAGGCTACTCCACAGAGGTG
GTGGCCCTGAGCAGGCTGCAGGGGTCTCTGCAGGACATGCTGTGGCAG
CTGGACCTCAGCCCTGGGTGCTGA
MHWGTLCGFLWLWPYLFYVQAVPIQKVQDDTKTLIKTIVT
RINDISHTQSVSSKQKVTGLDFIPGLHPILTLSKMDQTLA
VYQQILTSMPSRNVIQISNDLENLRDLLHVLAFSKSCHLP
WASGLETLDSLGGVLEASGYSTEVVALSRLQGSLQDMLWQ
LDLSPGC
HG16.1 3/12
DESIGN
IMPLEMENTATION
TESTING
DEBUGGING
MAINTENANCE
MSc BioInformatics
HG16.1 4/12
PERL
Perl is a high-level programming created by Larry Wall
and a cast of thousands, initially released in 1987.
It derives from the ubiquitous C programming language
and to a lesser extent from sed, awk, the Unix shell,
and at least a dozen other tools and languages.
The most recent production release is 5.8.2 (5.005_03
and 5.6.2 are still supported). The most cutting-edge
development release is 5.9.
Where to find help:
Your local Perl guru
MAN pages and PERLDOC
Perl Cookbook, Programming Perl, Elements of
Programming in Perl, etc...
http://cpan.org/
http://perl.com/
MSc BioInformatics
HG16.1 5/12
Perl phylosophy
TMTOWTDI
There's More Than One Way To Do It
Laziness
The quality that makes you go to great effort
to reduce overall energy expenditure.
Impatience
The anger you feel when the computer is being lazy.
Hubris
The quality that makes you write (and maintain) programs
that other people wont want to say bad things about.
MSc BioInformatics
HG16.1 6/12
Installing Perl
UNIX
Download latest version from CPAN.
Take a look to README/INSTALL files, and:
sh ./Configure; make; make test; make install;
WINDOWS
Obtain a perl port (for instance, ActiveState Perl version from
http://www.activestate.com/), and double-clik on the archive.
MAC
Compiled binary distribution for MacOS is available in the ports
section of CPAN.
MSc BioInformatics
HG16.1 7/12
Writing Code
Structure
$s=0;$i=1;while($i<=
10){$s=$s+$i;$i=$i+
1;} print
"The result is $s\n";
Naming
$a = "ATGGGTA"
$s = 0;
$i = 1;
while ($i <= 10) {
$s = $s + $i;
$i = $i + 1;
};
print "The result is $s\n";
$dnaseq = "ATGGGTA"
Comments
# comments / POD comments / Literate Programming
Being strict
use strict;
use warnings;
MSc BioInformatics
HG16.1 8/12
sh$ perl e 'print "To bit or not to bit, that is the question...\n"'<RETURN>
To bit or not to bit, that is the question...
sh$
Perl command-line:
sh$ cat > myfirstscript.pl<RETURN>
print "To bit or not to bit, that is the question...\n"<RETURN>
<CTRL-D>
sh$ perl myfirstscript.pl<RETURN>
To bit or not to bit, that is the question...
sh$
HG16.1 9/12
Perl PRAGMAS
Pragmas are modules that change the behaviour of the interpreter.
use strict;
refs => generating run-time error if you use symbolic references
vars => compile-time error if variable was not previously declared
subs => barewords are treated as syntax errors
use warnings;
use constant PI => 3.14159;
use libs qw( /my/local/path/to/libs );
modifiying
HG16.1 10/12
Suggested Bibliography
Elements of Programming with Perl
Andrew Johnson
Ed. Manning, 1st edition, 1999
Perl Cookbook
Tom Christiansen, Nathan Torkington
Ed. OReilly, 2nd edition, 2003
Learning Perl
Randal L. Schwartz, Tom Phoenix
Ed. OReilly, 3rd edition, 2001
Programming Perl
Larry Wall, Randal L. Schwartz, Tom Christiansen, Jon Orwant
Ed. OReilly, 3rd edition, 2003
Beginning Perl for Bioinformatics
James Tisdall
Ed. OReilly, 1st edition, 2001
Genomic Perl:
From Bioinformatics Basics to Working Code
Rex A. Dwyer
Cambridge University Press, 1st edition, 2002
MSc BioInformatics
HG16.1 11/12
MSc BioInformatics
HG16.1 12/12