[Bioperl-l] how to get specific sub-sequence from GenBank file with Bio::DB::GenBank

Juan Jovel jovel_juan at hotmail.com
Sat Apr 14 23:27:57 EDT 2012

Hello All, 
I want to get some subsequences from provirus sequences in the GenBank, I got the whole sequences with the script below. However, I want to get a specific sub-sequence, which appears in the GenBank files in the line:  LTR             9091..9723
how can I modify my script to get only nts 9091-9723 (in this example), instead of the whole sequence.
Thanks a lot in advance!________________________HERE THE SCRIPT:
#!/usr/bin/perl -wuse strict;use Bio::DB::GenBank;use Bio::SeqIO;
chomp(my $infile = $ARGV[0]);open(IN, "$infile") or die "$!";my @ids = <IN>;
chomp(my $outfile = $ARGV[1]);
my $seqs_out = Bio::SeqIO -> new(-file => ">$outfile",			     -format => "fasta"); 
foreach my $entry(@ids){        print "$entry";	my $db = Bio::DB::GenBank->new;	my $seq = $db->get_Seq_by_acc($entry);	$seqs_out->write_seq($seq);	}exit;


More information about the Bioperl-l mailing list