| 查看: 2137 | 回復(fù): 11 | |||
xueshuhan木蟲 (正式寫手)
|
[求助]
Perl 編程 請大神們幫忙。!生物信息的牛人請進
|
|
我是學(xué)生物的研究生,我們一個老師講perl編程,才學(xué)了10個小時,本人對編程一竅不通,希望好心人幫忙解答,謝謝了!。 下面是我的編程: Develop a Perl program that receives as argument on the command linethe id of a nucleotide sequence (in the form db:id) and invokes the"sixpack" Web Service from EBI printing its result. |
木蟲 (正式寫手)
|
-It checks the number of arguments received on the command line and if the number is not 1 it prints an error message and exits. -It assigns the first argument to one variable. -It checks with a pattern matching that the variable contains the character ":". If not it prints an error message. -It calls the "sixpack" Web Service as in the examples seen in class passing the received variable. -It assigns to a variable the "outfile" returned by the service. -It prints this variable. |
木蟲 (正式寫手)
|
前一半這樣寫是否正確: #!/usr/bin/perl use strict; use warnings; use SOAP::Lite; if ( $#ARGV < 0 ) { print "Usage: please input "; exit; } # Get the first argumentmy if ( $ARGV[0]<>1 ) { print "There is an error there"; exit; } $input=$ARGV[0]; unless ( $ input =~ m/:/ ) { die ( There is an error there.\n ) } |
木蟲 (小有名氣)
|
【1】當(dāng)你使用”use strict; use warnings ”, 語句"$input=$ARGV[0];"應(yīng)該寫成“my $input=$ARGV[0]”,“my”定義變量的作用,限定變量的作用域。 【2】“die ( There is an error there.\n )”,最好寫成“die (There is an error there.\n );”。 【3】“if ( $ARGV[0]<>1 ) ” 這個語句,我沒有看懂。 |

木蟲 (正式寫手)
|
這回寫是否正確,還有就是網(wǎng)絡(luò)服務(wù)調(diào)用部分如何編寫??? #!/usr/bin/perl use strict; use warnings; use SOAP::Lite; if ( $#ARGV < 0 ) { print "Usage: please input "; exit; } # Get the first argumentmy if ( $ARGV[0]!=1 ) { print "There is an error there"; exit; } my $input=$ARGV[0]; unless ( $ARGV[0]=~ m/:/ ) { die ( "There is an error there.\n" ) } |
木蟲 (正式寫手)
木蟲 (正式寫手)
木蟲 (小有名氣)

木蟲 (小有名氣)
|
【1】問題一:如何讓第一個argument需要為變量 Use $ARGV[n] to display argument. Use $#ARGV to get total number of passed argument to a perl script. 例如:./foo.pl one two three $ARGV[0]:one $ARGV[1]: two $ARGV[2]: three 【2】問題二:為什么我在命令欄里輸入核苷酸的ID卻提示命令沒有找到 不好意思,這個我也沒有用過。這個網(wǎng)頁你可以看看http://www.ebi.ac.uk/Tools/webse ... perl/soap/soap-lite,希望對你有幫助 |

木蟲 (正式寫手)
|
在多位朋友幫助下終于寫好了,下面是perl : #!/usr/bin/perl -w use strict; use SOAP::Lite; my($USAGE) = "$0 PROTEIN\n\n"; unless (@ARGV) { print $USAGE; exit; } unless (@ARGV==1) { print "There is an error.\n"; exit; } my($sequence) = $ARGV[0]; unless ($sequence =~ /[:]/g) { print "There is another error\n"; } my($service) = SOAP::Lite->proxy( 'http://www.ebi.ac.uk/soaplab/services/nucleic_gene_finding.sixpack' ); my($soap_response) = $service->runAndWaitFor( SOAP: ata->type( map => { sequence_usa =>$sequence} ) ); my(@res) = $soap_response->paramsout; my($res) = $soap_response->result; my($outfile) = %$res->{'outfile'}; print "$outfile\n"; exit; |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 286分人工智能專業(yè)請求調(diào)劑愿意跨考! +3 | lemonzzn 2026-03-17 | 3/150 |
|
|---|---|---|---|---|
|
[考研] 一志愿蘇州大學(xué)材料求調(diào)劑,總分315(英一) +3 | sbdksD 2026-03-19 | 3/150 |
|
|
[考研] 0703化學(xué)調(diào)劑 ,六級已過,有科研經(jīng)歷 +12 | 曦熙兮 2026-03-15 | 12/600 |
|
|
[考研] 一志愿南京理工大學(xué)085701資源與環(huán)境302分求調(diào)劑 +3 | 葵梓衛(wèi)隊 2026-03-18 | 5/250 |
|
|
[考研] 梁成偉老師課題組歡迎你的加入 +9 | 一鴨鴨喲 2026-03-14 | 11/550 |
|
|
[考研] 324分 085600材料化工求調(diào)劑 +3 | llllkkkhh 2026-03-18 | 3/150 |
|
|
[考研] 求調(diào)劑,一志愿:南京航空航天大學(xué)大學(xué) ,080500材料科學(xué)與工程學(xué)碩,總分289分 +3 | @taotao 2026-03-19 | 3/150 |
|
|
[考研] 328求調(diào)劑,英語六級551,有科研經(jīng)歷 +4 | 生物工程調(diào)劑 2026-03-16 | 12/600 |
|
|
[考研] 332求調(diào)劑 +3 | ydfyh 2026-03-17 | 3/150 |
|
|
[考研] 311求調(diào)劑 +11 | 冬十三 2026-03-15 | 12/600 |
|
|
[考研] 收復(fù)試調(diào)劑生 +4 | 雨后秋荷 2026-03-18 | 4/200 |
|
|
[考研] 312求調(diào)劑 +8 | 陌宸希 2026-03-16 | 9/450 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +6 | 困于星晨 2026-03-17 | 6/300 |
|
|
[考研] 277調(diào)劑 +5 | 自由煎餅果子 2026-03-16 | 6/300 |
|
|
[考研] 278求調(diào)劑 +3 | Yy7400 2026-03-13 | 3/150 |
|
|
[考研] 機械專碩325,尋找調(diào)劑院校 +3 | y9999 2026-03-15 | 5/250 |
|
|
[考研] 26考研一志愿中國石油大學(xué)(華東)305分求調(diào)劑 +3 | 嘉年新程 2026-03-15 | 3/150 |
|
|
[考研] 288求調(diào)劑 +4 | 奇點0314 2026-03-14 | 4/200 |
|
|
[考研] 311求調(diào)劑 +3 | 冬十三 2026-03-13 | 3/150 |
|
|
[考研] 070303一志愿西北大學(xué)學(xué)碩310找調(diào)劑 +3 | d如愿上岸 2026-03-13 | 3/150 |
|