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

Jason Stajich jason@cgt.mc.duke.edu
Mon, 11 Feb 2002 21:59:00 -0500 (EST)


Dan -

You're going to need to get the CDS from the gene object not the exon
object - genscan doesn't provide the individual exon sequences, just the
full CDS.  Even though the exon object has a predicted_cds it doesn't
necessarily mean it is filled in (but it is for MZEF prediction parsing).
I guess one should be able to infer the sequence based on the
exon table, but we don't parse it in that way.
Perhaps it would be a good shortcut that someone would like to add?
Probably incorperating parts from the below would work (double checking I
didn't forget something...).

In the meantime I think the following code should work (barring any
off-by-one errors I might have accidently forgotten to check here).

use Bio::Tools::Genscan;

$input = shift or die $!;
$genscan = Bio::Tools::Genscan->new(-file => $input);

while ($gene = $genscan->next_prediction()){
    @exon_arr = $gene->exons();
    $predicted_cdna = $gene->predicted_cds();
    $seq = $predicted_cdna->seq();

    my $first = 1;
    my $l = 0;
    foreach $exon (@exon_arr){
	my $start = $first;
	my $end   = $first + $exon->length() - 1;
	my $s = $predicted_cdna->subseq($start,$end );
	$first += $exon->length();
	$l += length($s);
	print "exon seq is $s for $start..$end\n";
    }
}
$genscan->close();

---
Jason Stajich
Duke University
jason@cgt.mc.duke.edu

---------- Forwarded message ----------
Date: Mon, 11 Feb 2002 20:19:12 -0500
From: bioperl-bugs@bioperl.org
To: bioperl-guts-l@bioperl.org
Subject: [Bioperl-guts-l] Notification: incoming/1082

JitterBug notification

new message incoming/1082

Message summary for PR#1082
	From: dli@tularik.com
	Subject: predicted_cds method doesn't return a promaryseqI obj
	Date: Mon, 11 Feb 2002 20:19:11 -0500
	0 replies 	0 followups

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

>From dli@tularik.com Mon Feb 11 20:19:11 2002
Received: from localhost (localhost [127.0.0.1])
	by pw600a.bioperl.org (8.12.2/8.12.2) with ESMTP id g1C1JBkO000715
	for <bioperl-bugs@pw600a.bioperl.org>; Mon, 11 Feb 2002 20:19:11 -0500
Date: Mon, 11 Feb 2002 20:19:11 -0500
Message-Id: <200202120119.g1C1JBkO000715@pw600a.bioperl.org>
From: dli@tularik.com
To: bioperl-bugs@bioperl.org
Subject: predicted_cds method doesn't return a promaryseqI obj

Full_Name: Dan Li
Module: Bio::Tools::Prediction::Exon
Version: 0.7.2
PerlVer: 5.6.1
OS: linux
Submission from: host190.tularik.com (216.88.144.190)


When I run the following script using a standard genscan output file as input,
method predicted_cds() didn't return a Bio::PromarySeqI object. Error message:
Can't call method "seq" on an undefined value....

#! /usr/bin/perl

use lib '/usr/local/lib/bioperl-0.7.2';
use Bio::Tools::Genscan;

$input = shift or die $!;
$genscan = Bio::Tools::Genscan->new(-file => $input);

while ($gene = $genscan->next_prediction()){
    @exon_arr = $gene->exons();
    foreach $exon (@exon_arr){
	$predicted_cdna = $exon->predicted_cds();
	$seq = $predicted_cdna->seq();
	print "$seq\n";
    }
}
$genscan->close();



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