10/4/2013
MATLAB Function Files
A MATLAB function file (called an M-file) is a text (plain ASCII) file that
contains a MATLAB function and, optionally, comments.
The file is saved with the function name and the usual MATLAB script file
p
extension, ".m".
R
Platform for statistical computing
- Powerful for manipulating/cleaning/visualising/making up
data
- Repeated actions via scripting
- Vast number of add-on utility packages
- Free under Gnu General Public License
- Updated frequently, latest methods
- M
R
Platform for statistical computing
- Powerful for manipulating/cleaning/visualising/making up
data
- Repeated actions via scripting
- Vast number of add-on utility packages
- Free under Gnu General Public License
- Updated frequently, latest methods
- M
9/26/2013
Variables and Arrays
Variables are named locations in memory where
numbers, strings and other elements of data may be
stored while the program is working.
Variable names are combinations of letters and digits,
but must start with a letter.
Varia
10/10/2013
Scalar arithmetic
Assigment statements are of the form
variable_name = expression
Scalar operators:
Addition, subtraction:
Multiplication, division:
Exponentiation:
a+b
a*b
a^b
a-b
a/b
When many operations are combined into a single
expression,
3/11/14
Markov chains part 2
Genetic Information
Gene basic unit of genetic
information. Genes determine the
inherited characters.
Genome the collection of
genetic information.
Chromosomes storage units of
genes.
DNA - is a nucleic acid that
co
10/17/2013
Data files using load/save
Probably the easiest way to import data into a Matlab
program is from a tab delimited file. Excel can export
tables in tab-delimited format. These can be read using
tab delimited
the load function with the -ascii opti
Gene regulation
TF1
Gene expression
TF2
TF3
TF4
At any given moment genes may or may not be producing protein
Proteins called transcription factors (TFs) control the level of activation
(or expression) of each gene.
Gene have regulatory regions which cont
3/6/14
Markov chains
Probability distribu9ons
1
3/6/14
Exercise
1. Use the Matlab func9on nchoosek(n,k) to implement a
generic func9on BinomialPMF(k,n,p) for calcula9ng the
Binomial PMF with k successes in n trials wi
Control of Gene
Expression
Neuron and lymphocyte
Different morphology, same genome
Genomes contain in the DNA sequence the information to make many thousands of
different RNA and protein molecules
A cell expresses only a fraction of its genes and differen
Ordinary Differential Equations 1
Single variable systems
Simplest ODE (linear, single variable) is the
model for exponential decay:
which has an analytical solution x(t) = Cekt
where C is a constant representing the value
of x(0). However, we will be con
Difference equations 2
Selection in diploid organisms
The Fisher-Wright model was a model of a
finite size population with no selection.
We will now incorporate selection into the
model.
Asexual
Reproduction
Many single-celled organisms reproduce by
s
Difference equations
Difference equations
A single-variable discrete dynamical system can
be defined as:
x(t + 1) = f(x(t)
For example:
x(t + 1) = x(t)2
Complex numbers
Complex variables are created automatically
when a complex value is assigned to a var
Markov chains part 2
Genetic Information
Gene basic unit of genetic
information. Genes determine the
inherited characters.
Genome the collection of
genetic information.
Chromosomes storage units of
genes.
DNA - is a nucleic acid that
contains the gene
Markov chains
Probability distributions
n choose k
Exercise
1. Use the Matlab function nchoosek(n,k) to implement a
generic function BinomialPMF(k,n,p) for calculating the
Binomial PMF with k successes in n trials with probability p.
2. Use the barplot fu
Low-level Input/Output
The load command does not always succeed in
reading an input file. It only works when all lines
in the file have the same ASCII format. Files with
header material do not qualify, nor do binary
files.
ASCII files that cannot be inp
Linear algebra and regression
Solving linear equations
The simplest system of linear equations has
two equations and two variables, for example:
This system can be represented using matrices
and vectors in the form Ax = b
Solving linear equations
Solvi
Review
Function files have function name and .m extension
Syntax: [val1, , valn] = myfunc (arg1, , argk)
Relational operators: =, ~=, >, >=, <, <=
Logical operators: &, |, xor, ~
Hierarchy of operators: ArithmeticRelationalLogical
If construct:
if control
Review
Basic plotting command is plot(x,y)
To plot a function we often use x=a:b:n, then y = f(x)
Can customize using line specifiers: plot(x,y,-g*)
Use subplot(m,n,i) for mxn array of plots.
Can use fplot for functions, e.g. fplot('x^2 + 4', [-3 3])
Mult
ODEs part 3
Network model example
Model considers positive feedback
loops involving signalling pathways
and/or gene regulation.
Multiple interlinked loops that
combine fast and slow kinetics
Yeast cell polarization
Cdc42: part of biochemical signalling
pa
Control of Gene
Expression
Neuron and lymphocyte
Different morphology, same genome
Genomes contain in the DNA sequence the information to make many thousands
of different RNA and protein molecules
A cell expresses only a fraction of its genes and differen
Ordinary Differential
Equations 1
Single variable systems
Simplest ODE (linear, single variable) is the
model for exponential decay:
which has an analytical solution x(t) = Cekt
where C is a constant representing the value
of x(0). However, we will be con
Markov chains part 2
Genetic Information
Geneb a s ic u nito fg e ne tic
info rm a tio n.G e n e s d e te rm in e th e
inh e rite d c h a ra c te rs .
Genometh e c o lle c tio no fg e n e tic
info rm a tio n.
Chromosomess to ra g e un its o f
g e ne s
2) Markov property: only current state determines next state.
-Consider simple Markov chain with transition probability matrix
P =[1 0 0; a b g;0 0 1] , , >0
States 0 and 2 are absorbing
State 1 is transitory
Question: In which states, 0 or 2, is the proc
Difference equations 2
Selection in diploid organisms
The Fisher-Wright model was a model of a
finite size population with no selection.
We will now incorporate selection into the
model.
Reproduction
Asexual
Many single-celled organisms reproduce
by split