Introduction to Computational Biology Programming with Matlab.

Slides:



Advertisements
Similar presentations
Introduction to MATLAB The language of Technical Computing.
Advertisements

Introduction to Matlab
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Al-Amer An Introduction to MATLAB Lesson 2: M-files Dr. Samir Al-Amer Term 061.
Lecture 5 Review Programming Program Structures Comparison Repetition: looping or iteration Conditional execution: branching Bubble Sort.
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
Introduction to MATLAB
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
Al-Amer An Introduction to MATLAB Dr. Samir Al-Amer Term 062.
Adding Automated Functionality to Office Applications.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 21P. 1Winter Quarter MATLAB: Structures.
MATLAB and SimulinkLecture 11 To days Outline  Introduction  MATLAB Desktop  Basic Features  Branching Statements  Loops  Script file / Commando.
Matlab tutorial course Lesson 2: Arrays and data types
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Introduction to Matlab 1. Outline: What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators Plotting Flow Control Using of M-File Writing.
Introduction to MATLAB. Windows in MATLAB Command Window – where you enter data, run MATLAB code, and display results Command History - displays a log.
1 Week 3: Vectors and Matrices (Part III) READING: 2.2 – 2.4 EECS Introduction to Computing for the Physical Sciences.
Tutorial 1SEG7550 Introduction to MATLAB 18 th, SEP
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Creating your first C++ program
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Eng Ship Structures 1 Introduction to Matlab.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Introduction to MATLAB Session 3 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2011.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Using Visual Basic for Applications in Microsoft Project Sean Vogel.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Angela Des Jardins
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators (Arithmetic, relational, logical ) Display.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Working with Arrays in MATLAB
Introduction to Matlab. What is Matlab? A software environment for interactive numerical computations Examples:  Matrix computations and linear algebra.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Digital Image Processing Lecture 6: Introduction to M- function Programming.
Digital Image Processing Introduction to M-function Programming.
Introduction to Matlab
EGR 115 Introduction to Computing for Engineers MATLAB Basics 3: Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
General Computer Science for Engineers CISC 106 Lecture 13 - Midterm Review James Atlas Computer and Information Sciences 10/02/2009.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Introduction to Matlab Patrice Koehl Department of Biological Sciences National University of Singapore
General Computer Science for Engineers CISC 106 Lecture 15 Dr. John Cavazos Computer and Information Sciences 03/16/2009.
Introduction to Literate Programming in Matlab 2WN50 – Week programming-in-matlab.pptx?dl=0.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Chapter 4 MATLAB Programming MATLAB Troubleshooting Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Intro to Matlab Yipei Wang & Qihui Li {yipeiw,
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
Matlab Tutorial Iman Moazzen First Session – September 11, 2013.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators.
Introduction to Matlab
Introduction to Programming (CS 201)
MATLAB DENC 2533 ECADD LAB 9.
MATLAB: Structures and File I/O
Matlab review Matlab is a numerical analysis system
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Presentation transcript:

Introduction to Computational Biology Programming with Matlab

Why Program? Programming a computer provides: Accuracy  Reduce human error Speed and efficiency  Processing the human genome manually is impossible  Adding all numbers from is a waste of our time Repetition  Same program can be run many times using different input data Automation

Anatomy of a program InputInstructionsOutput DataSteps encoded in a programming language Results – readable by you or another program 3, 4Sum7 GAGCAGACACGTTTTTGGTGGTTTT GAGCAGACATTTTTTGATTCTGGTTTT Align GACAT-TTTTTGATTCTGGTTTT GACACGTTTTTGG---TGGTTTT |||| |||||| |||||||

Computing A computable task  Does it make sense to create a program to solve my problem? Text Editor  A program that allows you to save text files Emacs (unix), vi (unix), gedit (unix), notepad (Windows) Compiler/Interpreter  gcc (C), javac (Java), perl (Perl)

Strings “This is a string” ‘This is also a string’ “ACGACTACGACTAGCATCAGCATCAG”

vectors >> v = [3 1] v = 3 1

vectors >> v = [3 1]; >>

Row vectors >> v = [ ] v =

column vectors >> v = [ ]' v =

A new vector >> v = [1:8] v =

A new vector with increments of 0.25 >> v = [2:.25:4] v = Columns 1 through Columns 8 through

Accessing vector elements >> v(1) ans = 2

Basic operations >> v v = >> v(1:3) ? >> v(2:4) ? >> v(1:3)-v(2:4) ans =

Basic operations >> u = [0:-1:-4] u = >> -2*u ans =

A matrix: n x n (row x column) >> A = [ 1 2 3; 3 4 5; 6 7 8] A =

Indexing a matrix >> A(1:2,3:4) ??? Index exceeds matrix dimensions. >> A(1:2,2:3) ans = >> A(1:2,2:3)' ans = A =

Vector operations >> v = [1 2 3]' v = >> b = [2 4 6]' b = >> v+b ans = >> v-b ans = -2 -3

Plotting >> v v = >> b b = >> plot(v,b)

Loops >> for j=1:4, j end j = 1 j = 2 j = 3 j = 4

Loops >> v = [1:3:10] v = >> for j=1:4, v(j) = j; end >> v v =

If statements a = 2; b = 3; if (a<b) j = -1; end

If and elseif statements a = 4; b = 3; if (a<b) j = -1; else if (a>b) j = 2; end

Character arrays >> c = ’atcg’

Example 1: find the complement function c = watson_crick(v) %This is a function m-file for finding the Watson-Crick complement of a %string of nucleotide symbols % %Author: Winfried Just % Department of Mathematics % Ohio University % Athens, OH % % %Date: March 31, 2005 %Input: v - string of letters from the alphabet {a, c, g, t} %Output: c - the string of Watson-Crick complements to the terms of v %

Example 1 cont. function c = watson_crick(v) for i = 1:length(v) if v(i) == 'a' c(i) = 't'; elseif v(i) == 'c' c(i) = 'g'; elseif v(i) == 'g' c(i) = 'c'; elseif v(i) == 't' c(i) = 'a'; else c(i) = '?'; disp('Non-nucleotide symbol encountered'); end

Run watson_crick >> watson_crick (’accgatgcttatggatc’)

Example 2: find the AUG function start_codon(v) %This is a function m-file for finding the position of the first start codon % %Author: Winfried Just % Department of Mathematics % Ohio University % Athens, OH % % %Date: March 31, 2005 %Input: v - string of letters from the alphabet {a, c, g, t} %Output: a message that shows the position of the first % start codon in v %

Example 2: find the AUG function start_codon(v) found = 0; %this variable will tell us when we have found a start codon i = 1; while ~found & i < length(v) - 1 if v(i) == 'a' & v(i+1) == 't' & v(i+2) == 'g' found = 1; disp(['start codon at position ', num2str(i)]) else i = i+1; end if ~found disp('no start codon found') end

Run start_codon >> start_codon(’accgatgcttatggatc’)

Examples relevant to biology Log-log plot  b/math266a/266A-fitting-logplot.pdf b/math266a/266A-fitting-logplot.pdf