[Bioperl-l] pubmed

Hilmar Lapp hlapp at gmx.net
Sat Apr 2 19:50:46 EST 2005


So what is the result of this script that you wouldn't have expected or 
that is not giving you what you need?

BTW annotation objects under the tagname 'reference' are usually 
Bio::Annotation::Reference objects and have methods $ref->authors(), 
$ref->pubmed(), $ref->medline, etc. Check the POD.

	-hilmar

On Friday, April 1, 2005, at 12:04  PM, Qunfeng wrote:

> Hilmar and Paulo,
>
> I apologize for that,
>
> here is a snippet of my code, I must have missed something very 
> simple. Thanks for your help! -- Qunfeng
>
> #!/usr/bin/perl -w
> use strict;
> use Bio::SeqIO;
>
> my $inputGBfile = $ARGV[0];
> my  $seqio_object = Bio::SeqIO->new('-file' => "$inputGBfile",
>                                    '-format' => 'GenBank');
>
> my $seq_object;
> while (1){
>         eval{
>                 $seq_object = $seqio_object->next_seq;
>         };
>         if($@){
>                 print STDERR "EXCEPTION FOUND; SKIP THIS OBJECT\n";
>                 next;
>         }
>         last if(!defined $seq_object);
>         my $gi = $seq_object->primary_id;
>         my $anno_collection = $seq_object->annotation;
>         foreach my $key ( $anno_collection->get_all_annotation_keys ) {
>             my @annotations = $anno_collection->get_Annotations($key);
>             foreach my $value ( @annotations ) {
>                 if($value->tagname eq "reference"){
>                     my $hash_ref = $value->hash_tree;
>                     my $authors = $hash_ref->{'authors'};
>                     my $medline = $hash_ref->{'medline'};
>                     my $pubmed = $hash_ref->{'pubmed'};
>                     print STDERR 
> "gi=$gi\nauthors=$authors\nmedline=$medline\npubmed=$pubmed\n\n";
>                 }
>             }
>         }
> }
>
>
>
> At 03:10 AM 4/1/2005, you wrote:
>> *please* people always post the code or ideally a small snippet that 
>> demonstrates what you were trying to do, and post the result and if 
>> it's not an exception why it is not the result you expected. DO NOT 
>> just say 'blah doesn't work for me'. Whenever someone needs to guess 
>> what you probably did and what you probably mean you are wasting 
>> other people's time.
>>
>> The GI# you have has multiple refs with one having a pubmed ID and 
>> none having a medline ID. So, the one ref that has a pubmed ID should 
>> return it from $ref->pubmed() but without any code snippet it is 
>> impossible to tell what you actually did and what therefore might be 
>> the problem.
>>
>>         -hilmar
>>
>> On Thursday, March 31, 2005, at 03:15  PM, Qunfeng wrote:
>>
>>> Hi there,
>>>
>>> http://bioperl.org/HOWTOs/Feature-Annotation/anno_from_genbank.html
>>>
>>> I am not very familiar with BioPerl. I tried to follow the example 
>>> showing in the above page to retrieve pubmed ID under each Reference 
>>> tag , i.e., $value->pubmed(), but it doesn't work for me for the seq 
>>> gi#56961711. The authors() works for me.  Appreciate any >>> suggestions.
>>>
>>> Qunfeng
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at portal.open-bio.org
>>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>>
>> --
>> -------------------------------------------------------------
>> Hilmar Lapp                            email: lapp at gnf.org
>> GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
>> -------------------------------------------------------------
>>
>
>
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------




More information about the Bioperl-l mailing list