Download presentation
Presentation is loading. Please wait.
Published byAmberly Sutton Modified over 9 years ago
1
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp (kahokamp@tcd.ie) http://bioinf.gen.tcd.ie/GE3M25/programming Fill out survey, please!
2
Computer Programming for Biologists Classes: Lectures interspersed with excercises and practicals Exam: 2-hour exam during last double lecture (11 th Dec) Organisation
3
Class I: Overview and Motivation What is computer programming? Why do we need computer programming? How do we program computers? Questions
4
Class I: Overview and Motivation Write shell scripts Write programs Write one-liners Automate tasks What is and what is not computer programming? x E-mailing x Web browsing x Run programs
5
Class I: Overview and Motivation Increase of data led to greater need for computational methods Informatics (computer science) + Biology = Bioinformatics also: Computational Biology The greater context: Bioinformatics
6
Class I: Overview and Motivation Automate tasks Modify existing programs Combine programs Increase control New ‘laboratory’ skill Why do we need computer programming?
7
Class I: Overview and Motivation Scientific research Efficiency Not only for biological data Data (re-)formatting and extraction File organization, backups, etc. Use of programming
8
Class I: Overview and Motivation Pick a programming language Learn the basics Start writing programs Practice and improve How do we program computers?
9
Practical! http://scratch.mit.edu Example programming with Scratch
10
Class I: Overview and Motivation Programming languages (examples) Faster development, slower execution Slower development, faster execution InterpretedCompiled Perl Python Ruby Scratch C C++ Java Swift
11
Quick development cycle Easy to learn Wide-spread use Great for text processing Many bioinformatics extensions Class I: Overview and Motivation Advantages of Perl
12
Access through console or terminal Use of keyboard instead of mouse Class I: Overview and Motivation The command line shell prompt
13
Next Unix Basics
14
Unix File Hierarchy bin root (/) etc data Users lib sbin sw tmp usr var
15
User-related folders bin root (/) etc data Users lib sbin sw tmp usr var core programs home directories user programs and packages temporary storage space
16
Home directories bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4
17
Login location bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 user2 $ prompt
18
Print working directory (pwd) bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 command user2 $pwd
19
Print working directory (pwd) bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 user2 $ output: full path pwd user2 $ /home/user2 user2 $pwd /Users/user2 separator
20
change to new location in file hierarchy user2 $cd Desktop user2 $ pwd /Users/user2/Desktop Change directory bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 Desktop Documents command argument
21
Change directories bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 Deskto p Documents go to previous directorycd - go to upper directorycd.. go to home directorycd
22
Path specifications bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 Desktop Documents absolute/Users/user2/Desktop ~/Desktop relative../Documents
23
Create new directory bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 user2 $ pwd user2$/home/user2 user2 $ mkdir class1 user2 $mkdir class1 user2 $mkdir ‘test dir’ Desktop
24
Create new directory bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 Two new directories (or folders) created class1 test dir Desktop
25
Special directories bin root (/) etc data Users lib sbin sw tmp usr var user2 user1 user3 user4 upper directory.. (two dots) home directory~ (tilde) current directory. (single dot) class1 test dir Desktop
26
Other commands move or rename file or directorymv create a directorymkdir remove empty directoryrmdir remove filerm listing of directory (defaults to current directory) ls change directory (defaults to home directory) cd
27
Find more information! man ls ls –h ls –help ls --help Manual pages for Unix tools: EMBnet Quick Guides: A Quick Guide to UNIX A Quick Guide to PERL A Quick Guide to PERL Regular Expressions http://www.embnet.org/embnet-quickguides
28
Practical! A few exercises to get you familiar with the command line and the Unix environment…. Go to: http://bioinf.gen.tcd.ie/GE3M25/programming/class1 and click on the ‘UNIX’ topic. I hear and I forget. I see and I remember. I do and I understand. Confucius, Chinese philosopher & reformer (551 BC - 479 BC )
29
# My first Perl program # define the message $text = "Hello World!\n"; # print message to screen print $text; exit; Class I: First Program Perl example
30
# My first Perl program # define the message $text = "Hello World!\n"; # print message to screen print $text; exit; Class I: First Program Perl example comments variableassignmentstringspecial character built-in function Statements end with semicolon!
31
Save script to a file (e.g. hello.pl) Pass on to interpreter: $ perl hello.pl Hello World! $ Class I: First Program Running the script
32
Shell calls interpreter (perl) Passes on code (script) Syntax check Translation into operational code Execution Class I: First Program Perl flow
33
What to do when things go wrong, e.g. Take a good look at the error message Check syntax Class I: First Program Perl errors syntax error at hello.pl line 7, near "print" Execution of hello.pl aborted due to compilation errors.
34
Practical! A few exercises to get you started with writing and running Perl scripts …. Go to: http://bioinf.gen.tcd.ie/GE3M25/programming/class1 and click on the ‘Editor’ topic.
35
Perl on a Windows PC Perl Installations a)CygWin (http://www.cygwin.com) Unix environment for Windows, includes Perl b)ActiveState Perl http://www.activestate.com/activeperl/downloads any version 5.x c) Strawberry Perl: (http://strawberryperl.com) Perl Source and Binaries: http://www.perl.org/get.html
36
Computer Programming for Biologists References James Tisdall, Beginning Perl for Bioinformatics, O’Reilly Free online books: http://www.perl.org/books/library.html R.L. Schwartz, Learning Perl, O’Reilly
37
Next week: A short online quiz Introduction of the course project More Perl
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.