#BEGIN{
#    $ENV{'PATH'}=$ENV{'PATH'}.":/local/workspace01/zhangju/script/perl";
#    push(@INC,"/local/workspace01/zhangju/script/perl");
#}

use strict;
use Bio::SeqIO;
use Bio::Annotation::Collection;
use Bio::Annotation::Comment;
 
my $input_file = "GenePRIMP.art";#"GenePRIMP.art";

my $root_dir="/local/workspace01/zhangju/wc1_annotation/curated";

my $embl_dir=$root_dir."/single_curated_embl";
my $gbk_dir=$root_dir."/single_curated_gbk";
my $new_embl=$root_dir."/single_new_embl";
chdir($root_dir);
my $seq_in  = Bio::SeqIO->new(
                              -format => 'genbank',
                              -file   => $input_file,
                              );
                              
my $gbk_file="twc1_curatedFeb7.gbk";		  
my $gbk_out = Bio::SeqIO->new(
   							-file   => ">".$gbk_file,
    						-format => 'genbank',
     					);
my $seq;
while( $seq = $seq_in->next_seq() ) {

  
    #my $line1="LOCUS\t".$seq->display_id."\t".length($seq->seq)." bp\tDNA\tlinear\t07-DEC-2011";
    my $embl_file=$embl_dir."/".$seq->id;
    my $embl_in  = Bio::SeqIO->new(
                              -format => 'embl',
                              -file   => $embl_file,
                              );
    my $embl_seq=$embl_in->next_seq();
    
    	#$gseq->add_date("07-DEC-2011");
    $embl_seq->molecule($seq->molecule);
    $embl_seq->display_id($seq->display_id);
    $embl_seq->division("BCT 07-DEC-2011");
    #$gseq->keywords("No");
    #my $comment=Bio::Annotation::Comment->new();
    #$comment->text("No");
    #my $col1=new Bio::Annotation::Collection;
    #$col1->add_Annotation('comment',$comment);
    #$gseq->annotation($col1);
	$gbk_out->write_seq($embl_seq);
    print $seq->display_id."\n";
 
}

=begin comment
$seq_in  = Bio::SeqIO->new(
                           -format => 'genbank',
                           -file   => $input_file,
                       );

my $gbk_in = Bio::SeqIO->new(
   							-file   => $gbk_file,
    						-format => 'genbank',
     					);
my $gseq;

$gbk_out = Bio::SeqIO->new(
							-format => 'genbank',
   							-file   => '>v2_'.$gbk_file,
      					);

while($gseq=$gbk_in->next_seq()){
	my $qaseq=$seq_in->next_seq();
	#$gseq->add_date("07-DEC-2011");
    $gseq->molecule($qaseq->molecule);
    $gseq->display_id($qaseq->display_id);
    $gseq->division("BCT 07-DEC-2011");
    #$gseq->keywords("No");
    #my $comment=Bio::Annotation::Comment->new();
    #$comment->text("No");
    #my $col1=new Bio::Annotation::Collection;
    #$col1->add_Annotation('comment',$comment);
    #$gseq->annotation($col1);
	$gbk_out->write_seq($gseq);
	print "abc";
	last;
}
=end comment
=cut