EFetch with a Perl script
Condition
- We give a set of identifier to execute EFetch program of eUtils in NCBI nucleotide database with fasta (in text mode) format.
- Perl coding
#!/usr/bin/perl
use strict;
use LWP::Simple; # for internet accession usage and as web client usage
# the construction of query URLs
# rettype=ft means that the return type is fasta
# retmode=text means that the return mode is text
# multiple search id could use ',' to seperate each of them
my $ac = 'CY073775.1, CY022055.1, U47817.1';
my $efetch = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?";
$efetch .= "db=nucleotide&id=$ac&rettype=ft&retmode=text";
my $efetch_res = get($efetch);
print "$efetch_res";