r bioinformatics analysis in perl n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
R 於微陣列數據分析 - Bioinformatics analysis in Perl - PowerPoint Presentation
Download Presentation
R 於微陣列數據分析 - Bioinformatics analysis in Perl -

Loading in 2 Seconds...

play fullscreen
1 / 30

R 於微陣列數據分析 - Bioinformatics analysis in Perl - - PowerPoint PPT Presentation


  • 116 Views
  • Uploaded on

R 於微陣列數據分析 - Bioinformatics analysis in Perl -. 教師 : 黃宣誠 老師 助教 : 林振慶 E-mail: kdragongo@gmail.com. Outline. Perl Basics. Perl Installation. http://www.activestate.com/activeperl. Look of perl. Syntax. Variables. $ var scalar @ var array % var hash ; #.

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 'R 於微陣列數據分析 - Bioinformatics analysis in Perl -' - ringo


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
r bioinformatics analysis in perl

R於微陣列數據分析-Bioinformatics analysis in Perl-

教師: 黃宣誠 老師

助教: 林振慶

E-mail: kdragongo@gmail.com

perl installation
Perl Installation
  • http://www.activestate.com/activeperl
variables
Variables
  • $var
    • scalar
  • @var
    • array
  • %var
    • hash
  • ;
  • #
control flow condition
Control Flow (Condition)
  • if(condition1)
  • elsif(condition2)
  • else
  • unless(condition1)
  • else
  • Ternary operator - ?
    • $a = ($b > 5) ? “yes” : “no”;
true or false
True or False
  • False
    • 0
    • ‘0’、”0”、’’、””
    • undef
    • Undefined value
  • True
    • others
control flow loop
Control Flow (Loop)
  • while (condition)
  • until (condition)
  • for(condition)
  • foreach(array)
  • last and next
    • last: exit this loop
    • next: ignore below statements
scalar
Scalar
  • $
    • $A = 55;
    • $B = “55”;
    • $C = ‘Hello Perl!\n’;
    • $D = “Hello Perl!\n”
    • $E = \$A;
    • +, -, *, /, %, **,
  • <STDIN>
array
Array
  • @
    • @Empty = ();
    • @A = (1, 2, 3); @B = (‘a’, ‘b’, ‘c’);
    • $A[0] == 1
    • $A[0] = 4;
    • @A == (4, 2, 3)
    • @C = (@A, @B);
array operator
Array operator
  • pop @A:Pick up an element from the end of array
  • push @A:Add an element to the end of array
  • shift @A:Pick up an element from the top of array
  • unshift @A:Add an element to the top of array
  • @A = @B;
  • reverse @A
  • sort @A :follow the order of ASCII code
    • sort {$a <=> $b} @A:from small to big
    • sort {$b <=> $a} @A:from big to small
hash the soul of perl
Hash (the soul of Perl)
  • %
    • key => value
    • %Empty = ();
    • %A = {“A” => 1, “B” => 2, “C” => 3};
    • reverse: reverse key and value(unsafe)
    • keys:return keys of hash as an array
    • values: return values of hash as an array
    • exists: check if a key existsin hash(unsafe)
    • delete:delete one key of hash
functions
Functions
  • Array
    • push, pop, reverse
  • Hash
    • keys, delete, exists, reverse
  • String
    • substr, index, length
  • rand, int
subroutine1
Subroutine

sub subroutine_name

{

statements in subroutine;

return something/nothing;

}

#call subroutine

$return_value = &subroutine_name(parameters);

subroutine2
Subroutine

sub ADD

{

($lo, $ro) = @_;

return $lo + $ro;

}

print &ADD(3, 5);

subroutine3
Subroutine

$max_value = &Max(3, 5);

sub Max

{

($lo, $ro) = @_;

my $bigger = ($lo >= $ro) ? $lo:$ro;

return $bigger;

}

subroutine4
Subroutine
  • Call by value
    • 傳值給subroutine,實際上變數並沒有被傳進subroutine
    • 在subroutine中是用另一個local variable來存傳進來的值
  • Call by reference
    • 傳位址給subroutine,所以變數被以位址的方式傳進subroutine中
    • 在subroutine中是用另一個local variable來存傳進來的位址
subroutine call by value
Subroutine (call by value)

@initial = (3, 5);

@answer = &exchange(@initial);

sub exchange

{

reverse @_;

return @_;

}

subroutine call by reference
Subroutine (call by reference)

&exchange(\@initial);

sub exchange

{

(my $add) = @_;

reverse @$add;

return;

}

r and int
rand & int
  • rand
    • 亂數函式
    • rand; #隨機回傳一個0~1之間的數
    • rand(100); #隨機回傳一個0~100之間的數
  • int
    • 整數函式
    • int(15.44332521122323211554) #回傳15
    • int(rand(50)) #隨機回傳一個0~50之間的整數
recursive
Recursive
  • Permutation
    • 0! = 1, N! = N * (N-1)!

Sub Permutation

{

my $n = $_[0];

if($_[0] == 0)

{

return 1;

}

else

{

return $n * Permutation($n- 1);

}

}

slide26
PPM
  • Perl Package Manager
slide27
CPAN
  • Comprehensive Perl Archive Network
debug mode
Debug Mode
  • perl -d test.pl
    • 小明媽有500元
    • 小明有100元
    • 媽媽給小明45元
      • 媽媽跟小明分別剩多少錢?
    • 小明跟雜貨店老闆買了兩本20元的筆記本、三隻7元的鉛筆,一瓶15元的輕鬆小品
      • 小明剩多少錢
      • 老闆入賬多少錢
  • 請輸出每一個步驟的金額以及其對應的記憶體位址
homeworks
Homeworks
  • 要求使用者輸入一正整數,並做輸入檢查,然後判斷它是奇數或偶數。
  • 分別印出1到100中的偶數跟奇數
    • 先印全部的奇數再換行印全部的偶數,數字間用空白分隔
  • 用iterative方式印出Fibonacci 數列的前 50 個數
    • Fibonacci 數列:F(0) == F(1) == 1,之後,數列中每個數是前兩個數之和,F(n) = F(n-1) + F(n-2)
  • 寫出漢諾塔的程式 (recursive)
    • 若有四個銅環,請問需搬動幾次。
    • 請將搬動過程print出來。