| 查看: 2134 | 回復(fù): 11 | ||
xueshuhan木蟲 (正式寫手)
|
[求助]
Perl 編程 請(qǐng)大神們幫忙。!生物信息的牛人請(qǐng)進(jìn)
|
|
|
我是學(xué)生物的研究生,我們一個(gè)老師講perl編程,才學(xué)了10個(gè)小時(shí),本人對(duì)編程一竅不通,希望好心人幫忙解答,謝謝了。! 下面是我的編程: 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. |
木蟲 (小有名氣)
|
【1】當(dāng)你使用”use strict; use warnings ”, 語(yǔ)句"$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 ) ” 這個(gè)語(yǔ)句,我沒有看懂。 |

木蟲 (正式寫手)
|
在多位朋友幫助下終于寫好了,下面是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; |
木蟲 (正式寫手)
|
-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 ) } |
木蟲 (正式寫手)
|
這回寫是否正確,還有就是網(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" ) } |
木蟲 (正式寫手)
木蟲 (正式寫手)
木蟲 (小有名氣)
|
這里還有一個(gè)地方不對(duì), ####### unless ( $ARGV[0]=~ m/:/ ) { die ( "There is an error there.\n" ) } ############ 這個(gè)語(yǔ)句“die ( "There is an error there.\n" )”,你最好寫成 die "There is an error there.\n" ;另外一個(gè)最重要的問(wèn)題是:perl的每個(gè)語(yǔ)句必須以”;(分號(hào))“結(jié)束。也就說(shuō):應(yīng)該寫成這樣 “die "There is an error there.\n" ;”才是對(duì)的。 |

木蟲 (小有名氣)
|
【1】問(wèn)題一:如何讓第一個(gè)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】問(wèn)題二:為什么我在命令欄里輸入核苷酸的ID卻提示命令沒有找到 不好意思,這個(gè)我也沒有用過(guò)。這個(gè)網(wǎng)頁(yè)你可以看看http://www.ebi.ac.uk/Tools/webse ... perl/soap/soap-lite,希望對(duì)你有幫助 |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿中國(guó)海洋大學(xué),生物學(xué),301分,求調(diào)劑 +5 | 1孫悟空 2026-03-17 | 5/250 |
|
|---|---|---|---|---|
|
[考博] 東華理工大學(xué)化材專業(yè)26屆碩士博士申請(qǐng) +8 | zlingli 2026-03-13 | 8/400 |
|
|
[考研] 266求調(diào)劑 +5 | 陽(yáng)陽(yáng)哇塞 2026-03-14 | 10/500 |
|
|
[考研] 085600材料與化工調(diào)劑 324分 +10 | llllkkkhh 2026-03-18 | 12/600 |
|
|
[考研] 0703化學(xué)調(diào)劑 +5 | pupcoco 2026-03-17 | 8/400 |
|
|
[考研] 085600材料與化工求調(diào)劑 +6 | 緒幸與子 2026-03-17 | 6/300 |
|
|
[考研] 0703化學(xué)調(diào)劑,求各位老師收留 +10 | 秋有木北 2026-03-14 | 10/500 |
|
|
[考研] 一志愿華中科技大學(xué),080502,354分求調(diào)劑 +4 | 守候夕陽(yáng)CF 2026-03-18 | 4/200 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +5 | hanamiko 2026-03-18 | 5/250 |
|
|
[考研] 311求調(diào)劑 +11 | 冬十三 2026-03-15 | 12/600 |
|
|
[考博] 環(huán)境領(lǐng)域全國(guó)重點(diǎn)實(shí)驗(yàn)室招收博士1-2名 +3 | QGZDSYS 2026-03-13 | 5/250 |
|
|
[考研] 301求調(diào)劑 +9 | yy要上岸呀 2026-03-17 | 9/450 |
|
|
[考研] 268求調(diào)劑 +8 | 一定有學(xué)上- 2026-03-14 | 9/450 |
|
|
[考研] 材料專碩326求調(diào)劑 +6 | 墨煜姒莘 2026-03-15 | 7/350 |
|
|
[基金申請(qǐng)]
今年的國(guó)基金是打分制嗎?
50+3
|
zhanghaozhu 2026-03-14 | 3/150 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 070303 總分349求調(diào)劑 +3 | LJY9966 2026-03-15 | 5/250 |
|
|
[考研] 0856專碩279求調(diào)劑 +5 | 加油加油!? 2026-03-15 | 5/250 |
|
|
[考研] 復(fù)試調(diào)劑 +3 | 呼呼?~+123456 2026-03-14 | 3/150 |
|
|
[考研] 290求調(diào)劑 +3 | ADT 2026-03-13 | 3/150 |
|