Hi, I have a GenBank file and am extracting a gene upstream and downstream of a target gene, with everything in between (3 genes + 2 intergenic regions). I am loading the sequence in BioPerl and outputting the sequence to a file.
However, I want to make genes uppercase and intergenic regions lowercase. Is there an easy way to do this? Is there a clean BioPerl way?
sub extractSeq{
my($file,$start,$end,$settings)=@_;
my $targetSeq;
my $seqin=Bio::SeqIO->new(-file=>$file);
if($$settings{contig}){
while(my $seq=$seqin->next_seq){
if($seq->id eq $$settings{contig}){
$targetSeq=$seq;
last;
}
}
} else {
$targetSeq=$seqin->next_seq;
}
my $sequence=$targetSeq->subseq($start,$end);
my $genomeName=basename($file,qw(.gbk .gbk.fna));
my $extractedSeq=Bio::Seq->new(-id=>join("_",$genomeName,$$settings{contig},$start,$end),-seq=>$sequence);
$extractedSeq=$extractedSeq->revcom if($$settings{revcom});
return $extractedSeq;
}