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

Heikki Lehvaslaiho heikki at sanbi.ac.za
Wed Jan 17 08:26:58 UTC 2007


Marian,

I do not think preventing the error message here is good thing. The underlying 
assumption in all sequence classes is that one residue is represented by 
exactly one character. If you replacing one valid UIPAC character with a 
longish string, e.g.  '[a/g]' you break all the methods that work on 
sequences. See: Bio::Tools::IUPAC

Better alternatives are to

1) If you are sure you are not using ambiguous characters anywhere else in 
your sequence you could have sequence class that treats any ambiguity codes 
as polymorphisms and a SeqIO class that does the output formatting:  r => 
a/g.

2. Use sequence features like they do in EMBL/GenBank/DDJB feature tables to 
annotate mutations in the reference sequence.

3. Use Bio::Variation::SeqDiff to hold your reference sequence and annotate 
polymorphisms as Bio::Variation::DNAMutation objects that can in turn hold 
moltiple Bio::Variation::Allele objects.

I am sure there are other solutions, too. It all depends what you need to do 
with the information.

	-Heikki


On Tuesday 16 January 2007 12:20, 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/

-- 
______ _/      _/_____________________________________________________
      _/      _/
     _/  _/  _/  Heikki Lehvaslaiho    heikki at_sanbi _ac _za
    _/_/_/_/_/  Associate Professor    skype: heikki_lehvaslaiho
   _/  _/  _/  SANBI, South African National Bioinformatics Institute
  _/  _/  _/  University of Western Cape, South Africa
     _/      Phone: +27 21 959 2096   FAX: +27 21 959 2512
___ _/_/_/_/_/________________________________________________________




More information about the Bioperl-l mailing list