[Bioperl-guts-l] [Bug 2796] AlignIO::stockholm sequence parsing

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Mar 23 13:09:17 EDT 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2796


cjfields at bioperl.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #5 from cjfields at bioperl.org  2009-03-23 13:09 EST -------
Actually I built this a bit more flexible than I first realized.  Adding custom
annotation is possible, so I'll close this out.  Some examples have been added
to the Bio::AlignIO::stockholm module but I'll outline them below.

There are two ways to do this, but I am reserving the right to change the
second method to something not involving globals (which are evil evil evil). 
This is using the latest bioperl-live code and should show up in 1.6.1.

1)  The tag name you assign the SimpleValue doesn't have to be the same as the
tag the value is stored as.  So you can do this:

    my $factory = Bio::Annotation::AnnotationFactory->new(-type =>
'Bio::Annotation::SimpleValue');
    my $rfann = $factory->create_object(-value => $str, -tagname => 'mytag');
    $coll->add_Annotation('custom', $rfann);
    $rfann = $factory->create_object(-value => 'foo', -tagname => 'bar');
    $coll->add_Annotation('custom', $rfann);

And get this:

# STOCKHOLM 1.0

#=GF ID 1imvA01
#=GF mytag katnayygqelggvnhdyddlakfyfgaglealdffnnkeaaakiinwvaEDTTRGKIQDLV??
#=GF mytag TPtd~????LDPETQALLV???????????????????????NAIYFKGRWE?????????~??
#=GF mytag ??HEF?A?EMDTKPY??DFQH?TNen?????GRI??????V???KVAM??MF?????????N??
#=GF mytag ???DD?VFGYAEL????DE???????L??D??????A??TALELAY??????????????????
#=GF mytag ?????????????KG??????Sa???TSMLILLP???????????????D??????????????
#=GF mytag ???????????EGTr?????AGLGKLLQ??QL????????SREef??DLNK??L???AH????R
#=GF mytag ????????????L????????????????????????????????????????R?????????R
#=GF mytag ??QQ???????V???????AVRLPKFSFefefdlkeplknlgmhqafdpnsdvfklmdqavlvi
#=GF mytag gdlqhayafkvd????????????????????????????????????????????????????
#=GF mytag ????????????????????????????????????????????????????????????????
#=GF mytag ????????????????????????????????????????????????????????????????
#=GF mytag ????????????????????????????????????????????????????????????????
#=GF mytag ?????????????INVDEAG?TEAAAATAAKFVPLSLppkt??????????????????PIEFV
#=GF mytag ADRPFAFAIR??????E?PAT?G????SILFIGHVEDPTP?msv?
#=GF bar foo
....

Note that the tag assigned to the SimpleValue object is used, not 'XX' or
'custom'.  This should work for all AnnotationI (anything that has tagname()
and display_text() defined).

2)  The second is a bit more cumbersome and will very likely change as it
involves modifying globals, something which I don't like.  If you add a new tag
to the package globals @WRITEORDER and %WRITEMAP, you can add in your own data.
 The writer will use the value of display_text() 

    # really custom stuff
    # add to WRITEORDER
    my @order = @Bio::AlignIO::stockholm::WRITEORDER;
    push @order, 'my_stuff';
    @Bio::AlignIO::stockholm::WRITEORDER = @order;
    # make sure new tag maps to something (you'll get a warning here which is
harmless)
    $Bio::AlignIO::stockholm::WRITEMAP{my_stuff} = 'Hobbit/SimpleValue';

    my $rfann = $factory->create_object(-value => 'Frodo', -tagname =>
'Hobbit');
    $coll->add_Annotation('my_stuff', $rfann);
    $rfann = $factory->create_object(-value => 'Bilbo', -tagname => 'Hobbit');
    $coll->add_Annotation('my_stuff', $rfann);

Gets:

# STOCKHOLM 1.0

#=GF ID 1imvA01
#=GF Hobbit Frodo
#=GF Hobbit Bilbo
...


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Bioperl-guts-l mailing list