[Bioperl-l] New attribut

Jason Stajich jason at cgt.duhs.duke.edu
Tue Apr 13 21:24:11 EDT 2004


Sort of depends on
a) does it have a location or is it valid for the whole sequence
b) do you want it to be serializable (i.e. do you want it to be
   writeable to a standard sequence format (and re-reading back in))

You can store this stuff as a Feature which spans the whole gene
You can store this as an Annotation using Bio::Annotation::Collection

Adding new methods is possible but you will have to derive your own
object extending an existing implementation.



Basically you would write a simple module like this:

package Bio::Seq::MySeq;
use Bio::Seq;
@ISA = qw(Bio::Seq);

sub family { # get/set function
}

sub weight { # get/set function
}

And you can specify a Sequence type to the Sequence Factory when you read
them in from SeqIO.

my $seqio = Bio::SeqIO->new(-format => 'genbank',
  -seqfactory => Bio::Seq::SeqFactory->new( 'type' => 'Bio::Seq::MySeq'),
                            );

Note that adding your own sequence type won't be serializeable in SeqIO
though...


-jason
On Wed, 14 Apr 2004, stephan rosecker wrote:

> Hi,
>
> i'm looking for a way to add new attributs to a seq object.
> For Example a family attribute so that i can call:
> $seq->family('Human');
> print "Family: ".$seq->family()."\n";
> or:
> $seq->weight(foo);
>
> Is that possible ?
>
> cheers,
> stephan
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list