Download Lecture 3 and HW 2

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

United Kingdom National DNA Database wikipedia , lookup

Microsatellite wikipedia , lookup

Helitron (biology) wikipedia , lookup

Transcript
Lecture 3
BNFO 235
Usman Roshan
Exercises
• Write a program to read in two DNA
sequences and print the number of
matches and mismatches.
• Write a program to translate a DNA
string into amino acids
• Write a program that searches for the
open reading frame in a DNA sequence.
Subroutines
• sub <subroutine_name> {
– #parameters are placed in @_
– <code>
–.
–.
– return;
• }
Scope
• You can create local variables using
my.
• Otherwise all variables are assumed
global, i.e. they can be accessed and
modified by any part of the code.
• Local variables are only accessible in
the scope of the code.
Pass by value and
pass by reference
• All variables are passed by value to
subroutines. This means the original
variable lying outside the subroutine
scope does not get changed.
• You can pass arrays by reference using
\. This is the same as passing the
memory location of the array.
HW 2
•
Write a program called count.pl that reads in a set of strings from a file
called string.txt and prints the number of A’s, B’s, C’s, and D’s. For
example, if the file looks like
AABCAA
CDAAD
CCC
• then your program should output
A 6
B 1
C 5
D 2
• Soft copy due by Monday midnight in format
FirstnameLastnamecount.pl emailed to [email protected] and hard
copy due in a box outside my office by Tuesday midnight.