[Bioperl-l] problem with trunc_with_features (SeqUtils.pm)

Heath O'Brien heath.obrien at gmail.com
Tue Apr 3 12:56:31 EDT 2012

Hi All,

I've encountered a bug in the trunc_with_features function in SeqUtils.pm, or at
least behavior that was unexpected to me:

Features with fuzzy coordinates in the original sequence are converted to exact
coordinates in the truncated sequence. For example, the script below changes the
coordinates for the feature from <1..5 to 1..5.

I have modified the code to change this behavior on my system, but I thought I'd
post something here in case others encounter the same problem.

all good things,

#!/usr/bin/perl -w

use strict;
use warnings;
use Bio::SeqIO;
use Bio::SeqUtils;

my $infile= shift;

my $inIO = Bio::SeqIO->new('-file' => $infile,
         '-format' => 'genbank') or die "could not open seq file $infile\n";
my $outfile = $infile . '_out.gbk';

my $outIO = Bio::SeqIO->new('-file' => ">$outfile",
         '-format' => 'genbank') or die "could not open seq file $outfile\n";
my $in_seq = $inIO->next_seq;
my $out_seq = Bio::SeqUtils->trunc_with_features($in_seq, 1, 5);

LOCUS       test_sequence        57303 bp    DNA     linear   UNA 
DEFINITION  Sequence to demonstrate unexpected behavior of trunc_with_features
ACCESSION   unknown
FEATURES             Location/Qualifiers
     source          1..10
                     /mol_type="genomic DNA"
     gene            <1..5
     CDS             <1..5
                     /product="hypothetical protein"
        1 caagattaaa

More information about the Bioperl-l mailing list