25
MARC: Developing Bioinformatics Programs July 2009 Alex Ropelewski PSC-NRBSC Bienvenido Vélez UPR Mayaguez Reference: How to Think Like a Computer Scientist: Learning with Python 1 Essential Computing for Bioinformatics Lecture 2 High-level Programming with Python Controlling the flow of your program

Essential Computing for Bioinformatics

  • Upload
    nedaa

  • View
    23

  • Download
    2

Embed Size (px)

DESCRIPTION

Essential Computing for Bioinformatics. MARC: Developing Bioinformatics Programs July 2009 Alex Ropelewski PSC-NRBSC Bienvenido Vélez UPR Mayaguez Reference: How to Think Like a Computer Scientist: Learning with Python. Lecture 2 High-level Programming with Python - PowerPoint PPT Presentation

Citation preview

Page 1: Essential Computing for Bioinformatics

1

MARC: Developing Bioinformatics ProgramsJuly 2009

Alex RopelewskiPSC-NRBSC

Bienvenido VélezUPR Mayaguez

Reference: How to Think Like a Computer Scientist: Learning with Python

Essential Computing for Bioinformatics

Lecture 2

High-level Programming with Python

Controlling the flow of your program

Page 2: Essential Computing for Bioinformatics

•The following material is the result of a curriculum development effort to provide a set of courses to support bioinformatics efforts involving students from the biological sciences, computer science, and mathematics departments. They have been developed as a part of the NIH funded project “Assisting Bioinformatics Efforts at Minority Schools” (2T36 GM008789). The people involved with the curriculum development effort include:

•Dr. Hugh B. Nicholas, Dr. Troy Wymore, Mr. Alexander Ropelewski and Dr. David Deerfield II, National Resource for Biomedical Supercomputing, Pittsburgh Supercomputing Center, Carnegie Mellon University.•Dr. Ricardo González Méndez, University of Puerto Rico Medical Sciences Campus.•Dr. Alade Tokuta, North Carolina Central University.•Dr. Jaime Seguel and Dr. Bienvenido Vélez, University of Puerto Rico at Mayagüez.•Dr. Satish Bhalla, Johnson C. Smith University.

•Unless otherwise specified, all the information contained within is Copyrighted © by Carnegie Mellon University. Permission is granted for use, modify, and reproduce these materials for teaching purposes. •Most recent versions of these presentations can be found at http://marc.psc.edu/

Essential Computing for Bioinformatics

Page 3: Essential Computing for Bioinformatics

These materials were developed with funding from the US National Institutes of Health grant #2T36 GM008789 to the Pittsburgh Supercomputing Center

3

Basics of FunctionsDecision statementsRecursionIteration statements

Outline

Page 4: Essential Computing for Bioinformatics

4

Basics of FunctionsDecision statementsRecursionIteration statements

Outline

Page 5: Essential Computing for Bioinformatics

5

Some Inaccurate Yet Popular Perceptions of Computing• Computing = Computers• Computing = Programming• Computing = Software

Page 6: Essential Computing for Bioinformatics

Computing = Computers

6

Computing is about solving problems using computers

A.K.A. The Computing Device View of Computing

Page 7: Essential Computing for Bioinformatics

Computing = Programming

7

Computing is about writing programs for computers

A.K.A. The Programming Language view of Computing

Page 8: Essential Computing for Bioinformatics

Computing = Software

8

Computing is not concerned withhardware design

A.K.A. The “Floppy Disk” view of Computing

Page 9: Essential Computing for Bioinformatics

Part I - Outline

9

• What is Computing?• Computing Models and

Computability• Interpretation and Universal

Computers• Church’s Thesis

Page 10: Essential Computing for Bioinformatics

What is computing then?

10

AlgorithmicComputation

Function

InputInformation

OutputInformation

Computing is the study of Computation:the process of transforming information

Page 11: Essential Computing for Bioinformatics

The Computation Process

11

011011001010100101…

encode

011011001010100101…

compute

Problem

decode

SolutionInformation Information

Page 12: Essential Computing for Bioinformatics

Fundamental Questions Addressed by the Discipline of Computing

12

