[Bioperl-guts-l] [16737] bioperl-live/trunk/Bio/AlignIO.pm: add an alphabet init arg and get /setter

Jason Stajich jason at dev.open-bio.org
Fri Jan 22 14:14:13 EST 2010


Revision: 16737
Author:   jason
Date:     2010-01-22 14:14:12 -0500 (Fri, 22 Jan 2010)
Log Message:
-----------
add an alphabet init arg and get/setter

Modified Paths:
--------------
    bioperl-live/trunk/Bio/AlignIO.pm

Modified: bioperl-live/trunk/Bio/AlignIO.pm
===================================================================
--- bioperl-live/trunk/Bio/AlignIO.pm	2010-01-22 00:26:51 UTC (rev 16736)
+++ bioperl-live/trunk/Bio/AlignIO.pm	2010-01-22 19:14:12 UTC (rev 16737)
@@ -380,9 +380,10 @@
 
 sub _initialize {
   my($self, at args) = @_;
-  my ($flat) = $self->_rearrange([qw(DISPLAYNAME_FLAT)],
+  my ($flat,$alphabet) = $self->_rearrange([qw(DISPLAYNAME_FLAT ALPHABET)],
 				 @args);
   $self->force_displayname_flat($flat) if defined $flat;
+  $self->alphabet($alphabet);
   $self->_initialize_io(@args);
   1;
 }
@@ -522,4 +523,27 @@
     return $self->{'_force_displayname_flat'} || 0;
 }
 
+=head2 alphabet
+
+ Title   : alphabet
+ Usage   : $obj->alphabet($newval)
+ Function: Get/Set alphabet for purpose of passing to Bio::LocatableSeq creation
+ Example : $obj->alphabet('dna');
+ Returns : value of alphabet (a scalar)
+ Args    : on set, new value (a scalar or undef, optional)
+
+
+=cut
+
+sub alphabet {
+    my $self = shift;
+    my $value = shift;
+    if ( defined $value ) {
+        $self->throw("Invalid alphabet $value") unless $value eq 'rna' || $value eq 'protein' || $value eq 'dna';
+        $self->{'_alphabet'} = $value;
+    }
+    return $self->{'_alphabet'};
+}
+
+
 1;



More information about the Bioperl-guts-l mailing list