24小时热门版块排行榜    

查看: 2448  |  回复: 11

xueshuhan

木虫 (正式写手)

[求助] Perl 编程 请大神们帮忙!!!生物信息的牛人请进

我是学生物的研究生,我们一个老师讲perl编程,才学了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.
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xueshuhan

木虫 (正式写手)

-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.
2楼2012-01-30 22:31:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xueshuhan

木虫 (正式写手)

前一半这样写是否正确:
#!/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 )
        }
3楼2012-01-31 02:03:29
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhusheng303

木虫 (小有名气)


ben_ladeng(金币+1): 欢迎常来 2012-01-31 13:58:28
xueshuhan: 回帖置顶 2012-01-31 16:46:17
引用回帖:
3楼: Originally posted by xueshuhan at 2012-01-31 02:03:29:
前一半这样写是否正确:
#!/usr/bin/perl
use strict;
use warnings;
use SOAP::Lite;

if ( $#ARGV < 0 )
        {
                print "Usage: please input "; exit;
        }
# Get the first argumentmy
...

【1】当你使用”use strict; use warnings ”, 语句"$input=$ARGV[0];"应该写成“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 ) ” 这个语句,我没有看懂。
积极面对
4楼2012-01-31 10:13:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xueshuhan

木虫 (正式写手)

这回写是否正确,还有就是网络服务调用部分如何编写???
#!/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" )
        }
5楼2012-01-31 16:42:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xueshuhan

木虫 (正式写手)

我写的这个问题,但不知道怎么改
问题一:如何让第一个argument需要为变量
问题二:为什么我在命令栏里输入核苷酸的ID却提示命令没有找到
#!/usr/bin/perl
use warnings;
use SOAP::Lite;

