CSC334 runHisto.pl

From CSclasswiki
Jump to: navigation, search

--D. Thiebaut 10:49, 4 November 2008 (UTC)


#! /usr/bin/perl -w
# runHisto.pl
# D. Thiebaut
# this script submits the perl script genAminoHisto.pl multiple times
# to the XGrid.
#
# Syntax:
#     runHisto.pl nnnn dddd
# 
# where nnnn is the number of jobs to submit to the XGrid, and dddd
# is the number of samples each job is supposed to generate.
#

#--- check syntax ---
if ( $#ARGV < 1 ) {
    print "\nSyntax: runHisto.pl nnnd dddd\n\n";
    print "where nnnn is the number of jobs to submit to the XGrid,\n";
    print "and dddd is the number of samples each job is supposed to generate\n\n";
    exit( 0 );
}

#--- get command line arguments ---
my $numberOfJobs = $ARGV[0];
my $numberOfSamples = $ARGV[1];

#--- generate nnnn jobs of dddd samples ----
for ( my $nnnn = 0; $nnnn < $numberOfJobs; $nnnn++ ) {
    my $output = `xgrid -job submit genAminoHisto.pl $numberOfSamples`;
    foreach ( $output ) {
	print $_;
    }
    print "\n";
}