#!/usr/bin/perl # #########1#########2#########3#########4#########5#########6#########7######## # # qsub_megablast_validation.pl # # Program generates a bash script to run with Sun Grid Engine. # # Runs 'validate_megablast_output.pl' against all output files # from mega_blast in your current directory having names similar to : # # chr##.xml.#.mega_out # # Use of Sun Grid Engine allows multiple jobs to be generated # by this program and SGE queues them and executes each as # machine resources are available. # # Command-line Parameters : # # none # # Before running this program you must 'cd' into directory where # your mega_blast output files are located (see README for Build 2). # # syntax : [path]/qsub_megablast.pl # #########1#########2#########3#########4#########5#########6#########7######## # # use Env qw(UPROBE_BIN_DIR); if (! (-x "$UPROBE_BIN_DIR/validate_megablast_output.pl") ) { my $ErrMsg = "Error : Did not find 'validate_megablast_output.pl'\n "; my $ErrMsg = $ErrMsg." Did you forget to define UPROBE_BIN_DIR ? \n"; die $ErrMsg."\n"; } # open (IN,"ls chr*.mega_out |") || die "Hey - You dont have any MegaBlast output files for me !"; while () { chop; ($chromosome, $fractional) = ($_ =~ m/chr(.+).xml.(.+)/); $file = $_; ($outfile) = ($file =~ m/(.+)\.mega_out/); $outfile = "$outfile.valid"; $base_name = "validate_".$chromosome."_".$fractional; $stdout = "$base_name.out"; my $jobname = "Val-$chromosome-$fractional"; my $outname= "$base_name.bash"; print "Creating $outname\n"; open(OUT,"> $outname"); print OUT "#!/bin/bash \n"; print OUT "#\$ -N $jobname \n"; print OUT "#\$ -S /bin/bash \n"; print OUT "#\$ -o $stdout \n"; print OUT "#\$ -cwd \n"; #print OUT "#\$ -m e \n"; # print OUT "#\$ -M yourEmailId\@your.Email.Domain \n"; print OUT "# \n"; print OUT "cat $file | /usr/bin/sort > $file.sorted\n"; print OUT "$UPROBE_BIN_DIR/validate_megablast_output.pl -f $file.sorted > $outfile\n"; # print OUT "rm $file.sorted\n"; close OUT; system("qsub $outname"); } ############################################################################## # Start Description # For each input file in current directory, sort the file then run validate_megablast_output.pl # End Description ##############################################################################