#!/usr/local/bin/perl
#
# rename series of frames
#
if ($#ARGV != 2) 
  {
    print "usage: \"raxml-parameters\" runID numberOfBootstraps\n";
    exit;
  }

$commandLine        = $ARGV[0];
$runID              = $ARGV[1];
$numberOfBootstraps = $ARGV[2];



for ($i=0; $i < $numberOfBootstraps; $i++) 
  {  
    $b = int(rand(10000000));


    $cmd = "raxml $commandLine -b $b -n $runID.$i";


    system($cmd);
     
  }


$cat = "cat ";

for ($i=0; $i < $numberOfBootstraps; $i++) 
  {
    $cat = "$cat RAxML_result\.$runID.$i";
    
  }

$cat = "$cat > Consensus.$i.$runID";
system($cat);

$d = 0;

print "Bootstrap Run completed\n";
print "Individual Trees written to files RAxML_result\.$runID.$d through RAxML_result\.$runID.$numberOfBootstraps\n";
print "All tree files written to one large file: Consensus.$i.$runID to build consensus tree\n";

#print $cat."\n";
