印度昌迪加爾市微生物技術(shù)研究所生物信息學(xué)課件_第1頁
印度昌迪加爾市微生物技術(shù)研究所生物信息學(xué)課件_第2頁
印度昌迪加爾市微生物技術(shù)研究所生物信息學(xué)課件_第3頁
印度昌迪加爾市微生物技術(shù)研究所生物信息學(xué)課件_第4頁
印度昌迪加爾市微生物技術(shù)研究所生物信息學(xué)課件_第5頁
已閱讀5頁,還剩14頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、Introduction to Perl & BioPerlDr G. P. S. Raghava Bioinformatics CentreIMTECH, ChandigarhEmail: raghavaimtech.res.inWeb: Perl IntroductionUsesShell scriptsCGI, web enginesGood atText processingSmall/Medium sized projectsQuick and dirty solutionsPortability (to a certain degree)PerlPractical Extracti

2、on and Report LanguageCreated by Larry WallRuns on just about every platformMost popular on Unix/Linux systemsExcellent language for file and data processingBasic ConceptsPerl files extension .PlCan create self executing scriptsAdvantage of PerlCan use system commandsComment entryPrint stuff on scre

3、enSimple Program#!/usr/local/bin/perl# This is a comment line. This program prints “Hello World.”# to the screen.print “Hello world.n”;On Unix, this is the location of the Perl interpreterComments start with # and end with the end of the lineProgram statements are terminated with semicolonsNewline c

4、haracterHow to Store ValuesScalar variablesList variablesPush,pop,shift,unshift,reverseHashes,keys,values,eachRead from terminal, command line argumentsRead and write to filesPerl Data TypesThree Main DatatypesScalarA single number, string or reference.$society = “Redbrick”;ListA collection of scala

5、r datatypes.societies = ( “RB”, “Drama”, “Film”);Length of an array with “scalar list”HashPairs of scalars, accessed by keys.%hash = ( “colour” = “red”,“make” = “corvette” ); Perl Basics ifSelective evaluate blocks of code depending on a condition.If ($string eq “blah”)print “String is blahn”;elsif

6、($string eq “spoo”)Print “String is spoon”;elsePrint “What the hell?n”;Perl Basics for Practically the same as C/C+/Javafor ($i = 0; $i 10; $i+)print “i is “ . $i . “n”;Perl Basics foreachA handy way of processing a listforeach $grocery (groceries)scan($grocery);Can use the default variable ($_)fore

7、ach (groceries)scan($_);Control Structures#!/usr/local/bin/perl# Print out 0,1,2,3,4,5,6,7,8,9# in this case, $x is local only to the loop because my is usedfor (my $x = 0; $x 10; $x+) print “$x”; if ($x 9) print “,”; print “n”;Control Structures#!/usr/local/bin/perl# Demonstrate the foreach loop, w

8、hich goes through elements# in an array.my users = (“bonzo”, “gorgon”, “pluto”, “sting”);foreach $user (users) print “$user is alright.n”;FunctionsUse sub to create a function.No named formal parameters, assign _ to local subroutine variables.#!/usr/local/bin/perl# Subroutine for calculating the max

9、imumsub max my $max = shift(_); # shift removes the first value from _ foreach $val (_) $max = $val if $max filename.txt” Truncate and write to file.“filename.txt” Append to file.Perl File I/O - ReadReading$string = ;list = ;while ($string = )print “LINE : “ . $string;Perl File I/O - WriteWriting to

10、 a file.print FILEHANDLE “Hello”;foreach $item (list)print FILEHANDLE $item;foreach (list)print FILEHANDLE;FilesFile handles are used to access filesopen and close functions#!/usr/local/bin/perl# Open a file and print its contents to copy.txtmy $filename = $ARGV0;open(MYFILE, “$filename”); # indicat

11、es writeopen(OUTPUT, “copy.txt”);while ($line = ) # The operator reads a line print OUTPUT $line; # no newline is needed, read from fileclose MYFILE; # Parenthesis are optionalPlatformsHP-UX / Itanium (ia64) 11.0 HP-UX / PA-RISC 11.0 MacOSMacOS XCygWin NT_5 v. 1.3.10 on Windows 2000 5.00 Win32, WinNT i386 IRIX64 6.5 SGI Solaris 2.8 UltraSparc OpenBSD 2.8 i386 RedHat Linux 7.2 i686 Linux i386 Perl CGI Example #!/usr/bin/perl w# My Third Perl script.# I call this scr

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論