[Bioperl-l] Each_DBLink : only returning 1 entry ?
Ewan Birney
birney@ebi.ac.uk
Thu, 30 Aug 2001 15:04:52 +0100 (BST)
On Thu, 30 Aug 2001, Jean-Jack M. Riethoven wrote:
> Greetings,
>
> I have wet my feet with some BioPerl scripting and have come across
> something which might or might not be a bug:
>
> 1. Using Bio:SeqIO to parse an EMBL flatfile
> 2. I need to output the accession number together with the database (code)
> 2a. Using Bio:Seq I get the sequence object and the accession number.
> 2b. To bind this accession number to the correct database I want to loop
> through Each_DBLink of an annotation object, checking when the acc number
> equals the primary_id of the DBLink.
> 3. This all using branch-7-live (production release)
>
> This does not work however.
It should do ;). Just tested. Bugger. You are right.
Ooooooooh. This code has completely relied on the fact that other things
have a XX in between sections. Wow.
>
> I think (correct me if I am wrong) DBLink will only list cross-references,
> and not the main database from which I get the accession number. Secondly,
> when foreach-ing over ann->Each_DBLink I only get one entry, while my
> flatfile clearly shows 3 entries.
>
> My questions:
>
> 1. Is Each_DBLink bugged that it only returns one link (see example and
> code below)
Buggy. Well spotted/
> 2. How can I get the database code for the main accession number.
>
$seq->accession_number;
>
> Examples:
>
> accnr: X02158 (HSERPG). Snippet from the EMBL flatfile:
> ID HSERPG standard; DNA; HUM; 3398 BP.
> XX
> AC X02158;
> XX
> SV X02158.1
> [snip]
> DR GDB; 119110; EPO.
> DR GDB; 119615; TIMP1.
> DR SWISS-PROT; P01588; EPO_HUMAN.
>
> the following code only yields GDB 119110:
>
> [everything properly initialised with flatfile and EMBL format]
>
> my $annotation = $seq ->annotation;
> my $seq_id = ($seq->accession_number ne "unknown") ?
> $seq->accession_number : $seq->display_id;
> my ($dbcode, $db_link);
> foreach $db_link ($annotation->each_DBLink) {
> $dbcode = $db_link->database if ($db_link->primary_id eq $seq_id);
> print $db_link->database . " " . $db_link->primary_id . " \n";
> }
>
> With kind regards,
>
> --
> drs. Jean-Jack M. Riethoven
>
> EMBL Outstation - Hinxton pow@ebi.ac.uk ICQ#: 3433929
> European Bioinformatics Institute Phone: (+44) 1223 494635
> Wellcome Trust Genome Campus Fax : (+44) 1223 494468
> Hinxton, Cambridge CB10 1SD URL : http://industry.ebi.ac.uk/
> UNITED KINGDOM
>
> Need to find bioinformatics or molecular biology web sites or resources?
> Use BioWurld at http://www.ebi.ac.uk/biowurld
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
-----------------------------------------------------------------
Ewan Birney. Mobile: +44 (0)7970 151230, Work: +44 1223 494420
<birney@ebi.ac.uk>.
-----------------------------------------------------------------