Bioperl: Re: Bioperl-guts: seq/primarySeq/seqFeature

Bradley Marshall bradbioperl@yahoo.com
Thu, 18 May 2000 14:26:06 -0700 (PDT)


Yeah,

That makes sense.  It also explains why it works fine
if you add the features first, but not if you add the
sequence first - it skips those tests.

Brad

--- James Gilbert <jgrg@sanger.ac.uk> wrote:
> 
> 
> 
> Bradley,
> 
> I think this may be a bug in
> Bio::Seq::add_SeqFeature
> 
> 
>    if( $feat->can("seq") ) {
>        $fseq = $feat->seq;
>        $aseq = $self->seq;
> 
>        if( defined $aseq ) {
> 	   if( defined $fseq ) {
> 	       if( $aseq ne $fseq ) {
> 		   $self->warn("$feat has an attached sequence
> which is not in this annseq. I worry about this");
> 	       }
> 	   } else {
> 	       if( $feat->can("attach_seq") ) {
> 		   # attach it 
> 		   $feat->attach_seq($aseq);
> 
> I think this last line should be:
> 
>              $feat->attach_seq($self->primary_seq);
> 
> Because $aseq is actually the sequence string.  
> Also, I don't think it can ever have not show a
> warning, because $fseq will always be the sequence
> of the feature itself.  Maybe we want to do
> something like this:
> 
>    # entire_seq appears to return the PrimarySeq
>    # object attatched to the feature.  Maybe we
>    # need a primary_seq method?
>    if( $feat->can("entire_seq") ) {
>        $fseq = $feat->entire_seq;
>        $aseq = $self->primary_seq;
> 
>        if( defined $aseq ) {
> 	   if( defined $fseq ) {
> 	       if( $aseq != $fseq ) {
> 		   $self->warn("$feat has an attached sequence
> which is not in this annseq. I worry about this");
> 	       }
> 	   } else {
> 	       if( $feat->can("attach_seq") ) {
> 		   # attach it 
> 		   $feat->attach_seq($aseq);
> 
> The comparison $aseq != $fseq now tests to see if
> the two primary_seq objects are the same object
> (it in effect compares memory addresses).  
> 
> I've CC'd this to Ewan.  Am I dazed and confused
> Ewan?
> 
> 	James
> 
> PS: I've posted this to bioperl, because
> bioperl-guts is supposed to be for boring
> JitterBug messages etc...
> 
> On Thu, 18 May 2000, Bradley Marshall wrote:
> 
> > 
> > So I'm working on parsing game features into
> bioperl
> > features, but I'm having some issues with the best
> way
> > to create a sequence with features.
> > 
> > The documentation just says this:
> > 
> >    $feat = new Bio::SeqFeature::Generic ( -start
> =>
> > 10, -end => 100);
> > 
> >    # add it to an annotated sequence
> > 
> >    $annseq->add_SeqFeature($feat);
> > 
> > This doesn't work and throws this error:
> > 
> > -------------------- EXCEPTION
> --------------------
> > MSG: Must attach Bio::PrimarySeqI objects to
> > SeqFeatures
> > CONTEXT: Error in object Bio::SeqFeature::Generic
> > "anonymous Bio::SeqFeature::Generic"
> > SCRIPT: seqFeature.pl
> > STACK: 
> > Bio::SeqFeature::Generic::attach_seq(521)
> > Bio::Seq::add_SeqFeature(591)
> > main::seqFeature.pl(22)
> >
> ---------------------------------------------------
> > 
> > If I attach the feature to the seq first, it
> works,
> > but it 1) looks a little odd and 2) throws a
> warning:
> > 
> > 
> > $feat = new Bio::SeqFeature::Generic ( -start =>
> 5,
> > -end => 10);
> > 
> > $feat->attach_seq($annseq);
> > 
> > $annseq->add_SeqFeature($feat);
> > 
> > -------------------- WARNING --------------------
> > MSG: Bio::SeqFeature::Generic=HASH(0x8232c90) has
> an
> > attached sequence which is not in this annseq. I
> worry
> > about this
> > -------------------------------------------------
> > 
> > Is there a better way?
> > 
> > Thanks
> > Brad
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Send instant messages & get email alerts with
> Yahoo! Messenger.
> > http://im.yahoo.com/
> > =========== Bioperl Project Mailing List Message
> Footer =======
> > Project URL: http://bio.perl.org
> > For info about how to (un)subscribe, where
> messages are archived, etc:
> >
>
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl-guts.html
> >
>
====================================================================
> > 
> 
> James G.R. Gilbert
> The Sanger Centre
> Wellcome Trust Genome Campus
> Hinxton
> Cambridge                        Tel: 01223 494906
> CB10 1SA                         Fax: 01223 494919
> 
> 


__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================