Why? – Examples Speaking Computer-ise – How – What – Environment (windows) Basic Instructions – Declare – Conditional – Loop – Input Write a quiz game.

Slides:



Advertisements
Similar presentations
Grade 6 Hopewell Elementary You will read each slide, then try to think of the answer. When you think you know the answer, click ONCE on the mouse.
Advertisements

Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Student Getting Started Guide Updated June Ensure that you are connected to the Internet. 2. Launch your web browser (Internet Explorer, Firefox,
UW CSE 190p Section 6/21, Summer 2012 Dun-Yu Hsiao.
Bioinformatics is … - the use of computers and information technology to assist biological studies - a multi-dimensional and multi-lingual discipline Chapters.
PERL P ractical E xtraction R ecording L anguage.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Java Intro. A First Java Program //The Hello, World! program in Java public class Hello { public static void main(String[] args) { System.out.println("Hello,
1ex.1 Perl Programming for Biology Exercise 1 The Bioinformatics Unit G.S. Wise Faculty of Life Science Tel Aviv University, Israel March 2009 Eyal Privman.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
2ex.1 Lists and Arrays. 2ex.2 Comments on exercises Always run your script with “ perl -w ” and take care of all warnings  submitted scripts should not.
Linux & Shell Scripting Small Group Lecture 4 How to Learn to Code Workshop group/ Erin.
Prof. R. Willingale Department of Physics and Astronomy 2nd Year C+R 2 nd Year C and R Workshop Part of module PA2930 – 2.5 credits Venue: Computer terminal.
MBAC 611.  We have been using MS Access to query and modify our databases.  MS Access provides a GUI (Graphical User Interface) that hides much of the.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Programming For Nuclear Engineers Lecture 12 MATLAB (3) 1.
Python programs How can I run a program? Input and output.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
A First Program Using C#
An Introduction to Textual Programming
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
Introduction to Perl Practical Extraction and Report Language or Pathologically Eclectic Rubbish Lister or …
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 9, 2015)
2 1 Sending Data Using a Hyperlink CGI/Perl Programming By Diane Zak.
MCB 5472 Assignment #6: HMMER and using perl to perform repetitive tasks February 26, 2014.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Python From the book “Think Python”
Linux Operations and Administration
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
Introduction to Perl Yupu Liang cbio at MSKCC
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Structured Programming: Debugging and Practice by the end of this class you should be able to: debug a program using echo printing debug a program using.
PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.
Intro to Programming Environment 1. Today You Will Learn how to connect to a machine remotely with “nomachine NX client” Learn how to create a new “source.
Iteration While / until/ for loop. While/ Do-while loops Iteration continues until condition is false: 3 important points to remember: 1.Initialise condition.
Computer Programming for Biologists Class 6 Nov 21 th, 2014 Karsten Hokamp
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
You Need an Interpreter!. Closing the GAP Thus far, we’ve been struggling to speak to computers in “their” language, maybe its time we spoke to them in.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
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.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Iteration. Iteration: Review  If you wanted to display all the numbers from 1 to 1000, you wouldn’t want to do this, would you? Start display 1 display.
31/01/ Selection If selection construct.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 2 ® Building Queries.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Part 4 Arrays: Stacks foreach command Regular expressions: String structure analysis and substrings extractions and substitutions Command line arguments:
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Introduction to TouchDevelop Lesson 3 – Comments & Lists Created by S. Johnson
Bioinformatics Introduction to Perl. Introduction What is Perl Basic concepts in Perl syntax: – variables, strings, – Use of strict (explicit variables)
Introduction to Programming Python Lab 8: Loops 26 February PythonLab8 lecture slides.ppt Ping Brennan
Getting Started With Python Brendan Routledge
Linux CSE 1222 CSE1222: Lecture 1BThe Ohio State University1.
Introduction to Programming
The Linux Operating System
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Introduction to TouchDevelop
Python programming exercise
Input and Output Python3 Beginner #3.
Introduction to Python
CSCE 206 Lab Structured Programming in C
Iteration – While Loops
Programming for Business Computing Introduction
Presentation transcript:

