Debian Codegraph @

hmmer/profmark/x-psiblast+

raw
1 #! /usr/bin/perl -w
2
3 # Do a piece of a profmark benchmark, for PSI-BLAST+
4 #
5 # This script is normally called by pmark_master.pl; its command line
6 # syntax is tied to pmark_master.pl.
7 #
8 # Usage: x-psiblast+ <top_builddir> <top_srcdir> <resultdir> <tblfile> <msafile> <fafile> <outfile>
9 # Example: ./x-psiblast+ /usr/local/ncbi-blast-2.2.21+ ~/src/hmmer/trunk testdir test.tbl pmark.msa test.fa test.out
10 #
11 # For best results, the target database should be masked. For example:
12 # seg pmark.fa -x > pmark-seg.fa
13 #
14
15 BEGIN {
16 $top_builddir = shift;
17 $top_srcdir = shift;
18 $wrkdir = shift;
19 $tblfile = shift;
20 $msafile = shift;
21 $fafile = shift;
22 $outfile = shift;
23 }
24 use lib "${top_srcdir}/easel/demotic";
25 use demotic_blast;
26
27 $formatdb = "${top_builddir}/bin/makeblastdb";
28 $psiblast = "${top_builddir}/bin/psiblast";
29 $blastopts = "-num_threads 1 -num_descriptions 9999 -num_alignments 0"; # opts for searching the benchmark
30
31 if (! -d $top_builddir) { die "didn't find H2 build directory $top_builddir"; }
32 if (! -d $top_srcdir) { die "didn't find H3 source directory $top_srcdir"; }
33 if (! -x $formatdb) { die "didn't find executable $formatdb"; }
34 if (! -x $psiblast) { die "didn't find executable $psiblast"; }
35 if (! -e $wrkdir) { die "$wrkdir doesn't exist"; }
36
37 open(OUTFILE,">$outfile") || die "failed to open $outfile";
38 open(TABLE, "$tblfile") || die "failed to open $tblfile";
39 MSA:
40 while (<TABLE>)
41 {
42 ($msaname) = split;
43
44 # Fetch the query MSA from the benchmark (.sto file)
45 $output = `esl-afetch -o $wrkdir/$msaname.sto $msafile $msaname`;
46 if ($? != 0) { print "FAILED: esl-afetch on $msaname\n"; next MSA; }
47
48 # Reformat to psiblast format (.pbl file)
49 $output = `esl-reformat -o $wrkdir/$msaname.pbl psiblast $wrkdir/$msaname.sto`;
50 if ($? != 0) { print "FAILED: esl-reformat psiblast on $msaname\n"; next MSA; }
51
52 # Run psi-blast against the benchmark
53 if (! open(PSIBLAST, "$psiblast $blastopts -db $fafile -in_msa $wrkdir/$msaname.pbl 2>/dev/null |")) { print "FAILED: $psiblast on $msaname\n"; next MSA; }
54 if (! demotic_blast::parse(\*PSIBLAST) ) { print "FAILED: demotic psiblast parser on $msaname\n"; next MSA; }
55
56 for ($i = 0; $i < $demotic_blast::nhits; $i++)
57 {
58 printf OUTFILE ("%g\t%.1f\t%s\t%s\n",
59 $demotic_blast::hit_Eval[$i],
60 $demotic_blast::hit_bitscore[$i],
61 $demotic_blast::hit_target[$i],
62 $msaname);
63 }
64 close PSIBLAST;
65
66 unlink "$wrkdir/$msaname.pbl";
67 unlink "$wrkdir/$msaname.sto";
68 }
69 close TABLE;
70 close OUTFILE;