#!/usr/bin/perl use warnings; use strict; use Bio::DB::GenBank; use Bio::SeqIO; my $acc = "NC_027152.1"; my $gb = new Bio::DB::GenBank; my $seq1 = $gb->get_Seq_by_acc($acc); my $sequence = $seq1->seq; region($sequence,313,1374); sub region { my ($string,$begin,$end) = @_; my $length = $end - $begin + 1; my $region = lc substr($string,$begin-1,$length); my @line; my $posn = 1; print "Posn $begin - $end length $length\n"; while ($region =~ /(.{10}|.{1,9}$)/g){ push @line,$1; if (@line == 6){ printf "%4d %s\n",$posn,join ' ',@line; $posn += @line * 10; @line=(); } } printf "%4d %s\n",$posn,join ' ',@line if (@line); }