[Bioperl-guts-l] [15438] bioperl-live/trunk/scripts/Bio-DB-GFF/genbank2gff3.PLS: added Don Gilbert' s patch to improve species and Annotation TagTree handling
Scott Cain
scain at dev.open-bio.org
Thu Jan 22 17:16:31 EST 2009
Revision: 15438
Author: scain
Date: 2009-01-22 17:16:30 -0500 (Thu, 22 Jan 2009)
Log Message:
-----------
added Don Gilbert's patch to improve species and Annotation TagTree handling
tested with a Dmel 2L GenBank record
Modified Paths:
--------------
bioperl-live/trunk/scripts/Bio-DB-GFF/genbank2gff3.PLS
Modified: bioperl-live/trunk/scripts/Bio-DB-GFF/genbank2gff3.PLS
===================================================================
--- bioperl-live/trunk/scripts/Bio-DB-GFF/genbank2gff3.PLS 2009-01-22 18:11:35 UTC (rev 15437)
+++ bioperl-live/trunk/scripts/Bio-DB-GFF/genbank2gff3.PLS 2009-01-22 22:16:30 UTC (rev 15438)
@@ -684,9 +684,14 @@
|| $seq->annotation->get_Annotations("update-date")
|| $is_rich ? $seq->get_dates() : ();
my ($comment)= $seq->annotation->get_Annotations("comment");
- my ($species)= $seq->annotation->get_Annotations("species")
- || ( $seq->can('species') ? $seq->species()->binomial() : undef );
-
+ my ($species)= $seq->annotation->get_Annotations("species");
+ if (!$species
+ && $seq->can('species')
+ && defined $seq->species()
+ && $seq->species()->can('binomial') ) {
+ $species= $seq->species()->binomial();
+ }
+
# update source feature with main GB fields
$sf->add_tag_value( ID => $seq_name ) unless $sf->has_tag('ID');
$sf->add_tag_value( Note => $desc ) if($desc && ! $sf->has_tag('Note'));
@@ -699,10 +704,19 @@
foreach my $atag (sort keys %AnnotTagMap) {
my $gtag= $AnnotTagMap{$atag}; next unless($gtag);
my @anno = map{
- ref $_
- ? split( /[,;] */, $_->value)
- : split( /[,;] */, "$_") if($_);
- } $seq->annotation->get_Annotations($atag);
+ if (ref $_ && $_->can('get_all_values')) {
+ split( /[,;] */, join ";", $_->get_all_values)
+ }
+ elsif (ref $_ && $_->can('display_text')) {
+ split( /[,;] */, $_->display_text)
+ }
+ elsif (ref $_ && $_->can('value')) {
+ split( /[,;] */, $_->value)
+ }
+ else {
+ ();
+ }
+ } $seq->annotation->get_Annotations($atag);
foreach(@anno) { $sf->add_tag_value( $gtag => $_ ); }
}
More information about the Bioperl-guts-l
mailing list