Perl R and SQL for the very beginners Christoph Rau, Calvin Pan and Yehudit Hasin Dec 2011.

Slides:



Advertisements
Similar presentations
Introduction Windows Explorer This tutorial will explain some aspects of file management using Windows Explorer This tutorial will explain some aspects.
Advertisements

A Guide to Unix Using Linux Fourth Edition
The Linux Operating System Lecture 6: Perl for the Systems Administrator Tonga Institute of Higher Education.
Bioinformatics is … - the use of computers and information technology to assist biological studies - a multi-dimensional and multi-lingual discipline Chapters.
Chapter 1 Computing Tools Data Representation, Accuracy and Precision Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
Perl Functions Learning Objectives: 1. To learn how to create functions in a Perl’s program & how to call them 2. To learn how to pass [structured] arguments.
Scripting Languages Perl Chapter #4 Subroutines. Writing your own Functions Functions is a programming language serve tow purposes: –They allow you to.
Introduction to a Programming Environment
Guide To UNIX Using Linux Third Edition
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 8: Perl Basics Fundamentals of Web Programming.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
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.
Computer Science 101 Introduction to Programming.
Introduction to Perl Thaddeus Aid IT Learning Programme University of Oxford 15/04/2014.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
Introduction to Perl Practical Extraction and Report Language or Pathologically Eclectic Rubbish Lister or …
Advanced Web Design Scripting Tutorial Chapters. Scripting Intro The scripting part of the forthcoming Advanced Web Design textbook introduces you to.
Perl Tutorial Presented by Pradeepsunder. Why PERL ???  Practical extraction and report language  Similar to shell script but lot easier and more powerful.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Programming in Python Part I Dr. Fatma Cemile Serçe Atılım University
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Computer Science 101 Introduction to Programming.
Digital Text and Data Processing Week 1. □ Future of reading? □ Understanding “Machine reading”: □ Text analysis tools □ Visualisation tools Course background.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
Component 4: Introduction to Information and Computer Science Unit 4: Application and System Software Lecture 3 This material was developed by Oregon Health.
CS 105 Perl: Course Introduction Nathan Clement 13 May 2014.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
Topic 1: Welcome CSE2395/CSE3395 Perl Programming.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2010.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Bioinformatics Introduction to Perl. Introduction What is Perl Basic concepts in Perl syntax: – variables, strings, – Use of strict (explicit variables)
Introduction to Perl Yupu Liang cbio at MSKCC
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
Introduction to Unix – CS 21
Programming Perl in UNIX Course Number : CIT 370 Week 6 Prof. Daniel Chen.
Introducing System Managers to Win32 Perl Programming Tim Christian College of Arts and Sciences Computing Support Services.
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.
ECET – Dynamic Programming with Python Spring 2013 Lecture L1 – Introduction to Python Page 1 Welcome! This is Professor Jai P. Agrawal. I will walk.
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Introduction to Perl NICOLE VECERE. Background General Purpose Language ◦ Procedural, Functional, and Object-oriented Developed for text manipulation.
Introduction to MATLAB 7 Engineering 161 Engineering Practices II Joe Mixsell Spring 2012.
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
 History  Ease of use  Portability  Standard  Security & Privacy  User support  Application &Popularity Today  Ten Most Popular Programming Languages.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Chapter 4 Software. Introduction Program: is a set of sequence instructions that tell the computer what to do. Software: is a collection of programs,
ITP 109 Week 2 Trina Gregory Introduction to Java.
PZ02CX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ02CX - Perl Programming Language Design and Implementation.
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
Bioinformatics Introduction to Perl. Introduction What is Perl Basic concepts in Perl syntax: – variables, strings, – Use of strict (explicit variables)
Perl Subroutines User Input Perl on linux Forks and Pipes.
Perl Ed Finegan. Overview of Pearl Perl is a high-level programming language written by Larry Wall. It derives from the C programming language and to.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Week Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
Perl A language for Systems and Network Administration and Management.
Scripting Languages Course 7 Diana Trandab ă ț Master in Computational Linguistics - 1 st year
Introduction to Perl: Practical extraction and report language
PERL.
Perl Programming Language Design and Implementation (4th Edition)
Programming Basics Web Programming.
CS190/295 Programming in Python for Life Sciences: Lecture 1
Presentation transcript:

