BioJavaPhobic 0 Newbie Poster

This is very much a bioinformatics problem, so any bioinformaticians familiar with the eUtilities of the NCBI, your help would be much appreciated. I have the following code to get links from a Pubmed search:

use Bio::DB::EUtilities;
 
my $factory = Bio::DB::EUtilities->new(-eutil  => 'elink',
                                       -email  => 'mymail@foo.bar',
                                       -dbfrom => 'pubmed',
                                       -cmd    => 'llinks',
                                       -id     => [qw(
                                                      21330134)]);
 
while (my $ls = $factory->next_LinkSet) {
    my ($id) = $ls->get_ids; # these are evaluated per id by default
    print "ID:$id\n";
    while (my $linkout = $ls->next_UrlLink) {
        print "\tProvider: ",$linkout->get_provider_name,"\n";
        print "\tLink    : ",$linkout->get_url,"\n";
    }
}

I want to query Pubmed Central so that I can get links to full text. If I change the dbfrom to pmc (for pubmed central database) and change the id to a pubmed central ID, nothing happens when I execute the script:

use Bio::DB::EUtilities;
 
my $factory = Bio::DB::EUtilities->new(-eutil  => 'elink',
                                       -email  => 'mymail@foo.bar',
                                       -dbfrom => 'pmc',
                                       -cmd    => 'llinks',
                                       -id     => [qw(
                                                      PMC1868803)]);
 
while (my $ls = $factory->next_LinkSet) {
    my ($id) = $ls->get_ids; # these are evaluated per id by default
    print "ID:$id\n";
    while (my $linkout = $ls->next_UrlLink) {
        print "\tProvider: ",$linkout->get_provider_name,"\n";
        print "\tLink    : ",$linkout->get_url,"\n";
    }
}

I'm not sure what's wrong. Any info on being able to open links and download the files would also be greatly appreciated. Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.