[Bioperl-l] pubmed

Jason Stajich jason.stajich at duke.edu
Wed Apr 6 13:40:27 EDT 2005


I'm pretty sure this was a bug that was fixed in more-recent versions  
of bioperl.
I know there were some genbank parser bugfixes in there.
I would be curious if it persists if you use bioperl 1.5.0 -- brian  
reports it working fine with bioperl-live so your solution is to  
upgrade at least the SeqIO/genbank.pm file.

-jason
--
Jason Stajich
jason.stajich at duke.edu
http://www.duke.edu/~jes12/

On Apr 6, 2005, at 12:40 PM, Qunfeng wrote:

> Well, it doesn't work here. I have given up on $value->pubmed and  
> decided to simply parsed out the pubmed id from $value->location
>
> Thanks again for all your help!
>
> Qunfeng
>
> At 06:32 AM 4/6/2005, Brian Osborne wrote:
>> Qunfeng,
>>
>> Your code works with the attached file, give it a try (I'm using
>> bioperl-live, by the way).
>>
>> Brian O.
>>
>> -----Original Message-----
>> From: bioperl-l-bounces at portal.open-bio.org
>> [mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Qunfeng
>> Sent: Tuesday, April 05, 2005 11:33 AM
>> To: Brian Osborne; Bioperl
>> Subject: RE: [Bioperl-l] pubmed
>>
>>
>> Brian,
>>
>> Thanks for your kind help.  The following is my complete code. It  
>> reads a
>> GenBank file as input and prints out authors, medline but not pubmed.  
>>    I
>> also tried your code and it doesn't work for me either.
>>
>> I tried your code with two of my machines
>>
>> machine 1). installed bioperl-1.2.2
>> $ uname -a
>> Linux  2.4.20-8bigmem #1 SMP Thu Mar 13 17:32:29 EST 2003 i686 i686  
>> i386
>> GNU/Linux
>>
>> machine 2). installed bioperl-1.4
>> $ uname -a
>> Linux  2.4.21-27.0.2.ELsmp #1 SMP Wed Jan 12 23:35:44 EST 2005 i686  
>> i686
>> i386 GNU/Linux
>>
>> ---------------------------------------------------------------------- 
>> ------
>> ----------------------------------------
>> #!/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 $authors = $value->authors();
>>                        my $medline = $value->medline();
>>                        my $pubmed = $value->pubmed();
>>                       print
>> "gi=$gi\nauthors=$authors\nmedline=$medline\npubmed=$pubmed\n\n";
>>                  }#end if
>>              }#end inner for
>>          }#end outer for
>> }#end while
>> ---------------------------------------------------------------------- 
>> ------
>> ---------------------------------------------------------
>>
>> At 05:18 PM 4/4/2005, Brian Osborne wrote:
>> >Qunfeng,
>> >
>> >SeqIO parses this entry correctly, using this code:
>> >
>> >use strict;
>> >use Bio::DB::GenBank;
>> >
>> >my $db = new Bio::DB::GenBank;
>> >my $seq = $db->get_Seq_by_id(56961711);
>> >my $ac = $seq->annotation;
>> >for my $ref ($ac->get_Annotations('reference')) {
>> >         print $ref->pubmed;
>> >}
>> >
>> >It looks like your code should work as well but since you didn't  
>> show us
>> >your complete code using the variable $value it's hard to see where  
>> the
>> >problem is.
>> >
>> >
>> >Brian O.
>> >
>> >-----Original Message-----
>> >From: bioperl-l-bounces at portal.open-bio.org
>> >[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Qunfeng
>> >Sent: Monday, April 04, 2005 5:47 PM
>> >To: Bioperl
>> >Subject: RE: [Bioperl-l] pubmed
>> >
>> >
>> >Brain,
>> >
>> >My problem is that none of them returned a Pubmed id.
>> >
>> >Qunfeng
>> >
>> >At 03:07 PM 4/4/2005, Brian Osborne wrote:
>> > >Qunfeng,
>> > >
>> > >Only 1 of the 5 references in the 56961711 entry has a Pubmed id,  
>> the
>> rest
>> > >will return nothing when you try $value->pubmed.
>> > >
>> > >Brian O.
>> > >
>> > >-----Original Message-----
>> > >From: bioperl-l-bounces at portal.open-bio.org
>> > >[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Qunfeng
>> > >Sent: Monday, April 04, 2005 2:58 PM
>> > >To: Bioperl
>> > >Subject: Re: [Bioperl-l] pubmed
>> > >
>> > >
>> > >so, I tried to use
>> > >                      my $authors = $hash_ref->{'authors'};
>> > >                      my $medline = $hash_ref->{'medline'};
>> > >                      my $pubmed = $hash_ref->{'pubmed'};
>> > >
>> > >to parse out authors, medline, pubmed.
>> > >
>> > >I was able to successfully parse out authors and medline but not  
>> pubmed.
>> > >
>> > >Then I tried to use
>> > >
>> > >                      my $authors = $value->authors();
>> > >                      my $medline = $value->medline();
>> > >                      my $pubmed = $value->pubmed();
>> > >
>> > >and I got the same thing.
>> > >
>> > >Qunfeng
>> > >
>> > >At 07:50 PM 4/2/2005, Hilmar Lapp wrote:
>> > > >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
>> > > >-------------------------------------------------------------
>> > > >
>> > > >
>> > > >_______________________________________________
>> > > >Bioperl-l mailing list
>> > > >Bioperl-l at portal.open-bio.org
>> > > >http://portal.open-bio.org/mailman/listinfo/bioperl-l
>> > >
>> > >_______________________________________________
>> > >Bioperl-l mailing list
>> > >Bioperl-l at portal.open-bio.org
>> > >http://portal.open-bio.org/mailman/listinfo/bioperl-l
>> > >
>> > >
>> > >
>> > >_______________________________________________
>> > >Bioperl-l mailing list
>> > >Bioperl-l at portal.open-bio.org
>> > >http://portal.open-bio.org/mailman/listinfo/bioperl-l
>> >
>> >_______________________________________________
>> >Bioperl-l mailing list
>> >Bioperl-l at portal.open-bio.org
>> >http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at portal.open-bio.org
>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>



More information about the Bioperl-l mailing list