[Bio] / FigKernelScripts / blastp_pseq.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/blastp_pseq.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download) (as text)

1 : efrank 1.1 # -*- perl -*-
2 : olson 1.4 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : efrank 1.1
20 :     ###########################################
21 :     use Carp;
22 :     use Data::Dumper;
23 :     use FIG_Config;
24 :    
25 :     # -*- perl -*-
26 :    
27 :     # usage: blastp_pseq MinGood [Db] < pseq > table_of_hits
28 :    
29 : redwards 1.5 (($cutoff = shift @ARGV) && ($db = shift @ARGV || "$FIG_Config::global/nr-std"))
30 : efrank 1.1 || die "usage: blastp_pseq MinGood [Db] < pseq > table_of_hits";
31 :    
32 :     $tmp = "$FIG_Config::temp/tmp$$";
33 :     open(TMP,">$tmp") || die "could not open $tmp";
34 :     while (defined($_ = <STDIN>))
35 :     {
36 :     print TMP $_;
37 :     }
38 :     close(TMP);
39 :    
40 : redwards 1.5 print STDERR "Blasting against $db\n";
41 :    
42 : olson 1.3 $ENV{"BLASTMAT"} = $FIG_Config::blastmat;
43 : efrank 1.1 if (! -s "$db.psq")
44 :     {
45 : olson 1.2 (system("$FIG_Config::ext_bin/formatdb -i $db -pT") == 0)
46 :     || die "could not run $FIG_Config::ext_bin/formatdb -i $db";
47 : efrank 1.1 }
48 :    
49 :     $done = 0;
50 :     while (! $done)
51 :     {
52 : olson 1.2 if (system("$FIG_Config::ext_bin/blastall -FF -d $db -i $tmp -p blastp > $tmp.out") == 0)
53 : efrank 1.1 {
54 :     @tmp = `tail -15 $tmp.out`;
55 :     if ((($tmp[$#tmp] =~ /bits\)\n/s) || (grep(/No hits found/,@tmp) > 0)) &&
56 :     (system("$FIG_Config::fig/bin/condense_blast $cutoff < $tmp.out > $tmp.out2") == 0) &&
57 :     open(JOB,"<$tmp.out2"))
58 :     {
59 :     while (defined($_ = <JOB>))
60 :     {
61 :     print "blastp,$_";
62 :     }
63 :     close(JOB);
64 :     print "done\n";
65 :     $done = 1;
66 :     }
67 :     }
68 :     }
69 :     unlink("$tmp");
70 :     unlink("$tmp.out");
71 :     unlink("$tmp.out2");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3