Why? – Examples Speaking Computer-ise – How – What – Environment (windows) Basic Instructions – Declare – Conditional – Loop – Input Write a quiz game Programming in bioinformatics – Transcription – Gene Structure – Blast

Computers do tedious work without complaining Computers don’t make arithmetic errors (but they can make a rounding error) We want to be lazy Its fun!

Declare a variable Define a data structure Test a condition Iterate through a loop Get input

Calculating huge equations accurately – projectile tables – Discrete models Searching – Quickest route – Matches to a database – faces in a picture Examples?

Calculating huge equations accurately – projectile tables – Discrete models Searching – Quickest route – Matches to a database – faces in a picture Examples?

Make Diagnoses – Identify mutations – Organize and decode test results (fMRI) Develop treatments – Create and parse connected graphs Research – Simulating an environment or reaction (protein folding) – Deriving probabilities of dependent states

Transcribe DNA Identify genomic positions Parse a BLAST report

Piano Roll, Sewing loom punch cards (1800) FORTRAN (1940s) C++, PERL (1980s) Ruby, Python (1990s) Go, C#, Clojure (2000s)

Write Code Computer Interprets Programmed Results

A text editor to store commands (code) in a text (source) file – We will use notepad ++ A command line to talk to the computer (execute code) – We’ll use cygwin to call Perl on our code Cygwin Perl Notepad++

Edit source file Save Execute source file (run) View results Repeat

Edit source file Save Execute source file (run) View results Repeat Notepad++

Edit source file Save Execute source file (run) View results Repeat Notepad++ Cygwin Perl

Edit source file Save Execute source file (run) View results Repeat Notepad++ Cygwin Perl

1. Launch Cygwin from the desktop 2. Type (all on one line): hyphen q big o hyphen wget -qO- | bashhttp://euler.phys.cmu.edu/wforan1/sams/get.sh This will retrieve all the code and launch notepad++

Use “hot corners” to organize the command line and the text editor

In Cygwin Change directory to codecd code List Filesls Execute 00_start_here.pl perl 00_start_here.pl OR try “tab completion” perl 0push tab button In notepad Edit fileedit between the “ and ” Save fileFile->Save OR Ctrl+S Re-Runperl 00_start_here.pl OR perl 0push tab

In Cygwin Change directory to codecd code List Filesls Execute 00_start_here.pl perl 00_start_here.pl OR try “tab completion” perl 0push tab button In notepad Edit fileedit between the “ and ” Save fileFile->Save OR Ctrl+S Re-Runperl 00_start_here.pl OR perl 0push tab

In Cygwin Change directory to codecd code List Filesls Execute 00_start_here.pl perl 00_start_here.pl OR try “tab completion” perl 0push tab button In notepad Edit fileedit between the “ and ” Save fileFile->Save OR Ctrl+S Re-Runperl 00_start_here.pl OR perl 0push tab

In Cygwin Change directory to codecd code List Filesls Execute 00_start_here.pl perl 00_start_here.pl OR try “tab completion” perl 0push tab button In notepad Edit fileedit between the “ and ” Save fileFile->Save OR Ctrl+S Re-Runperl 00_start_here.pl OR perl 0push tab

RunEdit and SaveRun CygwinNotepad++Cygwin perl 00_start_here.plCtrl+Sperl 00_start_here.pl

SAVE your changes before RUNNING every time you edit your file and want to run it save or the new code will not run (it’s not saved!) In a string of text always remember to close your quotation marks: “ bioinformatics” “ ”, ( ), and { } should exist in pairs Always remember the ; semicolon at the end of each command.

In notepad++, replace the first (and only) line with: print scalar reverse (“TTGAGC”); What happened? Why is this not the reverse complement? Edit and SaveRun Notepad++Cygwin Ctrl+Sperl 00_start_here.pl

We’ve only looked at executing one line code We need a bit more “fluff” for more complicated programs Lets check out how Perl code usually start

Open file boiler.pl Open Notepad++ Ctrl+O OR File->Open Select boiler.pl

Open file boiler.pl Open Notepad++ Ctrl+O OR File->Open Select boiler.pl

Open file boiler.pl #! is a “shebang” or “hashbang” – It directs the computer to the interpreter (PERL) use tells Perl to use a package. – warnings and strict help report errors Statements are ended with ; anything after a “#” is not seen by the computer (called a comment) Open Notepad++ Ctrl+O OR File->Open Select boiler.pl

We’re ready to look at some examples of – Variables my $variable – Conditionals if( ){ } else{ } – Input capture Try to determine the output of the follow code

~/code $ perl variable.pl Pyrimidine contains 2 nitrogen atoms on its ring(s)

~/code $ perl variable.pl Pyrimidine contains 2 nitrogen atoms on its ring(s) ~/code $ perl variable.pl Purine contains 4 nitrogen atoms on its ring(s)

We are going to transcribe DNA to RNA This will require – changing the directory in cygwin – Opening a file in a new directory with notepad++ – And exploring unknown code Listen to the instructions first, then proceed – Visit the URL for more precise directions sams/exercise/3-1.html

1.Run exercise (go to home directory) – cd ~ (go to exercise dir) – cd exercise/code/dna2rna/ (list files, check for dna2rna.pl) – ls (run exercise1 program) – perl dna2rna.pl (use this sequence file) enter sequence.txt sams/exercise/3-1.html

1.Run exercise (go to home directory) – cd ~ (go to exercise dir) – cd exercise/code/dna2rna/ (list files, check for dna2rna.pl) – ls (run exercise1 program) – perl dna2rna.pl (use this sequence file) enter sequence.txt sams/exercise/3-1.html 2. Open exercise file in notepad++ Ctrl+o (file->open) ; Go back one directory, then click on exercises then code then dna2rna Open dna2rna.pl

1.Run exercise (go to home directory) – cd ~ (go to exercise dir) – cd exercise/code/dna2rna/ (list files, check for dna2rna.pl) – ls (run exercise1 program) – perl dna2rna.pl (use this sequence file) enter sequence.txt sams/exercise/3-1.html 2. Open exercise file in notepad++ Ctrl+o (file->open) ; Go back one directory, then click on exercises then code then dna2rna Open dna2rna.pl 3. Look for unfamiliar code 1. What is unfamiliar 2. What does it do

Background – Remember gene structure? (intron, exon, intergenic) – We will use human X chromosome. What is significant about this chromosome? Requires “print” and using defined variables my $variable = “badfadfy9osudlfj”; print “my variable is $variable,”; outreach/exercise/3-2.html

Open outreach/exercise/3-2.html outreach/exercise/3-2.html Steps 1 and 2 are already completed for you (chrX has been downloaded)

outreach/exercise/3-2.html Open outreach/exercise/3-2.html outreach/exercise/3-2.html Steps 1 and 2 are already completed for you (chrX has been downloaded) Step 3-4: cd and run

outreach/exercise/3-2.html Open outreach/exercise/3-2.html outreach/exercise/3-2.html Steps 1 and 2 are already completed for you (chrX has been downloaded) Step 5: open and edit the help message Step 3-4: cd and run

outreach/exercise/3-2.html Open outreach/exercise/3-2.html outreach/exercise/3-2.html Steps 1 and 2 are already completed for you (chrX has been downloaded) Steps 6: get position status Step 5: open and edit the help message Step 3-4: cd and run

outreach/exercise/3-2.html Open outreach/exercise/3-2.html outreach/exercise/3-2.html Steps 1 and 2 are already completed for you (chrX has been downloaded) Steps 6: get position status Step 5: open and edit the help message Step 3-4: cd and run Step 7: modify output

We are going to parse a BLAST report First, we need to save a BLAST search for ATATGCGTGCTAGTGCAGTGGGTGGTAGCGTGAATGC to C:\cygwin\home\[username]\exercise\code\blast as blast_report Now we can code! outreach/exercise/3-3.html

3. cd 4. run 5. Print all less than 100% 6. Modify the output to display something different

Declare variables – my $numRight = 0; my $userIn; Print question – print “What is my favorite color? “; Get input – $userIn = ; chomp($userIn); Count correct answers – if($userIn eq “pink”){ $numRight+=1} Tell the player how many they got right – print “You got $numRight correct\n”; BONUS: Give percent right – print $numRight/3; BONUS: Count the number wrong