if ( $#ARGV < 0 )
        {
                print "Usage: please input\n "; exit;
        }
# Get the first argumentmy
if ( $ARGV[0]!=1 )
        {
                print "There is an error there"; exit;
        }

$input=$ARGV[0];

unless ( $ARGV[0]=~ m/:/ )
        {
                die ( "There is an error there.\n" );
        }

$service = SOAP::Lite->proxy(
        'http://www.ebi.ac.uk/soaplab/services/dispaly.sixpack'
);

$soap_response =
        $service->runAndWaitFor(
                SOAP:ata->type( map => { sequence_usa =>$ARGV[0]
} ) );

@res = $soap_response->paramsout;

$res = $soap_response->result;

$outfile = %$res->{'outfile'};

print "$outfile\n";

图一

6楼2012-01-31 18:49:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xueshuhan

木虫 (正式写手)

引用回帖:
: Originally posted by zhusheng303 at 2012-01-31 10:13:09:
【1】当你使用”use strict; use warnings ”, 语句"$input=$ARGV[0];"应该写成“my $input=$ARGV[0]”,“my”定义变量的作用,限定变量的作用域。
【2】“die ( There is an error there.\n )”,最 ...

谢谢你的帮助,还有一些问题请教,望指教
7楼2012-01-31 18:50:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhusheng303

木虫 (小有名气)

引用回帖:
5楼: Originally posted by xueshuhan at 2012-01-31 16:42:45:
这回写是否正确,还有就是网络服务调用部分如何编写???
#!/usr/bin/perl
use strict;
use warnings;
use SOAP::Lite;

if ( $#ARGV < 0 )
        {
                print "Usage: please input "; exit;
         ...

这里还有一个地方不对,
#######
unless ( $ARGV[0]=~ m/:/ )
        {
                die ( "There is an error there.\n" )
        }

############
这个语句“die ( "There is an error there.\n" )”,你最好写成
die  "There is an error there.\n" ;另外一个最重要的问题是:perl的每个语句必须以”;(分号)“结束。也就说:应该写成这样 “die  "There is an error there.\n" ;”才是对的。
积极面对
8楼2012-02-01 10:37:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhusheng303

木虫 (小有名气)

引用回帖:
6楼: Originally posted by xueshuhan at 2012-01-31 18:49:35:
我写的这个问题,但不知道怎么改
问题一:如何让第一个argument需要为变量
问题二:为什么我在命令栏里输入核苷酸的ID却提示命令没有找到
#!/usr/bin/perl
use warnings;
use SOAP::Lite;

if ( $#ARGV &l ...

【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却提示命令没有找到
不好意思,这个我也没有用过。这个网页你可以看看http://www.ebi.ac.uk/Tools/webse ... perl/soap/soap-lite,希望对你有帮助
积极面对
9楼2012-02-01 11:01:49
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xueshuhan

木虫 (正式写手)

xueshuhan: 回帖置顶 2012-02-02 09:18:42
在多位朋友帮助下终于写好了,下面是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;
10楼2012-02-02 09:18:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 xueshuhan 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[硕博家园] 售SCI一区文章,我:8O5.5.1.O5.4,科目全,可伽急 +3 2JOx3r2CYEgw 2026-08-22 6/300 2026-08-23 00:40 by OEbVnUOu01ol
[考博] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 2JOx3r2CYEgw 2026-08-21 8/400 2026-08-23 00:28 by OEbVnUOu01ol
[硕博家园] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +4 QTy3jDtz1uLt 2026-08-21 10/500 2026-08-22 23:42 by OEbVnUOu01ol
[基金申请] 2026国自然函评费到账 +11 羊腰板 2026-08-21 11/550 2026-08-22 22:03 by lsbin3733
[硕博家园] 售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急 +3 2JOx3r2CYEgw 2026-08-22 3/150 2026-08-22 22:03 by OEbVnUOu01ol
[基金申请] 93BebMhtakh前后11位开头都是大写 +7 且听虎啸 2026-08-17 8/400 2026-08-22 21:55 by 医学老男孩
[基金申请] 什么时候开奖? +7 CrisMessi 2026-08-18 8/400 2026-08-22 18:29 by 淀粉搬运工
[基金申请] 只有每年这种时候来逛逛小木虫 +24 yaoyewhu2008 2026-08-20 26/1300 2026-08-22 17:43 by kammury
[教师之家] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +4 2JOx3r2CYEgw 2026-08-21 4/200 2026-08-22 16:52 by sunzitan
[基金申请] 人气不行了 +8 fansofjerry 2026-08-21 8/400 2026-08-22 16:30 by zyqchem
[基金申请] 今日不放榜?网传国自然预计 8 月 27 日可查结果 +16 医学老男孩 2026-08-20 20/1000 2026-08-21 21:13 by Ldrop2023
[基金申请] 感觉是下周放榜了 +7 angus9576 2026-08-17 12/600 2026-08-21 13:38 by weiyin
[基金申请] 我面上完蛋了 +7 且听虎啸 2026-08-20 8/400 2026-08-21 12:31 by 酷酷墨镜
[论文投稿] 投稿咨询 +5 wwm09 2026-08-17 7/350 2026-08-21 10:11 by 期刊论文帮手
[基金申请] 基金啊基金 +4 longfie172 2026-08-20 4/200 2026-08-21 08:58 by mark mao
[基金申请] 估计是周四 +3 archvillain 2026-08-18 3/150 2026-08-21 01:48 by jnhyjjm
[基金申请] 今天系统多次维护,明天很可能放榜! +10 zju2000 2026-08-16 11/550 2026-08-20 20:02 by cl479861084
[基金申请] 时间戳变了,能看出什么问题? +18 基诺咪客 2026-08-17 23/1150 2026-08-20 17:19 by Godzela
[基金申请] 重要消息,中午系统在维护 +11 yuleib84 2026-08-18 12/600 2026-08-20 11:09 by xskun
[基金申请] 今天维护系统维护 祝所有人 高中 +8 gjjjzhong 2026-08-18 9/450 2026-08-18 13:01 by 家与远方
信息提示
请填处理意见