Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 1.67 KB

EDirect.md

File metadata and controls

61 lines (46 loc) · 1.67 KB

Retrieving Articles from NCBI's PubMed Using EDirect

EDirect is NCBI's command line entrez retrieval tool. It is used to retrieve data from a variety of NCBI databases, including literature mining from PubMed database.

Insiders Guide to Accessing NLM Data: EDirect Overview

Installing EDirect

Run the code

$ cd ~
  /bin/bash
  perl -MNet::FTP -e \
    '$ftp = new Net::FTP("ftp.ncbi.nlm.nih.gov", Passive => 1);
     $ftp->login; $ftp->binary;
     $ftp->get("/entrez/entrezdirect/edirect.tar.gz");'
  gunzip -c edirect.tar.gz | tar xf -
  rm edirect.tar.gz
  builtin exit
  export PATH=${PATH}:$HOME/edirect >& /dev/null || setenv PATH "${PATH}:$HOME/edirect"
  ./edirect/setup.sh

Hit Enter when you find your cursor blinking on the command

$ ./edirect/setup.sh

Completing Installation

Run the command

$ echo "export PATH=\$PATH:\$HOME/edirect" >> $HOME/.bash_profile

Check and Confirm Installation

$ esearch -version

This should display the most recent version of the tool.

Example PubMed Search

$ esearch -db pubmed -query "Open AND Science[Title]" -datetype PDAT -mindate 2010 -maxdate 2018 | \
  efetch -format xml | \
  xtract -pattern PubmedArticle -element MedlineCitation/PMID > pmids.txt

This retrieves the PubMed ID of articles titled "Open Science" from PubMed published between 2010 and 2018 into a 'pmids.txt' file.

More on EDirect commands can be found on

Entrez Direct: E-utilities on the UNIX Command Line

Github: NCBI-Hackathons/EDirectCookbook