--- t/genbank.t.orig 2006-11-16 19:11:14.392186768 +0100 +++ t/genbank.t 2006-11-16 20:07:27.053464320 +0100 @@ -9,7 +9,8 @@ use lib 't'; } use Test; - plan tests => 135; + plan tests => 187; + } use Bio::SeqIO; @@ -455,3 +456,58 @@ # NB: there should probably be full testing on all lines to ensure that output # matches input. + + + + + +foreach my $in ('P35527.gb') { # dont add more entries without also adding db's below + my $infile = Bio::Root::IO->catfile("t","data",$in); + $str = new Bio::SeqIO(-format =>'genbank', + -verbose => $verbose, + -file => $infile); + $seq = $str->next_seq; + $out = new Bio::SeqIO(-file => ">$outfile", -format => 'genbank'); + $out->write_seq($seq); + $out->close(); + open (IN, $infile); + my @in = ; + close(IN); + open (RESULT, $outfile); + my $ac = $seq->annotation(); # Bio::AnnotationCollection + foreach my $key ($ac->get_all_annotation_keys() ) { + my @values = $ac->get_Annotations( $key); + foreach my $value (@values) { + if ($key eq 'dblink') { + my @parts = split(/:/,$value,2); + + # check db: + if ( $parts[0] =~ /^( + # not an exhaustive list of databases; + # just the db's referenced in P35527.gb: + swissprot | GenBank | GenPept | HSSP | IntAct | Ensembl | KEGG | HGNC | MIM | ArrayExpress + | GO | InterPro | Pfam | PRINTS | PROSITE + )$/x ) + { + ok 1; + } + else { + ok 0; + } + + # check value is not empty: + if ( $parts[1] ) { + ok 1; + } + else { + ok 0; + } + # print " ann/", sprintf('%12s: ',$key), '', $value , ' ', "\n"; + } + # elsif ($key eq 'reference') { } + } + } + unlink($outfile); +} + +