Perl R and SQL for the very beginners Christoph Rau, Calvin Pan and Yehudit Hasin Dec 2011

What we do and do not intend to teach Get you started as painlessly as possible Make you able to write simple, usable and sustainable code for yourself Make you comfortable to expand your knowledge on your own Give you the right address(es) for asking questions DO DO NOT Make you change career to a programmer Replace self – learning process Make you an expert

Dates 12/8 – Introductions + Perl1 - Yehudit 12/15 – Perl 2 – Yehudit 12/22-12/29 – NO MEETINGS 1/5 – Perl 3 – Yehudit 1/12 – Perl 4 – Yehudit 1/19 – R 1 - Christoph 1/26 – R2 - Christoph 2/2 – R3 – Christoph 2/9 – SQL1 - Calvin 2/16 –SQL2 - Calvin

Today Introduction – Why Perl/R/SQL? – What is a programing language? – GPP – good programming practice Perl 1 – My first program – Data types – Data organization – Simple operators

Why Perl/R/SQL and not Excel? Flexibility Speed Reproducibility ✗ Responsibility ✗ More work ✗ Safety

Why Perl & R & SQL? Perl RSQL Manipulation of LARGE data files Text patterns Fast Efficient data storage and retrieval Statistical analysis Graphing capabilities Analysis packages

What is “programming” and why it is a language? “ Language ” – The words, their pronunciation, and the methods of combining them used and understood by a community A body of words and the systems for their use common to a people who are of the same community or nation, the same geographical area, or the same cultural tradition: the two languages of Belgium; a Bantu language; the French language; the Yiddish language. The system of linguistic signs or symbols considered in the abstract. Any set or system of such symbols as used in a more or less uniform fashion by a number of people, who are thus enabled to communicate intelligibly with one another. Any system of formalized symbols, signs, sounds, gestures, or the like used or conceived as a means of communicating thought, emotion, etc.

Adapt your thinking Personal interpretation Associative thinking Initiative Learning from past experience Computer does EXACTLY and EVERYTHING you tell it to

What is wrong with that program? “I would like you to clean my desktop” Clean (desktop);

What is wrong with that program? “Go to desktop folder” “For each file examine if it has the words “data”, when it was last opened and size” If opened more than a year ago and is smaller than 1Mb and does not contain the word “data” – delete.

Why Perl/R/SQL and not Excel? Flexibility Speed Reproducibility ✗ Responsibility ✗ More work ✗ Safety

Good Programming Practice or super fast safety course

When you cut out the middle man

Good Programming Practice Have a dedicated folder to optimize your scripts Have a small file, with similar structure to the data file, to test your script (usually just get sample rows). Give meaningful names to scripts, variables, files etc… Document your code Backup, backup………really BACKUP Good Bad and ugly ✗ Run scripts in any directory higher than Desktop ✗ Optimize your script on a REAL data file ✗ Use “temp”, “x”, “David1” or similar for naming ✗ Assume that your script is perfect

Beginning Perl Chapter1

Perl – “Beginning Perl” (Simon Cozens, Peter Wainwright) Resources The main perl website The book I use as scaffold …/books/beginning-perl/ Very good documentation for all perl functions The best forum about perl for all levels For modules and their documentation:

What I hope to cover Data types Data structures – variable, array, hash Loops and conditional statements – “if”, “for”, “foreach”, “while”, “unless” etc….. Open, read write and close files Functions – modules, subroutines Regular expressions

Perl scripts are simple text files #!/usr/bin/perl use strict; use warnings; print "Hello!!!! :)))"; Get a free editor – the one you will like better Macs: Text Wrangler (simpler) or Komodo…. Windows: Padre, Komodo…..

#!/usr/bin/perl –w use strict ; use warnings ; print "Hello!!!! :)))\n” ; Tells unix where perl resides End of statement Quotations mean it is a string Keyword (a word that is in perl vocabulary, in this case function) Tells perl to be more verbal about mistakes in code

Perl - types of Data Data can be a number or a string Data can be organized in scalar – a single value list – can hold multiple values Perl special signs: $xx= variable – can hold any one value array – can hold multiple values (list).