• What is the nature of computation?• What can be computed?• What can be computed efficiently?• How can we build computing

devices?

Page 13: Essential Computing for Bioinformatics

The Computation Process

13

011011001010100101…

encode

011011001010100101…

compute

Problem

decode

Solution

Integer IntegerIntegerFunction

Every Algorithm is in Essence an Integer Function

Page 14: Essential Computing for Bioinformatics

Computability

14

All Integer Functions (IF)

ComputableInteger Functions

(CF)

IF ≟ CF

HaltingProblem

IF ≠ CF

ComputableInteger Functions

(CF)

Page 15: Essential Computing for Bioinformatics

The Halting Problem(Alan Turing 1936)

15

Given a program and an input to the program, determine if the program will eventually stop

when it is given that input.Compute

Program P

Input IP Halts on I?Cannot Build This

Want to describethe set of computable

functions?

Page 16: Essential Computing for Bioinformatics

Mathematical Computers:The Turing Machine (1936)

16

Alan Turing

0 1

0 1FSM

Infinite

I/OTAPE

0/{1,0,R}

1/{0,1,L}

TapeHead

NextState Write

Symbol

HeadMovement

Input Symbol

Page 17: Essential Computing for Bioinformatics

Mathematical Computers:The Turing Machine (1936)

17

Alan Turing

0 1

0 1FSM

InfiniteTAPE

0/{1,0,R}

1/{0,1,L}

FSM

Infinite

I/OTAPE

TapeHead

Turing demonstrated how to solve several problems using his computing model

Page 18: Essential Computing for Bioinformatics

Ad-hoc Turing Machines

18

FSM

Sorting TMFSM

Sorting TMFSM

Sorting TMFSM

Sorting TM FSM

Searching TM FSM

Integrating TM

Can we build a general purpose TM?

Page 19: Essential Computing for Bioinformatics

The Universal Turing Machine (UTM)The Paradigm for Modern General Purpose Computers

19

Universal TM

Coded TM M Coded Tape for M

• Capable of Emulating Every other TM• Shown possible by Alan Turing (1936)• BIG IDEA: INTEPRETATION!!!

Software(flexible)

Hardware(fast)

Programming = Encoding Algorithms

Page 20: Essential Computing for Bioinformatics

Other Familiar Models of Computation

20

• Combinational Circuits• Sequential Circuits (FSM’s)• Pentium Instruction Set Architectures• Lambda Calculus• Recursive Functions• C++

Can you tell which ones are Turing Universal? That is, which ones can emulate any other Turing Machine?

Page 21: Essential Computing for Bioinformatics

Computing in Perspective

21

CMOSGateFSM

ISA

Assembler 1 Assembler 2 Assembler 3

C++Pascal Fortran

MatLab

BuildOne

BuildMany

Excel

Interpreter Design Demands Programming Language Design

PSpice

All have embedded PL’s

Page 22: Essential Computing for Bioinformatics

Why Abstraction Layers?

22

• Resilience to change:– Each layer provides a level of indirection

• Divide and Conquer Approach:– Can work on one small semantic gap at a

time

• Building Block Approach:– Can build many higher layer on same lower

layer Because we know of no other way of

doing anything

Page 23: Essential Computing for Bioinformatics

Church’s Thesis

23

Alonso Church

“All the models of computation yet developed, and all those that may be developed in the future, are equivalent in power.”

“Any realizable computing device can be simulated by a Turing machine”

Issues not considered: Size, Programmability, PerformanceBut they must be considered if one is to build …

Page 24: Essential Computing for Bioinformatics

The (John) Von Neumann Architecture(late 40’s)

24

I/Odevices

CentralProcessingUnit (CPU)

Memory

Allow communication with outside world

Interprets instructions

Stores both programs and data

After 60 years … most processors still look like this!

Page 25: Essential Computing for Bioinformatics

Practical Universal Computers(John) Von Neumann Architecture

(1945)

25

DataPaths

PCABR

ALU

AC Program

Data

Memory

Control Unit (FSM)

CPU

CPU is a universal TM An interpreter of some programming language (PL)

status control

This looks just like a TM Tape