Lane Medical Library & Knowledge Management Center How to Write a Program Yannick Pouliot, PhD Bioresearch Informationist

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Chapter 2: Modularization
Programming Logic and Design Fourth Edition, Introductory
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Lane Medical Library & Knowledge Management Center Perl Programming for Biologists PART 3: Tue Feb 17 th 2009 Yannick Pouliot,
Lane Medical Library & Knowledge Management Center Ni mble Perl Programming Using Scriptome Yannick Pouliot, PhD Bioresearch Informationist.
Program Design and Development
Lane Medical Library & Knowledge Management Center Electronic Laboratory Notebook: Organize Your Research Quickly & Efficiently.
Lane Medical Library & Knowledge Management Center Researcher’s Toolkit: Bioresearch Tools Christopher Stave, MLS Liaison & Instructional.
Lane Medical Library & Knowledge Management Center Perl Programming for Biologists SESSION 2: Tue Feb 10 th 2009 Yannick Pouliot,
Lane Medical Library & Knowledge Management Center Essential UNIX Skills for Biologists Yannick Pouliot, PhD Bioresearch Informationist.
Lane Medical Library & Knowledge Management Center Perl Programming for Biologists PART 2: Tue Feb 12 th 2008 Yannick Pouliot,
1 Chapter 8 Designing Small Programs. 2 A ‘Procedure’ v A set of instructions which describe the steps to be followed in order to carry out an activity.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
1.9 Methods academy.zariba.com 1. Lecture Content 1.What is a method? Why use methods? 2.Void Methods and methods with parameters 3.Methods which return.
Chapter 1 Program Design
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 3P. 1Winter Quarter Structured Engineering.
Lane Medical Library & Knowledge Management Center Perl Programming for Biologists A bold experiment into the unknown… PART 1:
Introduction to Java.
Assembler Compiler Interpreter ASSEMBLER To convert the assembly language into machine code. Translate mnemonic operation codes to their machine language.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Chapter 1: Python Basics CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
Simple Program Design Third Edition A Step-by-Step Approach
Technology in Action Alan Evans Kendall Martin Mary Anne Poatsy Twelfth Edition.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
Lane Medical Library & Knowledge Management Center Introductory Perl Programming for Biologists Part 1: 2/3/2009 PRELIMINARY VERSION.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
An Introduction to Front-end Web Development Tom Perkins.
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Using Visual Basic for Applications in Microsoft Project Sean Vogel.
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
C Language: Introduction
I Power Higher Computing Software Development Development Languages and Environments.
Lane Medical Library & Knowledge Management Center Perl Programming for Biologists, Second Edition Part 1: 9/11/2007 Yannick Pouliot,
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
PHP Form Processing * referenced from
1. Starting 1 Let’s Learn Saenthong School, January – February 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
Programming Objectives What is a programming language? Difference between source code and machine code What is python? – Where to get it from – How to.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Getting Started With Python Brendan Routledge
ICAD3218A Create User Documentation.  Before starting to create any user documentation ask ‘What is the documentation going to be used for?’.  When.
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
Foundations of Programming: Java
Trace Tables In today’s lesson we will look at:
Development Environment
1-1 Logic and Syntax A computer program is a solution to a problem.
Lesson 1 An Introduction
Introduction to Programming the WWW I
Perl A simple test.
Print slides for students reference
Python I/O.
Week 1 Computer Programming Year 9 – Unit 9.04
Use proper case (ie Caps for the beginnings of words)
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
CS285 Introduction - Visual Basic
A look at Small basic The Text Window 2017.
Introduction In today’s lesson we will look at: why Python?
Introduction to AppInventor
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Introduction to Python
Starter Which of these inventions is: Used most by people in Britain
Presentation transcript:

Lane Medical Library & Knowledge Management Center How to Write a Program Yannick Pouliot, PhD Bioresearch Informationist © 2009 The Board of Trustees of The Leland Stanford Junior University

Lane Medical Library & Knowledge Management Center 2 The Bioresearch Informationist: At Your Service Yannick Pouliot, PhD, Lane Medical Library & Knowledge Management Center Bioresearch Informationist ≈ computational biologist in residence Role: Support laboratory researchers regarding biocomputational resources and their use …especially postdocs Contact:

Lane Medical Library & Knowledge Management Center 3 Objectives Understanding the thinking process behind writing a program.

Lane Medical Library & Knowledge Management Center Check Point Q: Do you have Perl installed? 4

Lane Medical Library & Knowledge Management Center So What’s Needed for Writing a Program? Need knowledge of: 1. Language instructions (FOR loop, CASE, IF, etc) 2. Syntax: correctly invoking instructions Having a (very) clear strategy  Programming is giving instructions to an idiot savant Must be complete Must work in every aspect  We’ll use a simple method can greatly facilitate the process and increase quality of your work 5

Lane Medical Library & Knowledge Management Center Our Example: Writing a Program that Prints “Hello World” Applying “Ten Steps to Write a Program Without Tears” to print text 6

Lane Medical Library & Knowledge Management Center Step 1: Start With The End: What is the Outcome? Visualize what the end result of your program will be  Be highly specific, e.g. Silly: print “hello” whenever the program runs Real: calculate the average frequency of CpG islands in human genes known to code for interleukins  Definition of interleukin  protein exists?  Everywhere in the genome?  What about pseudogenes? Do they count? Useful to create flowchart diagram of process 7

Lane Medical Library & Knowledge Management Center Flowcharting to Understand the Process Lots of tools, some free  I use MS Visio (Win only)MS Visio 8

Lane Medical Library & Knowledge Management Center Step 3: Breakdown Tasks into Chunks ( = “Subroutines”) For us, we want to print a single word: “hello”  Chunk = print whatever word is requested Use individual subroutines to handle chunks Subroutines used whenever a complex and/or repetitive step is involved Why? Because subs simplify writing and reading of code because they subsume set of instructions under a human- understandable sentence, e.g.  “PrintText()”  “QueryDB()” 9

Lane Medical Library & Knowledge Management Center Step 6: How is Our Data Stored? 10 We’ll store text to be printed in a string variable Q: what should it be called? $TextToPrint = ‘Hello = (‘Gene1’,’Gene2’,’Gene3’,’Gene4’);

Lane Medical Library & Knowledge Management Center Putting it Practice 11

Lane Medical Library & Knowledge Management Center Step 7: Update Generic Program to Put Everything Together 1. Download and save “GenericProgram.pl” under a new name, e.g., “printtext.pl” 2. Open in vanilla flavor text editor (NOT MS Word) 1. Windows: Use NotePad 2. Mac: Use Applications/TextEdit  Use Format/Make Plain Text to ensure … plain text 3. Save file If Mac user, remove first line of text (“#!c:/…”) 12

Lane Medical Library & Knowledge Management Center Updating printtext.pl 13 PrintText printtext.pl

Lane Medical Library & Knowledge Management Center Run The Program Type perl –f “printtext.pl” 14

Lane Medical Library & Knowledge Management Center In Summary… Think in great detail about what the outcome looks like Think in terms of chunks Think about your variables (“data structures”) 15

Lane Medical Library & Knowledge Management Center 16