[Bioperl-l] to_FTstring() for Bio::Graphics::FeatureBase

Jason Stajich jason at bioperl.org
Fri Jan 26 18:15:43 EST 2007


sure -
i made a quick fix to make sure length is positive in Segment.pm -  
feel free to undo that, I should probably wait for you to make the  
full changes.

-jason

On Jan 26, 2007, at 3:12 PM, Lincoln Stein wrote:

> Hi Jason,
>
> Ack, embarassing. I'll fix this somehow and commit when I think the  
> changes
> are right. Feel free to make suggestions.
>
> Lincoln
>
> On 1/26/07, Jason Stajich <jason at bioperl.org> wrote:
>>
>> Let me rephrase - I can see where this might not be the correct  
>> fix. I
>> have Bio::DB::SeqFeature objects which are CDS objects, I want to  
>> print out
>> their location with to_FTstring, but it is only returning min..max  
>> for the
>> location.
>>  I guess for something that is a Segment there is only one value
>> (min..max) that should be presented.
>>
>> imagine I've done:
>>  for my $gene ( $segment->features('gene') ) {
>>   for my $mRNA ( $gene->get_SeqFeatures('mRNA') {
>>    for my $CDS ( $mRNA->get_SeqFeatures('CDS') {
>>      print $CDS->location->to_FTstring();
>>    }
>>   }
>>  }
>>
>>
>> Also - I note that if I call $CDS->length on a reverse-strand  
>> feature I
>> get a negative length.
>>
>> So Feature::Base would need to be changed to this:
>>
>> sub length {
>>   my $self = shift;
>>   return $self->high - $self->low + 1;
>> }
>>
>> instead of
>>
>> sub length {
>>   my $self = shift;
>>   return $self->end - $self->start + 1;
>> }
>>
>>
>> -jasonOn Jan 26, 2007, at 2:52 PM, Jason Stajich wrote:
>>
>> Lincoln:
>>
>> Right now the code for Bio::Graphics::FeatureBase implementation  
>> of the
>> LocationI interface method, to_FTstring is:
>>
>> sub to_FTstring {
>>   my $self = shift;
>>   my $low  = $self->min_start;
>>   my $high = $self->max_end;
>>   return "$low..$high";
>> }
>>
>> So strand is thrown away.  Is it legitimate to modify this to return
>> $high..$low when strand < 0?
>>
>> -jason
>>
>>
>> --
>> Jason Stajich
>> jason at bioperl.org
>> http://jason.open-bio.org/
>>
>>
>>
>>
>
>
> -- 
> Lincoln D. Stein
> Cold Spring Harbor Laboratory
> 1 Bungtown Road
> Cold Spring Harbor, NY 11724
> (516) 367-8380 (voice)
> (516) 367-8389 (fax)
> FOR URGENT MESSAGES & SCHEDULING,
> PLEASE CONTACT MY ASSISTANT,
> SANDRA MICHELSEN, AT michelse at cshl.edu

--
Jason Stajich
Miller Research Fellow
University of California, Berkeley
lab: 510.642.8441
http://pmb.berkeley.edu/~taylor/people/js.html




More information about the Bioperl-l mailing list