CGI实现Restrictionmap.pm

CGI实现Restrictionmap.pm

CGI实现Restrictionmap.pm
请教一个在CGI 中使用自己改写的Model时的问题 Mastering Perl for Bioinformatics中的例子

先说一下我的调试环境 IIS5.1 XP ActivePerl 5.8.8

自己改写了3个Model 1.Restrictionmap.pm 2. Rebase.pm 3. SeqFileIO.pm (这三个package 我的已经分别在cmd模式下调试过了,都没有问题,而且我都放在IIS5.1的默认的/Inetpub/wwwroot/的文件夹中了 ;在最后面另附model 的用法说明)

然后用main.cgi 实现 (以用 perl -c main.cgi 编译过 syntax ok)
在调试的时候 我自己加了三个标志
1>print "$sequence\n", "one",hr;
2>print "two",hr;
3>print "three",hr;

但在调试时 只能显示第一个标志,第二三个都没有显示(自己怀疑是标志1之后的语句有问题,但用想不明白,请帮忙看看)

另外 还有一个问题 main.cgi可以upload文件 但在选取文件之后
提示:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

CGI open of tmpfile: Permission denied

请问是否和文件夹的权限设置有关? 我该如何设置? 谢谢!


#main.cgi
######################
#!/usr/bin/perl

use Restrictionmap;
use Rebase;
use SeqFileIO;
use CGI qw/:standard/;

use strict;
use warnings;


print header,
start_html('Restriction Maps on the Web'),
h1('<font color=orange>Restriction Maps on the Web</font>'),
hr,
start_multipart_form,
'<font color=blue>',
h3("1) Restriction enzyme(s)? "),
textfield('enzyme'), p,
h3("2) Sequence filename (fasta or raw format): "),
filefield(-name=>'fileseq',
-default=>'starting value',
-size=>50,
-maxlength=>200,
), p,
strong(em("or")),
h3("Type sequence: "),
textarea(
-name=>'typedseq',
-rows=>10,
-columns=>60,
-maxlength=>1000,
), p,
h3("3) Make restriction map:"),
submit, p,
'</font>',
hr,
end_form;

if (param()) {

my $sequence = '';

# must have exactly one of the two sequence input methods specified

if(param('typedseq') and param('fileseq')) {
print "<font color=red>You have given a file AND typed in sequence: do only one!</font>", hr;
exit;
}elsif(not param('typedseq') and not param('fileseq')) {
print "<font color=red>You must give a sequence file OR type in sequence!</font>", hr;
exit;
}elsif(param('typedseq')) {
$sequence = param('typedseq');

}elsif(param('fileseq')) {
my $fh = upload('fileseq');
while (<$fh>) {
/^\s*>/ and next; # handles fasta file headers
$sequence .= $_;
}
}

# strip out non-sequence characters

$sequence =~ s/\s//g;
$sequence = uc ($sequence);

print "$sequence\n", "one",hr;

my $rebase = Rebase->new(
dbmfile => 'BIONET',
bionetfile => 'bionet_705.txt',
mode => '0666',
);

print "two",hr;

my $restrict = Restrictionmap->new(
enzyme => 'EcoRI HindIII',
rebase => $rebase,
sequence => $sequence,
graphictype => 'text',
);

print "three",hr;
print "$sequence\n", hr;
print "Your requested enzyme(s): ",em(param('enzyme')),p,"<code><pre>\n";
hr;
print "Locations are ", join ' ', $restrict->get_enzyme_map('EcoRI'), "\n";
print "\n\n\n";
print $restrict->get_graphic, "</pre></code>\n",hr;

}

print end_html;

########################
# Example for Rebase
use Rebase;

# Use "bionetfile" to create and populate dbm file
my $rebase = Rebase->new(
dbmfile => 'BIONET',
bionetfile => 'bionet.212',
mode => 0644
);

# Use without "bionetfile" to attach to existing dbm file
my $rebase = Rebase->new(
dbmfile => 'BIONET',
mode => 0444
);

my $enzyme = 'EcoRI';

print "Looking up restriction enzyme $enzyme\n";

my @sites = $rebase->get_recognition_sites($enzyme);
print "Sites are @sites\n";

my @res = $rebase->get_regular_expressions($enzyme);
print "Regular expressions are @res\n";

print "DBM file is ", $rebase->get_dbmfile, "\n";
print "Rebase bionet file is ", $rebase->get_bionetfile, "\n";
################
#package Restrictionmap

use Restrictionmap;

use Rebase;

use strict;
use warnings;

my $rebase = Rebase->new(
dbmfile => 'BIONET',
bionetfile => 'bionet.212'
);

my $restrict = Restrictionmap->new(
rebase => $rebase,
enzyme => 'EcoRI HindIII',
sequence => 'ACGAATTCCGGAATTCG',
graphictype => 'text',
);

print "Locations are ", join ' ', $restrict->get_enzyme_map('EcoRI'), "\n";

print $restrict->get_graphic;
#####################
你这三个模块都是自己写的.
你这三个模块都是自己写的?
SORRY ,我不知道你这些模块是干吗用的,我也没时间去看那些代码
对于第二个问题你可以先用个PERL做个写入文件的脚本看看写入权限的问题如果你的磁盘格式是NTFS的
恢复2楼
你这三个模块都是自己写的?

不是, 都是些Mastering Perl for Bioinformatics中的例子 然后我自己把它们小改动一下 组装成一个 用于检索用户提交的DNA序列 的限制性内切酶位点的 小cgi 程序

谢谢你帮忙
第一个问题我已经解决了 用了个mysql的数据库 所以不用写文件了

但第二个 我还不是很明白 你可以说得具体一写吗?
upload也要 权限吗?

############
这是我upload file 的一段程序

my $fh = upload('fileseq');
while (<$fh>) {
$sequence .= $_;
}

这是 cgi 前面的部分
i
h3("2) Sequence filename (fasta or raw format): "),
filefield(-name=>'fileseq',
-default=>'starting value',
-size=>50,
-maxlength=>200,
), p,
前两天硬盘坏了,换了一个.
前两天硬盘坏了,换了一个装的xp,今天严格按bioperl.org上的说明步骤装完了,但是运行perldoc bioperl找不到.去年我的2000系统我也是这样装的啊,用的很好,请高手帮忙,谢谢!
成功~.