Access Abstract From Pubmed Using Bio::Db::Eutilities
2
0
Entering edit mode
8.8 years ago
Matthias ▴ 50

I am using Bio::DB::EUtilities to query the Pubmed DB with given PMIDs (Pubmed Id).

use Bio::DB::EUtilities;

use strict;
use warnings;

my @ids = (23298400);
my $factory = Bio::DB::EUtilities->new(-eutil => 'efetch',
                                    -email => 'mymail@foo.bar',
                                    -db => 'pubmed',
                                    -retmode => 'xml',
                                    -id => \@ids);

$factory -> get_Response(-file => 'pubmed_response.xml');

Is there a way to directly access the objects (e.g. abstract) instead of writing the response to file and using XML::Twig or so?

perl bioperl xml pubmed eutils • 3.3k views
ADD COMMENT
1
Entering edit mode
8.8 years ago
SES 8.5k

You can just store the content of the response instead of writing it to a file. That would be:

my $xml = $factory->get_Response->content;

Now, $xml can be parsed to get whatever information you want. For example, you could look for the 'Abstract' node in the XML:

This prints the abstract, though you could store it or do something else with it. You could also try getting different return types, as Sudeep mentioned.

EDIT: For reference, I also answered this question on Stack Overflow with more detail.

ADD COMMENT
0
Entering edit mode
8.8 years ago
Sudeep ★ 1.7k

This table tells that if you use rettype=abstract & retrymode=text you should probably get abstract as text. I've checked it using efetch but not using bioperl, see it here: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=11748933,11700088&rettype=abstract&retmode=text

ADD COMMENT

Login before adding your answer.

Traffic: 862 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6