-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetVDOutput.cgi
executable file
·85 lines (73 loc) · 2.29 KB
/
GetVDOutput.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/perl -w
use CGI;
use HTML::Template;
use File::Find;
use Cwd;
my $q = CGI->new();
my $sid = $q->param('id');
my $baseDir = 'virusdetect/'.$sid;
my $blastn = $baseDir.'/blastn.html';
my $blastx = $baseDir.'/blastx.html';
my $contig = $baseDir.'/contig_sequences.fa';
my $image = 'LenDistr/'.$sid.'.png';
my $template = HTML::Template->new(filename => 'template.tmpl');
$template->param(SNAME => $sid);
$template->param(IMG => $image);
$template->param(CONTIG => $contig);
if(-e $blastn){
my $bn;
open BLASTN, $blastn;
while(<BLASTN>){
if(/^\<table/){
chomp;
my ($style) = $_=~/(style.*)align/;
$_=~s/$style//;
$bn.=$_;
while(<BLASTN>){
chomp;
if(my ($match)=$_=~/href=\"blastn_references\/(.*?)\.html\"/){
my $before = 'href="blastn_references/'.$match.'.html"';
my $change = 'href="GetRefVirus.cgi?sid='.$sid.'&vid='.$match.'&type=blastn" target=_blank';
$_=~s/$before/$change/;
}
$bn.=$_;
if(/^\<\/table\>/){
last;
}
}
}
else{next}
}
close BLASTN;
$template->param(BLASTN => $bn);
}
if(-e $blastx){
my $bx;
open BLASTX, $blastx;
while(<BLASTX>){
if(/^\<table/){
chomp;
my ($style) = $_=~/(style.*)align/;
$_=~s/$style//;
$bx.=$_;
while(<BLASTX>){
chomp;
if(my ($match)=$_=~/href=\"blastx_references\/(.*?)\.html\"/){
my $before = 'href="blastx_references/'.$match.'.html"';
my $change = 'href="GetRefVirus.cgi?sid='.$sid.'&vid='.$match.'&type=blastx" target=_blank';
$_=~s/$before/$change/;
}
$bx.=$_;
if(/^\<\/table\>/){
last;
}
}
}
else{next}
}
close BLASTX;
$template->param(BLASTX => $bx);
}
print "Content-type: text/html\n\n";
print $template->output;
#// SNAME CONTIG IMG BLASTN BLASTX