Exercise 1: MATLAB warm-up Create yourself new course folder into

advertisement
Exercise 1: MATLAB warm-up
1. Create yourself new course folder into your drive X:\ (alternatively you can use memory stick). This
folder will be a repository of all the programs and functions during the course. For that, complete the
following tasks:
A. Create folder X:\MATLAB
B. Open MATLAB
C. Add the created folder to the list of searchable MATLAB function folders by choosing File -> Set
path and adding the folder there.
D. Use Current directory (in top bar by default) to set the folder also as a default folder. The
contents of this folder are displayed in the file list.
E. Create new program m-file e.g. by choosing File -> New -> m-file and open it in the editor.
F. Open MATLAB Help and locate some example script from there (look Help entry e.g. for mean
command). Copy-paste the example script text into your m-file in the editor.
G. Save the m-file with some name into your current directory.
H. Execute the m-file program by writing its name (and pressing enter) into MATLAB command
window.
I. File gene_expression_data.xls located in Y:\matlab_biol contains a biological datasets used in
this exercise. Copy this file into your local computer drive (e.g. to Desktop, My Documents or
C:\tmp). Import it in MATLAB from File -> Imort data. The text part and numerical part of the
table should appear as separate arrays in the workspace.
2. Create 100 X 100 random matrix A by writing A = rand(100, 100). From the matrix, use MATLAB
commands to find and output:
A. The cell in the 2nd row and 10th column
B. The whole last column (using one command)
C. The two last cells of the 2nd row (using one command)
D. Indices of the cells that have value greater than 0.5
E. Transposed matrix A’ of A
F. Subtraction A-A’
3. Create a heatmap visualization of above matrix using imagesc(A) command.
4. Calculate I) the sums of the columns and II) the sums of the rows of matrix A. Output the results to
variables C (column sums) and R (row sums). Find also the maximum value in the whole matrix.
5. Workspace matrix gene_expression_data contains gene expression levels for X genes (rows) in 178
tissue samples obtained using Affymetrix HG-U133A microarray platform.
A. Create new vector variable V containing the first column of gene_expression_data matrix. This
corresponds to the tissue X.
B. Display histogram of data vector V using hist function. Are the gene expression levels in this
tissue normally distributed?
C. Calculate the mean gene expression value for V using mean function.
D. Calculate standard deviation of V using std function.
E. Find values using find function from V that deviate from the mean more than a value of
standard deviation. Assign these values to a new vector V2. How many genes did you find that
are lowly or highly expressed in the tissue?
F. Display a histogram for V2.
6. Sort the rows of gene_expression_data matrix according to the values of the first dimension in
descending order. Use function sort(matrix, dimension,’descend’). Create a heatmap visualization of
the 100 first rows of the sorted matrix using imagesc function. Do the expression levels look similar in
many other tissues (columns of image plot)?
Download