Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Michael Rogoff <miker <at> htblis.com>
Subject: Bio::Graphics error when rendering features with Split locations
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Wednesday 6th February 2013 00:54:17 UTC (over 3 years ago)
When trying to render features from a genbank file that include a split
location e.g.:

     promoter        join(1000..1080,1..5)
                     /label=PROM1

The following exception is raised:
Can't locate object method "has_tag" via package "Bio::Location::Simple" at
lib/perl5/site_perl/5.10.1/Bio/Graphics/Glyph.pm line 704,  line 36.

This can be reproduced with the code in the example "Rendering Features
from a GenBank or EMBL File" from the Graphics HOW-TO:
http://www.bioperl.org/wiki/HOWTO:Graphics#Rendering_Features_from_a_GenBank_or_EMBL_File

Is there a way to change the script so that split locations would, at the
very least, not cause a fatal error?  Is there a different glyph type that
needs to be used?  Thanks in advance for any help.

I've attached a simple genbank input that will reproduce the error:

LOCUS       sample2     1080 bp DNA    circular
DEFINITION  Cloning vector sample2
ACCESSION   sample2
VERSION     sample2.1  GI:4352432
COMMENT     Component Fragments
FEATURES               Location/Qualifiers
     terminator      39..328
                     /label=TERM1
                     /note="terminator 1"
     misc_feature    393..488
                     /label=MF1
     CDS             complement(800..900)
                     /label=CDS1
                     /note="resistence gene"
     promoter        join(1000..1080,1..5)
                     /label=PROM1
ORIGIN
        1  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
       61  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      121  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      181  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      241  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      301  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      361  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      421  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      481  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      541  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      601  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      661  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      721  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      781  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      841  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      901  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
      961  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
     1021  nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnn
//



P.S.  I think I have traced the source of the problem to Glyph's _subfeat
method, which in the case of a feature with split locations is returning
location objects instead of feature objects.  Is this a bug?

sub _subfeat {
  my $class   = shift;
  my $feature = shift;

  return $feature->segments     if $feature->can('segments');

  my @split = eval { my $id   = $feature->location->seq_id;
                     my @subs = $feature->location->sub_Location;
                     grep {$id eq $_->seq_id} @subs;
                   };

  return @split if @split;

  # Either the APIs have changed, or I got confused at some point...
  return $feature->get_SeqFeatures         if
$feature->can('get_SeqFeatures');
  return $feature->sub_SeqFeature          if
$feature->can('sub_SeqFeature');
  return;
}
 
CD: 3ms