#!/usr/bin/perl

use strict;

foreach my $bam ( glob( "*.bam")) {
  my $bai = $bam;
  $bai =~ s/bam$/bai/;
  my $cmd = "samtools index $bam $bai";
  print "$cmd\n";
  system("$cmd &");
  sleep 5;
}
