Professional Documents
Culture Documents
Bioinformatics • Introduction
• Input/output
Computational Methods II: • Variables
Sequence Analysis with Perl • Functions
• Control structures
• Arrays
George Bell • Regular expressions
WIBR Biocomputing Group
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002
1
Variables Perl functions – a sample
• Scalar variables start with $ print tr/// closedir open m//
$numSeq = 5; # number; no parentheses
$seqName = “GAL4”; # “string”; use parentheses
$level = -3.75; # numbers can be decimals too chomp mkdir split close die
print “The level of $seqName is $level\n”; # “\n” = new line
$_ default input variable
length chdir join chmod rename
2
String comparisons Multiple comparisons
• Choices: eq , ne • AND &&
• OR ||
if ($gene1 ne $gene2)
{ if ($exp > 2 || ($exp > 1.5 && $numExp > 10)
print “$gene1 and $gene2 are different”;
} {
else # $gene1 eq $gene2 print “Gene $gene is up-regulated”;
{ }
print “$gene1 and $gene2 are the same”;
}
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002
3
Example: oligo analysis Basic steps for oligos.pl
Open fasta sequence
sample fasta sequence: Get raw sequence
>gi|16493450|gb|BB659629.1|BB659629 Extract oligos
GCCTGCTTGAGTTTTGAAGTCTTGGAGCCACAGAA Analyze oligos
AGCACTGGCCAGAGGAGAGGTAATCACTTCTAATG
CCAGGCCTGCTGTGCAGTGCGCATGTGTGATCTCA Print out results
GTCTGCTTCTGCCCTAGCTAATGAAGGCATGGACA (Modify script to analyze multiple seqs)
ATGGAATAGCCACATGGCAGCACCGGAAAACAAGC
TTACTTCTGCAGTACACAGCCTGCTTTGCCTGATT
TCTGTCCACTGG
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002
WIBR Bioinformatics Course © Whitehead Institute 2002 WIBR Bioinformatics Course © Whitehead Institute 2002