#!/usr/local/bin/perl5.6.1 -w

use Bio::SeqIO;
use Bio::SeqFeatureI;
use Bio::PrimarySeqI;
use strict;

my @files;
my @names;
my $length;
my $spacer;
my $name;

foreach my $f (`ls`){
if ($f  =~ /.embl/){
#print $f , "\t======== changing header\n";
push (@files, $f)}
}
#print @files;

foreach  my $i (@files){

if ($i =~/(.*)\.embl/){
push (@names, $1)
}

}


foreach $name (@names){

print $name, "\treplacing header==============\n";
$length = length($name);
#print $length,"\n";
#system ("perl -pi -e   's/all_bases/$name/g' $name.embl");
system ("perl -pi -e   's/unknown id/$name/g' $name.embl");
system ("perl -pi -e   's/XXX/DNA/g' $name.embl");
system ("perl -pi -e   's/UNK;//g' $name.embl");
#system ("perl -pi -e   's/\d{5,7}//g' $name.embl");
}

#if ($f  =~ /embl/){
#print $f, "\t processing";
#open (FILE, "<$f") or print "couldn't open the file";
#print "opened ",$f,"\n";
#@lines = <FILE>;
#print @lines;
#} system ("transeq  ./Pk2.chr$i.ordered.fasta  Pk2.chr$i.ordered.translated6");
#}
##########################
#open (FILE,"<$ARGV[0]");
#@syslines = <FILE>;
#close FILE;
#
########################
#open (FILE,"<$ARGV[1]");
#@queylines = <FILE>;
#close FILE;
###########################
#
#foreach $queryline(@querlines) {
#
#system (grep "$queryline"  $ARGV[0]);
#}
###################################


#}

#}
