[Bioperl-l] Allowing a list of ids for -id of Bio::DB::EUtilities->new()?

Fields, Christopher J cjfields at illinois.edu
Wed Jun 17 12:49:22 UTC 2015


It does allow multiples, note Russell’s example (note it has to be passed as a reference).  

my @ids     = qw(200039684 200039685);
my $factory = Bio::DB::EUtilities->new(-eutil  => 'elink',
                                      -email  => 'mymail at foo.bar',
                                      -db     => 'pubmed',
                                      -dbfrom => 'gds',
                                      -id     => \@ids);

The ‘single ID’ form is a convenience; the fact it works when you concatenate the IDs and pass them in as one string is happenstance, only b/c it’s doing that for you behind the scenes when you pass the IDs as a ref.

chris

> On Jun 16, 2015, at 8:36 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
> 
> Hi,
> 
> To allow multiple ids, I have to manually concatenate ids in the form
> of a string '19008417,19008416'. Would it be better to allow it take
> the form of a list ('19008417', '19008416').
> 
> 
> #!/usr/bin/env perl
> 
> use strict;
> use warnings;
> use Bio::DB::EUtilities;
> use XML::Simple;
> use Data::Dumper;
> 
> my $factory = Bio::DB::EUtilities->new(
>  -eutil => 'efetch',
>  -db => 'pubmed',
>  -email => 'mymail at foo.bar',
>  -id => '19008417,19008416',
>  -retmode => 'xml',
> );
> 
> #print $factory->get_Response->content;
> 
> my $string=$factory->get_Response->content;
> print $string, "\n";
> my $xml=new XML::Simple;
> my $data = $xml->XMLin($string);
> print Dumper($data);
> 
> 
> -- 
> Regards,
> Peng
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list