Changeset 259
- Timestamp:
- 09/08/09 16:43:05 (3 months ago)
- Files:
-
- MPI/mpi_iprscan (modified) (10 diffs)
- lib/Process/IPRchunk.pm (modified) (13 diffs)
- lib/Process/MpiTiers.pm (modified) (1 diff)
- lib/basiclog.pm (added)
- lib/iprscan/runlog.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
MPI/mpi_iprscan
r258 r259 14 14 use threads; 15 15 use threads::shared; 16 use Cwd;17 16 18 17 BEGIN{ … … 34 33 #what to do on ^C 35 34 $SIG{'INT'} = sub { 36 print STDERR "\n\n Makeraborted by user!!\n\n";35 print STDERR "\n\nmpi_iprscan aborted by user!!\n\n"; 37 36 my @threads = threads->list; 38 37 foreach my $thr (@threads){ … … 75 74 use Iterator::Fasta; 76 75 use Fasta; 77 use basiclog;76 use ds_utility; 78 77 use Error qw(:try); 79 78 use Error::Simple; 80 79 use Process::IPRchunk; 81 80 use Process::MpiTiers; 81 use Process::IPRchunk; 82 82 use Parallel::MPIcar qw(:all); 83 use iprscan::runlog; 83 84 84 85 unless($threads::VERSION >= 1.67){ … … 173 174 my $root = 0; #define root node (only changed for debugging) 174 175 176 $CTL_OPT{retry} = 2; 177 $CTL_OPT{seqtype} = 'p'; #default 178 175 179 #---Process options on the command line 176 180 GetOptions("i=s" => \$CTL_OPT{infile}, 177 181 "o=s" => \$CTL_OPT{outfile}, 178 182 "appl=s" => \@appl, 179 "nocrc" => $CTL_OPT{nocrc}, 180 "seqtype=s" => $CTL_OPT{seqtype}, 181 "trtable=i" => $CTL_OPT{trtable}, 182 "goterms" => $CTL_OPT{goterms}, 183 "iprlookup" => $CTL_OPT{iprlookup}, 184 "format=s" => $CTL_OPT{format}, 185 "verbose" => $CTL_OPT{verbose}, 186 "chpc" => \$CTL_OPT{chpc}, #hidden option used on the CHPC's computer farm 183 "nocrc" => \$CTL_OPT{nocrc}, 184 "seqtype=s" => \$CTL_OPT{seqtype}, 185 "trtable=i" => \$CTL_OPT{trtable}, 186 "goterms" => \$CTL_OPT{goterms}, 187 "iprlookup" => \$CTL_OPT{iprlookup}, 188 "format=s" => \$CTL_OPT{format}, 189 "verbose" => \$CTL_OPT{verbose}, 190 "retry" => \$CTL_OPT{retry}, 191 "chpc" => \$CTL_OPT{chpc}, #hidden option for retrying 187 192 "cli" => \$CTL_OPT{cli}, #just used to strip off the option 188 193 ); … … 208 213 209 214 $CTL_OPT{appl} = \@appl; #apply apps to CTL_OPT 215 216 #build out_base and out_name for datastore 217 $CTL_OPT{out_name} = ($CTL_OPT{outfile}) ? $CTL_OPT{outfile} : $CTL_OPT{infile}; 218 $CTL_OPT{out_name} =~ /([^\/]+)$/; 219 $CTL_OPT{out_name} = $1; 220 $CTL_OPT{out_name} =~ s/(.+)\.[^\.]+$/$1/; 221 $CTL_OPT{out_base} = Cwd::cwd()."/$CTL_OPT{out_name}.iprscan.output"; 210 222 211 223 #build localized iprscan database for each node … … 297 309 $command .= " -iprlookup" if($CTL_OPT{iprlookup}); 298 310 $command .= " -format $CTL_OPT{format}" if(defined $CTL_OPT{format}); 311 $command .= " -verbose" if($CTL_OPT{verbose}); 299 312 $command .= " -appl " . join(" -appl ", @{$CTL_OPT{appl}}) if(@{$CTL_OPT{appl}}); 300 313 $command .= " -i $tfile" if($CTL_OPT{infile}); #test options on dummy file … … 328 341 $name = $CTL_OPT{outfile} if($CTL_OPT{outfile}); 329 342 330 my $DS_CTL = new basiclog("$name.log");343 my $DS_CTL = new ds_utility(\%CTL_OPT); 331 344 my $iterator = new Iterator::Fasta($CTL_OPT{infile}); 332 345 … … 379 392 while (my $fasta = $iterator->nextFasta() || shift @failed){ 380 393 $tier = Process::MpiTiers->new({fasta => $fasta, 381 CTL_OPT => \%CTL_OPT 394 CTL_OPT => \%CTL_OPT, 382 395 params => \@ARGV, 383 396 iprscan => "$EXE -cli", … … 445 458 while (my $fasta = $iterator->nextFasta() || shift @failed){ 446 459 $tier = Process::MpiTiers->new({fasta => $fasta, 447 CTL_OPT => \%CTL_OPT 460 CTL_OPT => \%CTL_OPT, 448 461 params => \@ARGV, 449 462 iprscan => "$EXE -cli", … … 615 628 $thr->detach() unless($thr->is_detached); 616 629 617 print STDERR "\n\n Maker is now finished!!!\n\n";630 print STDERR "\n\nmpi_iprscan is now finished!!!\n\n" unless($main::quiet); 618 631 } 619 632 #------SECONDARY MPI PROCESSES------ lib/Process/IPRchunk.pm
r258 r259 1 #! /usr/bin/perl -w 2 1 #! /usr/bin/perl 3 2 package Process::IPRchunk; 4 3 … … 14 13 use Widget::iprscan; 15 14 use URI::Escape; 15 use iprscan::runlog; 16 16 17 17 #--set object variables for serialization of data … … 134 134 $VARS->{LOG} = iprscan::runlog->new($VARS->{CTL_OPT}, 135 135 {seq_id => $VARS->{seq_id}, 136 seq_length => length(${$VARS->{q_seq_ref}}),137 136 out_dir => $VARS->{out_dir}, 138 137 the_void => $VARS->{the_void}, … … 144 143 $VARS->{DS_CTL}->add_entry($VARS->{seq_id}, $VARS->{out_dir}, $message); 145 144 if($VARS->{c_flag} == 0){ 146 my $cfile = $VARS->{c _flag};145 my $cfile = $VARS->{cfile}; 147 146 die "ERROR: Can't find $cfile yet iprscan::runlog says the contig is finished\n" 148 147 if(! -e $cfile); … … 158 157 open($FH, ">&STDOUT"); 159 158 } 159 160 #open for reading 161 open(my $CFH, "< $cfile"); 160 162 161 my $CFH; 162 open($CFH, "> $cfile"); 163 164 while(my $key = each %{$VARS}){ 165 next if($key eq 'outfile'); 166 print $FH $VARS->{$key}; 167 print $CFH $cfile; 163 while(my $line = <$CFH>){ 164 print $FH $line; 168 165 } 169 166 … … 329 326 #------------------------ARGS_IN 330 327 @args = (qw{CTL_OPT 328 safe_id 331 329 safe_fasta 332 330 app … … 334 332 iprscan 335 333 the_void 334 LOG 336 335 } 337 336 ); … … 342 341 my %CTL_OPT = %{$VARS->{CTL_OPT}}; 343 342 my $safe_fasta = $VARS->{safe_fasta}; 343 my $safe_id = $VARS->{safe_id}; 344 344 my $app = $VARS->{app}; 345 345 my $params = $VARS->{params}; 346 346 my $iprscan = $VARS->{iprscan}; 347 347 my $the_void = $VARS->{the_void}; 348 348 my $LOG = $VARS->{LOG}; 349 349 350 #make files 350 351 my (undef, $ifile) = tempfile(); 351 my $ofile = "$the_void/$ CTL_OPT{safe_id}.$app";352 my $ofile = "$the_void/$safe_id.$app"; 352 353 FastaFile::writeFile($safe_fasta, $ifile); 353 354 … … 360 361 $command .= " -iprlookup" if($CTL_OPT{iprlookup}); 361 362 $command .= " -format $CTL_OPT{format}" if(defined $CTL_OPT{format}); 363 $command .= " -verbose" if($CTL_OPT{verbose}); 362 364 $command .= " " . join(' ', @$params); 363 365 $command .= " -appl $app -i $ifile -o $ofile"; 366 367 $LOG->add_entry("STARTED", $ofile, ""); 364 368 365 369 my $w = new Widget::iprscan(); … … 372 376 } 373 377 378 $LOG->add_entry("FINISHED", $ofile, ""); 379 374 380 unlink($ifile); 375 381 open(my $IN, "< $ofile"); … … 403 409 @args = (qw{CTL_OPT 404 410 cfile 405 outfile406 411 }, 407 412 @{$VARS->{CTL_OPT}{appl}} … … 411 416 elsif ($flag eq 'run') { 412 417 #-------------------------CODE 418 my %CTL_OPT = %{$VARS->{CTL_OPT}}; 413 419 my $cfile = $VARS->{cfile}; #combined contig output file 414 my $outfile = $ VARS->{outfile}; #combined every contig output file420 my $outfile = $CTL_OPT{outfile}; #combined every contig output file 415 421 416 422 my $lock = new File::NFSLock(".iprscan_lock", 'EX', 40, 40); … … 427 433 open($CFH, "> $cfile"); 428 434 429 while(my $key = each %{$VARS}){430 next if( $key eq 'outfile');435 foreach my $key (@{$CTL_OPT{appl}}){ 436 next if(! defined ($VARS->{$key})); 431 437 print $FH $VARS->{$key}; 432 print $CFH $ cfile;438 print $CFH $VARS->{$key}; 433 439 } 434 440 lib/Process/MpiTiers.pm
r258 r259 46 46 #optionaly override chunk type 47 47 $self->{CHUNK_REF} = shift @args || "Process::MpiChunk"; 48 require$self->{CHUNK_REF};49 $self->{CHUNK_REF} = new $self->{CHUNK_REF}; #turn into object48 eval "require ". $self->{CHUNK_REF}; 49 $self->{CHUNK_REF} = $self->{CHUNK_REF}->new(); #turn into object 50 50 51 51 #setup the tier lib/iprscan/runlog.pm
r258 r259 1 1 #------------------------------------------------------------------------------- 2 #------ runlog---------3 #------------------------------------------------------------------------------- 4 package runlog;2 #------ iprscan::runlog --------- 3 #------------------------------------------------------------------------------- 4 package iprscan::runlog; 5 5 use strict; 6 6 use vars qw(@ISA @EXPORT $VERSION); … … 55 55 print STDERR "\n\n\n--Next Contig--\n\n" unless($main::quiet); 56 56 57 my $min_contig = $self->{CTL_OPTIONS}->{min_contig} || 0;58 my $length = $self->{params}->{seq_length};59 60 if($length < $min_contig){#skip if this is a short contig61 $self->{continue_flag} = -2; #skipped signal is -262 63 return 0;64 }57 #my $min_contig = $self->{CTL_OPTIONS}->{min_contig} || 0; 58 #my $length = $self->{params}->{seq_length}; 59 60 #if($length < $min_contig){#skip if this is a short contig 61 # $self->{continue_flag} = -2; #skipped signal is -2 62 # 63 # return 0; 64 #} 65 65 66 66 return 1; … … 186 186 $key eq 'goterms' || 187 187 $key eq 'iprlookup' || 188 $key eq 'format' ||188 $key eq 'format' 189 189 ) { 190 190 $rm_key{all}++; … … 334 334 my $out_dir = $self->{params}->{out_dir}; 335 335 my $fasta_ref = $self->{params}->{fasta_ref}; 336 my $length = $self->{params}->{seq_length};336 #my $length = $self->{params}->{seq_length}; 337 337 338 338 if($flag == 0){ … … 341 341 "mpi_iprscan will now skip to the next contig.\n", 342 342 "SeqID: $seq_id\n", 343 "Length: $length\n",343 #"Length: $length\n", 344 344 "#---------------------------------------------------------------------\n\n\n"; 345 345 } … … 348 348 "Now starting the contig!!\n", 349 349 "SeqID: $seq_id\n", 350 "Length: $length\n",350 #"Length: $length\n", 351 351 "#---------------------------------------------------------------------\n\n\n"; 352 352 } … … 356 356 "All contig related data will be erased before continuing!!\n", 357 357 "SeqID: $seq_id\n", 358 "Length: $length\n",358 #"Length: $length\n", 359 359 "Retry: $die_count!!\n", 360 360 "#---------------------------------------------------------------------\n\n\n"; … … 364 364 "Now retrying the contig!!\n", 365 365 "SeqID: $seq_id\n", 366 "Length: $length\n",366 #"Length: $length\n", 367 367 "Retry: $die_count!!\n", 368 368 "#---------------------------------------------------------------------\n\n\n"; … … 374 374 "The contig will be stored in a fasta file that you can use for debugging.\n", 375 375 "SeqID: $seq_id\n", 376 "Length: $length\n",376 #"Length: $length\n", 377 377 "FASTA: $out_dir/$seq_out_name.died.fasta\n", 378 378 "#---------------------------------------------------------------------\n\n\n"; … … 386 386 "Skipping the contig because it is too short!!\n", 387 387 "SeqID: $seq_id\n", 388 "Length: $length\n",388 #"Length: $length\n", 389 389 "#---------------------------------------------------------------------\n\n\n"; 390 390 }
