#!/usr/bin/perl
use strict;
my @files = glob("*.bai");
foreach my $f ( @files ) {
    if ( ! ( $f =~ /bam.bai/ )) {
	my ( $prefix ) = $f =~ /^(.+).bai/;
	my $cmd = "mv $f $prefix.bam.bai\n";
	print $cmd;
    }
}
