ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/scripts/gicl_blastn.psx
Revision: 24
Committed: Tue Jul 26 21:46:39 2011 UTC (8 years, 1 month ago) by gpertea
File size: 2497 byte(s)
Log Message:
Line File contents
1 #!/usr/bin/perl
2 use strict;
3 use FindBin;
4
5 umask 0002;
6
7 $ENV{'PATH'}=$FindBin::Bin.':'.$ENV{'PATH'};
8
9 #so for pvmsx to consider the task was successful, $file must be deleted!
10 #==============
11 # 1 is the name of the fasta sequence input file
12 # 2 is the # of sequences in ${1} should = 1 for this script
13 # 3 is the slice no. being processed by sx
14 # 4 is 0 if not the last file, 1 if the last file
15 # 5 is the # of sequences skipped initially
16 # 6 is the # of sequences to be processed (-1 = ALL)
17 # 7 user parameter
18 # 1 2 3 4 5 6
19 my ($file, $numseqs, $slice_num, $last, $skipped, $total, $userparams)=@ARGV;
20 #user parameters:
21 # 1) database (full path)
22 # 2) PID cutoff (using 94 if not specified)
23 # 3) maximum overhang
24 # 4) minimum overlap
25 # 5) extra flags (optional)
26 # flags: M = no masking, D= separate database (not all-vs-all)
27 # G = show gaps
28 my ($searchdb,$pid,$maxovh,$minovl, $xflags)=split(/:/,$userparams);
29 my $blast_res=$file.'.tab';
30 my $nomasking = $xflags=~/M/;
31 my $gapinfo = $xflags=~/G/;
32 my $otherDb = $xflags=~/D/;
33
34 $pid=25 unless $pid>20; #not used for this blastn search
35 $minovl=40 unless $minovl; #not used for this blastn
36 my $log_file='log_std';
37 my $err_file='err_log';
38 open(STDERR, '>>'.$err_file);
39 open(STDOUT, '>>'.$log_file);
40
41 my $toskip = $skipped+$numseqs*($slice_num-1);
42
43 my $cmd = "blastn $searchdb $file W=9 E=1e-10 B=300 V=300 -noseqs -notes -warnings -novalidctxok -cpus=1 -topcomboN 1 ";
44 $cmd.= " -dbrecmin $toskip " if $toskip>0 && $otherDb==0;
45 # $cmd.= "| blastflt PID=25 | bzip2 -cf > $blast_res.bz2";
46 $cmd.= "| blast2btab PID=25 | bzip2 -f > $blast_res.bz2" ;
47 # $cmd.=$gapinfo ? ' -D5 ':' -D4 ';
48 # $cmd.= ($nomasking) ? ' -FF -UF ' : ' -UT -F "m D" ';
49 # unless ($otherDb) {
50 # $cmd.=' -KT ';
51 # $cmd.= " -k $toskip " if $toskip>0;
52 # }
53 #$cmd.=" > $blast_res";
54 my $slno=sprintf("slice:%09d",$slice_num);
55 print STDERR ">>$slno: $cmd\n";
56
57 my $errmsg = `($cmd) 2>&1`;
58 my $r=$?;
59 print STDERR "<<$slno: done.\n";
60
61 if ($r || ($errmsg=~/ERROR/is) || ($errmsg=~/Segmentation/is)) {
62 print STDERR "!Error at:\n$cmd\n";
63 print STDERR "$errmsg\n";
64 exit(1);
65 }
66 #------- sorting of results not needed for blastn
67 # $cmd="sort -k11,11g -k10,10nr -k9,9nr $blast_res | bzip2 -cf > $mgblast_res.bz2";
68 # $errmsg=`($cmd) 2>&1`;
69 #$r=$?;
70 #if (($r && ($r>>8 != 2)) || $errmsg=~m/memory/is) {
71 # die "Error sorting/compressing the results file '$mgblast_res'\n$cmd\n";
72 # }
73 # unlink($file, $mgblast_res);
74 unlink($file);
75 exit 0;

Properties

Name Value
svn:executable *