Commit 922d0029 authored by Sebastien Moretti's avatar Sebastien Moretti
Browse files

improve webblast code

parent 4f06680d
......@@ -164,36 +164,47 @@ exit;
##############
############################################### FONCTIONS ####################################################################
##############
sub CONTROLE_DB_PG
{
my($database,$blast_dir,$program)=@_;
if (! -e $database) { die "$database file does not exist\n";}
if ( -d $database) { die "$database must be a file, not a directory\n"; }
if ($blast_dir !~ /\/$/) { $blast_dir.="/"; }
my ($blastall) = $blast_dir . "blastall";
if (! -e $blastall) { die "$blastall program not found \n";}
sub CONTROLE_DB_PG {
my ($database, $blast_dir, $program) = @_;
if ( !-e "$database" && !-e "$database.pin"){
die "$database file does not exist\n";
}
if ( -d $database ){
die "$database must be a file, not a directory\n";
}
if ( $blast_dir !~ /\/$/ ){
$blast_dir .= '/';
}
my ($blastall) = $blast_dir.'blastall';
if ( !-e $blastall){
die "$blastall program not found \n";
}
return ($blastall);
}
#-------------------------------------------------------------------------------------------------------------------------------------
sub NCBI_DATABASE
{
my($ncbi_db)=@_;
my (%all_db)=
(
'nr' =>'1',
'pdb' =>'1',
'swissprot' =>'1',
'refseq_protein' =>'1',
);
if (exists $all_db{$ncbi_db}) { return($ncbi_db); }
elsif ($ncbi_db eq "") { return (""); }
else { return (1); }
sub NCBI_DATABASE {
my ($ncbi_db) = @_;
my (%all_db) =
(
'nr' =>'1',
'pdb' =>'1',
'swissprot' =>'1',
'refseq_protein' =>'1',
);
if ( exists $all_db{$ncbi_db} ){
return($ncbi_db);
}
elsif ( $ncbi_db eq '' ){
return ('');
}
else{
return (1);
}
}
#------------------------------------------------------------------------------------------------------------------------
sub HELP
......@@ -216,7 +227,7 @@ sub HELP
Default BLOSUM62
-method ....... geneid, pdbid, profile
-gigablast..... yes/no FASTER REMOTE BLAST with Gigablaster
(Stephane Audic program: http://www.igs.cnrs-mrs.fr/adele/~database/remoteblast.cgi)
(Stephane Audic program: http://www.igs.cnrs-mrs.fr/Giga2/~database/remoteblast.cgi)
Default no
-filter ....... T or F locally, L or R or M or C or V for distant blast
Default = Off
......@@ -244,9 +255,8 @@ sub HELP
}
#-----------------------------------------------------------------------------------------
sub OPTIONS_GET
{
my %opt=();
sub OPTIONS_GET {
my %opt = ();
GetOptions
(
......@@ -458,7 +468,7 @@ sub LOCAL_BLAST
}
elsif ( $method=~ /^pdbid$/i && $database=~ /expressopdb/ ){
#BLAST pour Expresso
open (COM,"$BLASTMAT; $BLASTDB;$blast_dir_expresso -p blastp -d $database_expresso -i $query_file -F $filter -e $Eval -M $matrix -v $align -b $align |") or die;
open (COM,"$BLASTMAT; $BLASTDB; $blast_dir_expresso -p blastp -d $database_expresso -i $query_file -F $filter -e $Eval -M $matrix -v $align -b $align |") or die;
}
else{
open (COM,"$blast_dir -p blastp -d $database -i $query_file -v 1 -b 1 -F $filter -e $Eval -M $matrix -v $align -b $align -a $process |") or die;
......@@ -466,9 +476,9 @@ sub LOCAL_BLAST
unless ( $quiet=~ /on/ ) { print {*STDERR} "\nrun BLAST..."; }
my $name_database, my $posted, my $version;
my ($name_database, $posted, $version) = ('', '', '');
open (my $SOR2, '>', "blast_result.txt") or die;
open (my $SOR2, '>', 'blast_result.txt') or die;
$/ = 'Query=';
while (<COM>){
......@@ -476,8 +486,10 @@ sub LOCAL_BLAST
if ( $_=~ /Posted date:\s+(.+?)\n/ ) { $posted = $1;}
if ( $_=~ /(BLASTP\s+\S+)/o ) { $version = $1;}
print {$SOR2} $_;
push (@list_pdb,$_) ;
if ($_=~ /\s*(.+?)\s/) { print {*STDERR} "\n$1 done";}
push (@list_pdb, $_) ;
if ( $_=~ /\s*(.+?)\s/ ){
print {*STDERR} "\n$1 done";
}
}
close COM;
close $SOR2;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment