[Bioperl-l] [Bioperl-guts-l] Notification: incoming/932 (fwd)

Jason Stajich jason@chg.mc.duke.edu
Wed, 21 Mar 2001 15:52:38 -0500 (EST)


Simon - Thanks for bug the submission, this is just a case of not rolling
the location object back into the SeqFeature methods the way we should.

However there is a way you can make this work because technically you
don't have sub SeqFeatures, but sub_locations here.

#!/usr/local/bin/perl -w
use Bio::SeqIO;
use strict;

my $seqio = new Bio::SeqIO(-format => 'genbank', -file => 'AF183172.gb');
while( my $seq = $seqio->next_seq ) {
    foreach  my $feat ( $seq->top_SeqFeatures ) {
	if( $feat->primary_tag =~ /cds/i) {
	    if( ref $feat->location &&
		$feat->location->isa('Bio::Location::SplitLocationI') ) {
		my @sublocs = $feat->location->sub_Location();
		printf("Found a CDS from %d to %d with %d  sub-features.\n",
		       $feat->start,$feat->end,scalar(@sublocs));
	    } else {
		# hope that someone implemented this
		my @subFeats = $feat->sub_SeqFeature();
		printf("Found a CDS from %d to %d with %d  sub-features.\n",
		       $feat->start,$feat->end,scalar(@subFeats));
	    }
	}
    }
}
Jason Stajich
jason@chg.mc.duke.edu
Center for Human Genetics
Duke University Medical Center
http://www.chg.duke.edu/


---------- Forwarded message ----------
Date: Wed, 21 Mar 2001 13:51:10 -0500
From: bioperl-bugs@bioperl.org
To: bioperl-guts-l@bioperl.org
Subject: [Bioperl-guts-l] Notification: incoming/932

JitterBug notification

new message incoming/932

Message summary for PR#932
	From: simon_cawley@affymetrix.com
	Subject: sub_SeqFeature bug
	Date: Wed, 21 Mar 2001 13:51:08 -0500
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From simon_cawley@affymetrix.com Wed Mar 21 13:51:08 2001
Received: from localhost (localhost [127.0.0.1])
	by pw600a.bioperl.org (8.11.2/8.11.2) with ESMTP id f2LIp8202238
	for <bioperl-bugs@pw600a.bioperl.org>; Wed, 21 Mar 2001 13:51:08 -0500
Date: Wed, 21 Mar 2001 13:51:08 -0500
Message-Id: <200103211851.f2LIp8202238@pw600a.bioperl.org>
From: simon_cawley@affymetrix.com
To: bioperl-bugs@bioperl.org
Subject: sub_SeqFeature bug

Full_Name: Simon Cawley
Module: Bio::SeqFeature::Generic.pm (I think)
Version: 0.7.0
PerlVer: 5.6.0
OS: Linux RedHat 6.2
Submission from: firewall.neomorphic.com (205.217.46.68)


I'm running into a problem where I can't access
the sub features of a CDS feature.  To reproduce,
I'm working with a sequence of accession id
AB000381 (saved as AB000381.seq) which has a CDS
of 3 exons:

$ grep CDS AB000381.seq
     CDS             join(28199..28271,28881..28988,34291..34586)

I run the following script:

use Bio::SeqIO;
$in = Bio::SeqIO->new(-file => 'AB000381.seq', -format => 'GenBank');
$seq = $in->next_seq();
foreach $feat ($seq->top_SeqFeatures() ) {
  if($feat->primary_tag =~ /cds/i) {
    @subFeats = $feat->sub_SeqFeature();
    printf("Found a CDS from %d to %d with %d sub-features.\n",
      $feat->start,$feat->end,scalar(@subFeats));
  }
}

Which gives the following output:
  Found a CDS from 28199 to 34586 with 0 sub-features.

Thanks for looking at this,

Simon



_______________________________________________
Bioperl-guts-l mailing list
Bioperl-guts-l@bioperl.org
http://bioperl.org/mailman/listinfo/bioperl-guts-l