#!/usr/bin/perl # blastall.cgi - a CGI wrapper for running blastall. # Copyright (C) 2002, Humberto Ortiz Zuazaga. # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. use Neuroseq; use CGI qw(:standard); # Full path to program $program = '/usr/local/bin/fbcsv'; print Neuroseq::title('blastall - blast a fasta file full of sequences at once.'), 'Calls blastall to run a fasta file against nr and nt. Please be gentle on our server, It looks like each sequencing run will take an hour and a half to process.', p, hr; if (!param()) { print start_form, # 'Enter your email address:', # p, # textfield('email'), p, 'Enter a fasta formated file of nucleotide sequences', p, textarea(-name=>'sequence', -default=>'', -rows=>10, -columns=>40), p, submit, reset, defaults('Clear'), end_form, hr; } else { $|=1; # need this to keep program output in place my $sequence = param('sequence'); # my $email = param('email'); my $cwd; chomp($cwd = `pwd`); my $tmpdir = Neuroseq::mktmpdir("./tmp/blastall"); chdir $tmpdir or die "error changing to $tmpdir: $!"; #chdir "/usr/local/blast" or die "error changing to blast directory: $!"; my $filename = "sequence"; open (SEQ, ">$filename"); print SEQ $sequence, "\n"; close SEQ; # print p, "You will receive mail at $email notifying you when the results are ready", p, hr; print p, "Get your ", a({href=>"$tmpdir/results.csv"}, "results here"), " in an hour or so."; open(BATCH, ">batch"); print BATCH "echo Running ... > results.csv\n"; print BATCH "$program $filename > csv.txt\n"; print BATCH "mv -f csv.txt results.csv\n"; close BATCH; system("echo Not yet > results.csv; /usr/bin/batch -f batch -m now"); } print Neuroseq::footer('2002.02.13');