Introduction to Bioinformatic Computation. Lecture

Slides:



Advertisements
Similar presentations
Mod_perl High speed dynamic content. Definitions Apache – OpenSource httpd server Perl – OpenSource interpreted programming language mod_perl – OpenSource.
Advertisements

Lecture 6 More advanced Perl…. Substitute Like s/// function in vi: #cut with EcoRI and chew back $linker = “GGCCAATTGGAAT”; $linker =~ s/CAATTG/CG/g;
Painless Perl Modules Fernando J. Pineda Biostat computing club 2013/2/21.
Getting Organised Subroutines, modules and the wonder of CPAN.
Perl Programming: Developing Key Tools for Bioinformatics An Informative Look Behind the Importance of Programming Skills and Brief Tutorial on Getting.
CS311 – Today's class Perl – Practical Extraction Report Language. Assignment 2 discussion Lecture 071CS Operating Systems I.
Introduction to bioperl. What is perl? Production Engineering Research Laboratory Practically Everything Really Likeable Pre-positioned Equipment Requirement.
11ex.1 Modules and BioPerl. 11ex.2 sub reverseComplement { my ($seq) $seq =~ tr/ACGT/TGCA/; $seq = reverse $seq; return $seq; } my $revSeq = reverseComplement("GCAGTG");
Installing Bioperl Perl and BioPerl are both open source projects
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.
13.1 Wrapping up Running Other Programs 13.3 You may run programs using the system function: $exitValue = system("blastall.exe..."); if ($exitValue!=0)
Bioperl modules.
Julie McEnery1 Installing the ScienceTools The release manager automatically compiles each release of the Science Tools, it creates a set of wrapper scripts.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
LING 581: Advanced Computational Linguistics Lecture Notes April 12th.
Introduction to Perl Part III By: Cedric Notredame Adapted from (BT McInnes)
– Intermediate Perl 8/27/ Intermediate Perl - modules Intermediate Perl – Session 5 · modules · CPAN.
Public Resources (II) – Analysis tools  Web-based analysis tools – easy to use, but often with less customization options.  Stand-alone analysis tools.
(c) Bob McKillop, 2006Tutorial #1 T1-1 Tutorial #1 - your first compiled code  the learning objectives for this tutorial are very modest q compile and.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
More Modules Inheritance, Exporting, documentation, testing.
Apache Web Server v. 2.2 Reference Manual Chapter 1 Compiling and Installing.
Managing Software Patches 10/15/ Introducing Solaris OE Patches A patch contains collection of files and directories Patch replaces existing files.
CSS Linux and Eclipse 1. CSS Account Log into your CSS account with the NoMachine client (NX client) 2.
12.1 Running Other Programs And CGI Scripts Please fill the teaching survey at: I read it closely, and I.
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
Introduction to Perl Part III By: Bridget Thomson McInnes 6 Feburary 2004.
How to write & use Perl Modules. What is a Module? A separate Namespace in a separate file with related functions/variables.
What is a port The Ports Collection is essentially a set of Makefiles, patches, and description files placed in /usr/ports. The port includes instructions.
Paris package: practical aspects Installation / presentation To run a simulation Analysis To add a new module to Paris Installation / presentation To run.
Reading and Mapping Aerosol Data From a MODIS HDF4 File
Track Short Course: TrackRT Installation Thomas Herring, MIT Room A
Parsing BLAST output. Output of a local BLAST search “less” program Full path to the BLAST output file.
BioPerl Ketan Mane SLIS, IU. BioPerl Perl and now BioPerl -- Why ??? Availability Advantages for Bioinformatics.
An Overview of Perl A language for Systems and Network Administration and Management: An overview of the language.
March 21, 2003 Fabrizio Coccetti - Stanford Linear Accelerator Center1 How to write Perl Modules Some practical advice about how to build a perl module.
Bioinformatics for biologists Dr. Habil Zare, PhD PI of Oncinfo Lab Assistant Professor, Department of Computer Science Texas State University Presented.
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)
Introducing Bioperl Toward the Bioinformatics Perl programmer's nirvana.
Advanced Perl For Bioinformatics Part 1 2/23/06 1-4pm Module structure Module path Module export Object oriented programming Part 2 2/24/06 1-4pm Bioperl.
1 Using Perl Modules. 2 What are Perl modules?  Modules are collections of subroutines  Encapsulate code for a related set of processes  End in.pm.
Perl Subroutines User Input Perl on linux Forks and Pipes.
Installation and environment variables. Simple Installation 1 The latest sources can always be obtained from the CDAT website:
Lecture 9: Basic concepts of Perl Modules. Functions (Subs) In perl functions take the following format: – sub subname – { my $var1 = $_[0]; statements.
Foundations of Programming: Java
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
Introduction to Perl: Practical extraction and report language
Python’s Modules Noah Black.
Modules and BioPerl.
Install external command line softwares
Introduction to Bioinformatic Computation. Lecture #
PERL.
By Jonathan Rinfret CREATING A BASH SCRIPT By Jonathan Rinfret
9/13/ :29:51 AM.
Introduction to Bioinformatic Computation. Lecture
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
Perl for Bioinformatics
LING 581: Advanced Computational Linguistics
Modules A Perl module is a self-contained piece of Perl code that can be used by a Perl program or by other Perl modules. It is conceptually similar to.
Modification of the bioperl script for parsing BLAST output
Lesson 2. Control structures File IO - reading and writing Subroutines
Intro to PHP.
LING/C SC 581: Advanced Computational Linguistics
Extending Languages.
Introduction to Bioinformatic Computation. Lecture #
Introduction to Bioinformatic Computation. Lecture #
Web Application Development Using PHP
Presentation transcript:

Introduction to Bioinformatic Computation. Lecture 6 02-22-2010 Objectives for today Packages, Modules, Objects /home/afedorov/IBC1_PROGRAMS/LECTURE13

prog_log #!/usr/bin/perl/ use POSIX qw(log10); $r = 10000; $log = log10($r); print $log, "\n";

export PERL5LIB=/home/foobar/code echo PERL5LIB perl INC export PERL5LIB=/home/foobar/code echo PERL5LIB perl INC.pl http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations

#!/usr/local/bin/perl #color.pl program #http://perl.active-venture.com/lib/Term/ANSIColor.html use Term::ANSIColor; print color 'bold blue'; print "This text is bold blue.\n"; print color 'reset'; print "This text is normal.\n"; print colored ("Yellow on magenta.\n", 'yellow on_magenta'); print colored ['yellow on_magenta'], "Yellow on magenta.\n"; use Term::ANSIColor qw(uncolor); print uncolor '01;31', "\n"; use Term::ANSIColor qw(:constants); print BOLD, BLUE, "This text is in bold blue.\n", RESET; $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\n";

prog_INC #!/usr/local/perl $i=0; foreach $x (@INC) {printf "%d %s\n", $i++, $x}

Our previous approach: invocation of a perl program by another perl script (EID, lecture 9) makeEID.pl first_parse.pl check_translations.pl finalmakeCHECK.pl

more makeEID.pl #!/usr/bin/perl -w # Serge Saxonov, Iraj Daizadeh, Alexei Fedorov, Walter Gilbert ($#ARGV != -1) || die "Usage: $0 prefix\n"; $prefix = $ARGV[0]; unless(-e "seqfiles.list"){ die "Need to have seqfiles.list in the current directory\n"; } system("perl first_parse.pl $prefix"); system("cat $prefix.RAW |perl check_translations.pl $prefix"); system("rm -f $prefix.RAW"); system("finalmakeCHECK.pl $prefix"); system("rm -f $prefix.RAWchecked");

New approach: invocation of a perl program from a module (file with New approach: invocation of a perl program from a module (file with .pm on the end) In your perl script write: use Module_name; (let’s, for example, look at our bioperl programs)

Examples of Bioperl COMPUTER: mco321125.mco.edu DIR: /home/afedorov/IBC1_PROGRAMS/LECTURE13 bioperl_test.pl (bring the information about my sequence from the web) bioperl_blast.pl (open NCBI blast web site and perform blast of my sequence)

more bioperl_blast.pl #!/usr/local/perl use Bio::Perl; $seq = get_sequence('swiss',"ROA1_HUMAN"); # uses the default database - nr in this case $blast_result = blast_sequence($seq); write_blast(">roa1.blast",$blast_result);

Modification of bioperl_blast.pl for obtaining another alignment vi bioperl_blast.pl Change line 4 (input: MALK_ECOLI) Change line 7 (output file)

find / -name Perl.pm –print >where_is_Perl.pm /usr/lib/perl5/site_perl/5.8.0/Bio/Perl.pm

more /usr/lib/perl5/site_perl/5.8.0/Bio/Perl.pm Other modules inside Perl.pm use vars qw(@ISA @EXPORT @EXPORT_OK $DBOKAY); use strict; use Carp; use Exporter; use Bio::SeqIO; use Bio::Seq;

Bioperl http://www.bioperl.org/ BioPerl 1.4 Tutorial Pasteur Institute Bioperl Course BioPerl 1.4 Module Documentation

Additional information on www.bioperl.org Getting Started Just learning about perl and computational biology? Read Lincoln Stein's classic article, "How Perl Saved the Human Genome Project" Join a Bioperl mailing list Visit perl.com Find a local users group The International Society for Computational Biology (iscb.org)

Is it possible to accomplish our project using available modules? NO However, you, probably, could perform some very helpful steps using Bioperl and other modules.

http://www.perl.com/CPAN/ CPAN is the Comprehensive Perl Archive Network, a large collection of Perl software and documentation. 6200 modules available CPAN Frequently Asked Questions

Definition of Package Cookbook pp395-400 Package is a compile-time declaration that sets the default package prefix for unqualified global identifiers Any variable not declared with my is associated with a package $current_package = __PACKAGE__;

PACKAGE [afedorov@intron BIOPERL]$ more test_package.pl #!/usr/local/perl package Alpha; $name = 'first'; package Omega; $name = 'last'; package main; print " Alpha is $Alpha::name Omega is $Omega::name \n";

Definition of module Traditional modules (define subroutines and variables for the caller to import and use) Object-oriented modules (outside the scope of this course)

MODULE example more MYTEST.pm package MYTEST; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use Exporter; $VERSION = 1.00; @ISA = qw(Exporter); ################################### #PUT WHATEVER YOU WANT HERE our $test = 5; our $seq1 = 'atg'; our $seq2 = 'fdndidfdndfkf'; our @array = ('a', 't', 'g', 'c'); 1;

more test2.pl #!/usr/local/perl use MYTEST; print "value is $MYTEST::seq1 \n array is @MYTEST::array \n";

Export variables and functions more TestExport.pm package TestExport; use strict; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use Exporter; $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw($seq1 @array); ################################### #PUT WHATEVER YOU WANT HERE our $test = 5; our $seq1 = 'atg'; our $seq2 = 'fdndidfdndfkf'; our @array = ('a', 't', 'g', 'c'); 1;

Export variables and functions from a module more test3.pl #!/usr/local/perl use TestExport; print "seq1 is $seq1 \n seq2 is $seq2 \n array is @array \n";

Export variables and functions from a module by a request Inside a module create a line @EXPORT_OK =qw(&alexei %fedorov); Load the module with the request for your variables use YourModule qw(alexei %fedorov);

%EXPORT_TAGS %EXPORT_TAGS = ( Variables1 => [qw($seq1 Seq2 alexei)], Var2 => [qw(@array, $seq2 %fedorov], ); use YourModule qw(:Variables1 @array);

How to prepare a module in a standard distribution format COMMAND LINE: h2xs –XA –n OurFirstModule perl Makefile.PL make dist (to create name.tar.gz file)

RepeatMasker program (lecture 11) use Getopt::Long; use POSIX qw(:sys_wait_h); use File::Copy; use File::Basename; use Cwd;

How to install a module (example Bioperl in INTRON) Get step by step instructions from web sites (CPAN, bioperl, etc) Example: read INSTALL file (in bioperl ->download ->docs) >gunzip bioperl-1.2.tar.gz >tar xvf bioperl-1.2.tar >cd bioperl-1.2

What’s inside @INC array? (INTRON ~/BIOPERL) [afedorov@intron BIOPERL]$ perl prog_INC 0 /usr/lib/perl5/5.8.0/i386-linux-thread-multi 1 /usr/lib/perl5/5.8.0 2 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi 3 /usr/lib/perl5/site_perl/5.8.0 4 /usr/lib/perl5/site_perl 5 /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi 6 /usr/lib/perl5/vendor_perl/5.8.0 7 /usr/lib/perl5/vendor_perl 8 .

BIOPERL INSTALL FILE THE EASY WAY The Bioperl modules are distributed as a tar file in standard perl CPAN distribution form. This means that installation is very simple. Once you have unpacked the tar distribution there is a directory called bioperl-xx/, which is where this file is. Move into that directory (you may well be already in the right place!) and issue the following commands: perl Makefile.PL # makes a system-specific makefile make # makes the distribution make test # runs the test code make install # [may need root access for system install. # See below for how to get around this.]

tar xvf current_core_stable.tar cd bioperl-1.4 su – make install

BIOPERL TUTORIAL perl bptutorial.pl 1 perl bptutorial.pl 9 perl bptutorial.pl 100 swiss perl bptutorial.pl 100 Bio::Tools::SeqStats