Programming elements that are used to perform basic mathematical calculations include:
- Equations or Simple functions
- Math functions
This post will deal with the first two.
Sets are common in mathematical biology : response values, independent values, time units, gene or protein names. These sets can be expressed as arrays. The two most common array types are integer and character arrays. Integer arrays are used to keep a set of numbers together. Instead of defining each time individually
time_1=0; time_2=1; time_3=5; . . .
the set of times can be defined as an array:
Now, to refer to a specific time, we can call time(i) where i = the position of the time we are interested in. Ie, the first time point is time(1).
Character arrays can be used to keep non-numerical characters together:
If an operation needs to be performed on multiple time units, or genes, then the entire set can be passed to the function performing the operation.
Matrices are useful when dealing with two dimensional data. For example, if each gene has a corresponding expression level:
This matrix has two rows (genes, expression) and six columns (one for each gene/expression pair). It is often helpful to consider whether we want the rows or the columns to contain a subset of data. For example, if we have multiple observations of expression for the gene set, we could define the matrix in two ways.
This gives a matrix where the first row is the gene names, the other 3 rows are the different expression observations. Here each column contains a subset of data, so if we want to plot the expression for YAL054C, we can look down the first column. Alternatively,
Now the first column is the gene name, and each row contains the gene name and the 3 observations. Now each row is containing the subset of data.