#!usr/bin/perl

use strict;
use warnings;
#use lib '/sw/lib/perl5/5.8.1';
use Bio::Perl;

use Bio::Seq;
use Bio::SeqIO;
use Bio::DB::GenBank;

#choose your variables
my $sequence_acc = "AB182587";
my $database = 'genbank';
my $sequence = "aaaaccttgatgatcga";


#create file object
my $seqIO_object = Bio::SeqIO->new(-file => '>sequence.fasta',
                             -format => 'genbank' );  #format as genbank!!! can also do fasta

#create database and get genbank sequence
my $db = Bio::DB::GenBank->new();

#get GenBank sequence
my $seq_object = $db->get_Seq_by_acc($sequence_acc);     #get_Seq_by_id retrieves by GI number

#create sequence object from scratch
#my $seq_object = Bio::Seq->new(-seq => "aaaatgggggggggggccccgtt",
#                         -display_id => "#12345",
#                         -desc => "example 1" );

#write sequence object to file
$seqIO_object -> write_seq($seq_object);

#print $seq_object to screen;
print $seq_object->accession_number(), "\n";
print $seq_object->desc, "\n";
print $seq_object->seq, "\n";

print "Hello, world!\n";
