96 summer
Download
Skip this Video
Download Presentation
96-Summer 生物資訊程式設計實習 ( 二 )

Loading in 2 Seconds...

play fullscreen
1 / 28

96-Summer 生物資訊程式設計實習 ( 二 ) - PowerPoint PPT Presentation


  • 71 Views
  • Uploaded on

96-Summer 生物資訊程式設計實習 ( 二 ). Bioinformatics with Perl 8/13~8/22 蘇中才 8/24~8/29 張天豪 8/31 曾宇鳯. Schedule. Process Management. Introduction. Introduction. system system(“date”); ` ` `date`; exec exec(“date”);. Introduction - system. system (“ … ”); Example system “date”;

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' 96-Summer 生物資訊程式設計實習 ( 二 )' - tallulah-ramos


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
96 summer

96-Summer生物資訊程式設計實習(二)

Bioinformatics with Perl

8/13~8/22 蘇中才

8/24~8/29 張天豪

8/31 曾宇鳯

process management

Process Management

Introduction

introduction
Introduction
  • system
    • system(“date”);
  • ` `
    • `date`;
  • exec
    • exec(“date”);
introduction system
Introduction - system
  • system (“ … ”);
  • Example
    • system “date”;
    • system 'ls', "-al", '/home/course1/';
    • system ‘for i in *; do echo == $i ==; cat $i; done’;
    • system “~/course5/output.pl”;
  • Return 0 if success
execute date by system
Execute ‘date’ by system

#!/usr/bin/perl -w

# date1.pl : execute a shell command - date

my $ret = system "date";

print "return = $ret\n";

execute date by system without message
Execute ‘date’ by system without message

#!/usr/bin/perl -w

# date2.pl : execute a shell command - date

my $ret = system "date > /dev/null";

print "return = $ret\n";

introduction1
Introduction - ` `
  • ` … `
  • Example
    • $now = `date`;
    • $result = `ls –al /home/course1/`;
    • $result = `for i in *; do echo == $i ==; cat $i; done`;
    • `~/course5/output.pl`;
execute date by system without message1
Execute ‘date’ by system without message

#!/usr/bin/perl -w

# date3.pl : execute a shell command - date

my $ret = `date`;

print "return = [$ret]\n";

print message to stdout and stderr
Print message to STDOUT and STDERR

#!/usr/bin/perl -w

# output.pl : output a message to STDOUT and STDERR

print STDOUT "print to STDOUT\n";

print STDERR "print to STDERR\n";

print message to stdout and stderr1
Print message to STDOUT and STDERR

[course5]$ ./output.pl

print to STDOUT

print to STDERR

[course5]$ ./output.pl > log

print to STDERR

[course5]$ cat log

print to STDOUT

[course5]$ (./output.pl 2>&1) > log

[course5]$ cat log

print to STDOUT

print to STDERR

execute date by system without message2
Execute ‘date’ by system without message

#!/usr/bin/perl -w

# redirect.pl : STDOUT and STDERR

my $ret = system "./output.pl";

print "redirect nothing ($ret)\n";

$ret = system "./output.pl 1>/dev/null";

print "redirect STDOUT to /dev/null ($ret)\n";

$ret = system "./output.pl 1>/dev/null 2>&1";

print "redirect STDOUT and STDERR to /dev/null ($ret)\n";

print message to stdout and stderr2
Print message to STDOUT and STDERR

#!/usr/bin/perl -w

# exec_output1.pl : execute output.pl

my $ret = `./output.pl`;

chomp($ret);

print "return = [$ret]\n";

print message to stdout and stderr3
Print message to STDOUT and STDERR

#!/usr/bin/perl -w

# exec_output2.pl : execute output.pl

my $ret = `./output.pl 2>&1`;

chomp($ret);

print "return = [$ret]\n";

slide15
%ENV
  • Shell command
    • env
  • Example
    • $ENV{‘PATH’}
    • $ENV{‘HOME’}
    • $ENV{‘HOSTNAME’}
    • $ENV{‘USER’}
slide16
%ENV

#!/usr/bin/perl -w

# env.pl : execute a shell command - env

my @ret = `env`;

foreach (@ret) {

chomp;

if (/PATH/) {

print "$_\n";

}

}

print "PATH=$ENV{'PATH'}\n";

process management1

Process Management

Arguments, Here-document

arguments parsing
Arguments parsing

use Getopt::Std;

getopts( "hvf:", \%opt ) or usage();

usage() if $opt{h};

usage() if (!defined{$opt{f});

sub usage()

{

print STDERR << "EOF";

usage: $0 [-hv] [-f file]

-h : this (help) message

-v : verbose output

-f file : file containing usersnames, one per line

example: $0 -v -f file

EOF

exit;

}

here document
Here-document

print <

print me!!!!

print you!!!!

print us!!!!

EOF

print << x 3;

print me!!!!

exercise

Exercise

system and ` `

quiz system
Quiz – system & ` `
  • Are they workable ?
    • system ‘for i in *; do echo == $i ==; cat $i; done’;
    • $result = `for i in *; do echo == $i ==; cat $i; done`;
  • Why ?
quiz sleep10 pl
Quiz – sleep10.pl

#!/usr/bin/perl -w

# sleep10.pl : sleep 10 seconds

foreach (1..10) {

print "$_\n";

sleep 1;

}

quiz system1
Quiz – system & ` `
  • Do they execute by background mode?
    • system ‘./sleep10.pl &’;
    • $result = `./sleep10.pl &`;
  • Why ?
project

Project

BLAST, ClustalW

project1 blast
Project1 - BLAST
  • Todo
    • Get the result from Blast
    • Extract its homology (evalue <= 10^-1)
  • Input
    • A protein sequence (FASTA format)
  • Output
    • All homologous sequences of the query sequence
blast
BLAST
  • Get BLAST packages
    • ftp://ftp.ncbi.nih.gov/blast/
  • Get nr database
    • ftp://ftp.ncbi.nih.gov/blast/db/
  • Command
    • ~/tools/PSSM/BLAST/blastall -p blastp -i P53_HUMAN.fa -o output.txt -d /home/sbb/tools/PSSM/BLAST/db/SwissProt.v50.fa –m 9
project2 clustalw
Project2 - ClustalW
  • Todo
    • do multiple sequence alignment by ClustalW
  • Input
    • A protein sequence with its homology (FASTA format)
  • Output
    • The conserved score of each residue in the query sequence
clustalw
ClustalW
  • Get ClustalW package
    • ftp://ftp.ebi.ac.uk/pub/software/unix/clustalw/
  • Command
    • ./clustalW
ad