8 my ( $class, %args ) = @_;
10 bless $self, ref($class) || $class;
12 # -a number of CPUs used (default 1)
13 # -e e-value threshold for reporting sequences (default 10)
14 # -h e-value threshold for including sequences in PSSM (default 0.002)
16 # -b max number of alignments reported (default 250)
17 # -v max number of sequences described (default 500)
18 # -j max number of itterations (default 1)
19 $self->args("-e0.05 -h0.01 -m6 -b10000 -v10000 -j3");
21 #$self->args("-a2 -e0.05 -h0.01 -m6 -b20000 -v20000 -j15");
22 # $self->BLASTMAT("/software/jpred_bin/blast");
23 # $self->BLASTDB("/software/jpred_uniprot_all_filt");
25 # Automatically run any arguments passed to the constructor
27 croak "No such method '$_' of object $class" unless $self->can($_);
28 $self->$_( $args{$_} );
34 sub path { defined $_[1] ? $_[0]->{path} = $_[1] : $_[0]->{path} }
35 sub args { defined $_[1] ? $_[0]->{args} = $_[1] : $_[0]->{args} }
36 sub database { defined $_[1] ? $_[0]->{data} = "-d $_[1]" : $_[0]->{data} }
37 sub input { defined $_[1] ? $_[0]->{input} = "-i $_[1]" : $_[0]->{input} }
38 sub output { defined $_[1] ? $_[0]->{output} = "-o $_[1]" : $_[0]->{output} }
39 sub matrix { defined $_[1] ? $_[0]->{matrix} = "-Q $_[1]" : $_[0]->{matrix} }
40 sub debug { defined $_[1] ? $_[0]->{debug} = $_[1] : $_[0]->{debug} } # CC corrected - now works as expected. Before, debug was always on.
41 sub BLASTMAT { $ENV{BLASTMAT} = $_[1] }
42 sub BLASTDB { $ENV{BLASTDB} = $_[1] }
48 for (qw(path output database input)) {
49 croak "Method '$_' needs to be set" unless defined $self->$_;
52 # Construct the command line
54 for (qw(path args database input matrix output)) {
55 next unless $self->$_;
59 my $cmd = join " ", @cmd;
61 # Execute PSIBLAST and check it ran okay
64 #for (keys %ENV) { warn "$_=$ENV{$_}\n" }
68 system($cmd) == 0 or check( "blastpgp", $? ) and die "blastpgp was naughty";
70 # Clean up the error.log file it produces
71 if ( -z "error.log" ) { unlink "error.log" }
72 else { warn "blastpgp error.log file was not empty\n" }