[Bioperl-l] Bio::Root::Root/Bio::LiveSeq::Mutation

Jason Stajich jason at bioperl.org
Wed Jan 17 11:40:45 EST 2007


I think you are ignoring the fact that errors are thrown for a  
reason, not just to annoy you.

Why not store the data in Bio::Seq objects as IUPAC ambiguity codes  
and write a special writer class in Bio::SeqIO which converts the  
ambiguity codes to your specified encoding.
There are examples of how to write your own Bio::SeqIO class in the  
HOWTO tutorials when we talk about extending the toolkit. There is  
also all the code to decompose an ambiguity code into the bases it  
represents.


-jason
On Jan 16, 2007, at 2:20 AM, marian thieme wrote:

> Hi, as I told to this list some time ago, I want to ouput  
> heterozygous dna sequences of different individuals.
> We need to output variations in the following manner:
> [a/g] if there is a loci where one allele has an "a" and the other  
> has a "g". (Also known as BIC db format or something like this)
> My approach is to use the Bio::LiveSeq::Mutation (class ?) to  
> change the specific position in the sequence.
>
>
> Bio::SeqUtils->mutate($seqobj, Bio::LiveSeq::Mutation->new(
>   -seq => "[a/g]",
>   -seqori => $seqori,
>   -pos => $pos,
>   -len => $length));
>
> But unfortunatly this would rise an exception, that some unexpected  
> chars occur. Hence I went in to the code of Root.pm and made a  
> small change: commenting out line 359 in Root.pm :
>
> if( $ERRORLOADED ) {
> #       print STDERR "  Calling Error::throw\n\n";
>
>        # Enable re-throwing of Error objects.
>        # If the error is not derived from Bio::Root::Exception,
>        # we can't guarantee that the Error's value was set properly
>        # and, ipso facto, that it will be catchable from an eval{}.
>        # But chances are, if you're re-throwing non- 
> Bio::Root::Exceptions,
>        # you're probably using Error::try(), not eval{}.
>        # TODO: Fix the MSG: line of the re -thrown error. Has an  
> extra line
>        # containing the '----- EXCEPTION -----' banner.
>        if( ref($args[0])) {
>            if( $args[0]->isa('Error')) {
>                my $class = ref $args[0];
>                $class->throw( @args );
>            } else {
>                my $text .= "\nWARNING: Attempt to throw a non- 
> Error.pm object: " . ref$args[0];
>                my $class = "Bio::Root::Exception";
>                $class->throw( '-text' => $text, '-value' => $args 
> [0] );
>            }
>        } else {
>            $class ||= "Bio::Root::Exception";
>
>            my %args;
>            if( @args % 2 == 0 && $args[0] =~ /^-/ ) {
>                %args = @args;
>                $args{-text} = $text;
>                $args{-object} = $self;
>            }
>
> (Line 359:)   #$class->throw( scalar keys %args > 0 ? %args :  
> @args ); # (%args || @args) puts %args in scalar context!
>  &nbs p;     }
>    }
>
>
> After I did alter this line all is working fine. But I know that  
> this can be considered in the best case  as a work around.
>
> 2 Questions:
>
> Do you think it is worth to provide some class which are natively  
> able to cope with that matter ?
> Do I need to expect some unwanted behavior of some scripts resp.  
> classes ?
>
> Regards,
> Marian
>
>
>
>
>
>
>
>
> _________________________________
> Stelle Deine Fragen bei Lycos iQ http://iq.lycos.de/qa/ask/
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

--
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