[Bioperl-l] problem with Bio::Das::FeatureTypeI::name

Vincenza Maselli vincenza.maselli at gmail.com
Tue Oct 21 10:34:21 UTC 2008


Dear All

I tried to write a simple script to write a gff file, but my script dead
when try to execute the method  _write_feature_3 in the gff.pm module but I
got this message:

Abstract method "Bio::Das::FeatureTypeI::name" is not implemented by package
Bio::DB::GFF::Typename.
This is not your fault - author of Bio::DB::GFF::Typename should be
blamed!

Do you have any suggestion to overcome this problem? Did someone implemented
it?

Thanks for the help

Vincenza


================== START CODE
==============================================================================
! /usr/bin/perl

use strict;
use DBI;
use DBD::mysql;
use Data::Dumper;
use Bio::FeatureIO;
use Bio::DB::GFF;
use Bio::DB::GFF::Featname;
use Bio::SeqFeature::Generic;

my $hostname = 'localhost';
my $user = 'user';
my $password = 'passwd';
my $dsn = "dbi:mysql:database=dbname;host=$hostname";


my $dbh = DBI->connect($dsn, $user, $password,{PrintError=>0,RaiseError=>0})
|| die "Can't connect to database:$DBI::errstr\n";

my $out = Bio::FeatureIO->new(-file    => ">>test.gff" ,
                             -format  => 'GFF' ,
                             -version => 3);

# queries

my $sql = qq{SELECT d.fid, d.fref, d.fstart, d.fstop, d.fbin, d.fscore,
d.fstrand, d.fphase,  d.ftarget_start, d.ftarget_stop,
                    t.fmethod, t.fsource,
            g.gid,g.gclass,g.gname
         FROM fdata d, ftype t, fgroup g
         WHERE d.ftypeid = t.ftypeid
         AND d.gid = g.gid
         LIMIT 1};
my $sth = $dbh->prepare($sql);
$sth->execute;

# create GFF adaptor

my $gff_adaptor = Bio::DB::GFF->new(-dsn => $dsn,
            -user => $user,
            -pass => $password);

#initialize variables for feature object

my $factory = $gff_adaptor;      #a Bio::DB::GFF adaptor object (or
descendent)

while (my $ref = $sth->fetchrow_hashref){
  my $srcseq  = "ATGCGGATAGACGATAGCGATAACCTATAGTAGATCCGCTCGATCGTAGC";
#the source sequence
  my $start   = $ref->{'fstart'};     #start of this feature
  my $stop    = $ref->{'fstop'};     #stop of this feature
  my $method  = $ref->{'fmethod'};     #this feature's GFF method
  my $source  = $ref->{'fsource'};     #this feature's GFF source
  my $score   = $ref->{'fscore'};     #this feature's score
  my $fstrand = $ref->{'fstrand'};     #this feature's strand (relative to
the source sequence, which has its own strandedness!)
  my $phase   = $ref->{'fphase'};     #this feature's phase
  my $group   = Bio::DB::GFF::Featname->new(-class => $ref->{'gclass'},-name
=> $ref->{'gname'});     #this feature's group
  my $db_id   = $ref->{'fid'};     #this feature's internal database ID
  my $group_id = $ref->{'gid'};
  my $tstart = $ref->{'ftarget_start'};
  my $tstop = $ref->{'ftarget_stop'};
#create feature object

my $feat = Bio::DB::GFF::Feature->new(
                      $factory,
                      $srcseq,
                      $start,
                      $stop,
                      $method,
                      $source,
                      $score,
                      $fstrand,
                      $phase,
                      $group,
                      $db_id,
                      $group_id,
                      $tstart,
                      $tstop);

  #write out features
  my $seq_feat = Bio::SeqFeature::Generic->new( -gff3_string =>
$feat->gff3_string );
  my $annseq = Bio::SeqFeature::Annotated->new(-start => $start,
                                               -end => $stop,
                           -phase => $phase);
  $annseq->add_SeqFeature($feat);
  $out->write_feature($annseq);
}

=========================== START RETURN
============================================================

>$ perl
create_gff.pl


------------- EXCEPTION: Bio::Root::NotImplemented -------------
MSG: Abstract method "Bio::Das::FeatureTypeI::name" is not implemented by
package Bio::DB::GFF::Typename.
This is not your fault - author of Bio::DB::GFF::Typename should be
blamed!

STACK: Error::throw
STACK: Bio::Root::Root::throw
/usr/local/lib/perl5/site_perl/5.10.0/Bio/Root/Root.pm:357
STACK: Bio::Root::RootI::throw_not_implemented
/usr/local/lib/perl5/site_perl/5.10.0/Bio/Root/RootI.pm:680
STACK: Bio::Das::FeatureTypeI::name
/usr/local/lib/perl5/site_perl/5.10.0/Bio/Das/FeatureTypeI.pm:142
STACK: Bio::FeatureIO::gff::_write_feature_3
/usr/local/lib/perl5/site_perl/5.10.0/Bio/FeatureIO/gff.pm:884
STACK: Bio::FeatureIO::gff::_write_feature_3
/usr/local/lib/perl5/site_perl/5.10.0/Bio/FeatureIO/gff.pm:934
STACK: Bio::FeatureIO::gff::write_feature
/usr/local/lib/perl5/site_perl/5.10.0/Bio/FeatureIO/gff.pm:263
STACK: create_gff.pl:86
----------------------------------------------------------------



=====================================================================================================

-- 
Vincenza Maselli
Dept. of Soil, Plant, Environmental and Animal Production Sciences
University of Naples "Federico II"
Via Universita' 100
Parco Gussone - building number 75 "GenoPom"
80055 Portici, Naples, Italy
phone: +39-081-2539246
web: http://cab.unina.it



More information about the Bioperl-l mailing list