This tutorial shows you how to install Cygwin on your Windows computer so that you have
the Unix-like terminal window that you need to use NCBI's EDirect programs.
I'll also demonstrate the very simple EDirect installation.
Let's get directly to the Cygwin installation on a Windows 7 system.
At cygwin.com you will find the Install Cygwin page, which is where I am now.
Simply click on this link, setup-x86_64.exe, unless you happen to have an older, 32-bit
machine.
What happens after clicking on setup varies depending on the browser you are using, so
follow your screen prompts to run that program or executable.
Some of the decisions you will have to make during installation include,
- Download Source: choose Install from internet - Root Install Directory: \Desktop\Cygwin
is a good choice, and you might want to install for Just me, if you do not have Administrative
privileges - Local Package Directory: \Downloads is often
the default and that is fine - Select Your Internet Connection: Direct
Connection is a good choice - Choose a Download Site: the first one in
the list is fine.
After a brief download, which hasn't installed anything yet, this Select Packages menu appears.
The EDirect programs are a set of Perl scripts, so you need to add the Cygwin Perl package,
even if your Windows machine already has Perl installed.
First, be sure that Category is selected in the View menu, then type perl in the searh
box, and click on the circular arrows next to Perl in the list, and the word Default
will change to Install.
EDirect installation also requires the Zip program, search for unzip, expand Archive
and click next to Skip.
This will change to the version number of the Zip utility that will be installed.
And you may want to install a text editor.
If you are new to command line programs, nano is an easy one to get started with.
I won't demonstrate that, but note that you can come back any time and re-run the setup-x86_64.exe
program to add any additional programs or update the ones you have installed.
No need to uninstall anything.
Okay, after clicking Next, you see this list of changes, so click Next again to begin the
download and installation of Cygwin and the other packages.
This often takes several minutes, after which you may see some Post install script errors,
but in my experience, those can be ignored.
Click Next one last time, and you can now Finish.
If you already know how to install EDirect, you can skip the rest of this video.
If not, let's use our new Cygwin terminal to that.
First open the terminal window, in my case I'll double-click on my desktop icon.
Now I'll go to the EDirect documentation page at NCBI.
Just search for NCBI Edirect in your browser and you'll get to this page in our Books database.
This is a big and immensely helpful document if you want to take full advantage of EDirect's
capabilities.
For now I'll just scroll down to the Installation section and copy this text.
Back to my cygwin terminal, paste that in, hit Enter, and away it goes.
You should quickly get to this setup.sh shell script.
Hit Enter again to run that script, and it will stop on this message about "Trying to
establish local installations of any missing Perl modules..."
It may sit there for a minute or so.
In the rare case that message is still there after 3 or 4 minutes it is probably not going
to finish on it's own, so go ahead and stop the script with the keystroke CTRL-c and move
on.
Lets' check to see if the EDirect programs are working.
One way to do that is to type a program name and ask for the version number.
I'll do that by typing, esearch -version.
And, I get a command not found error.
This happens now and then if the installation did not add the location of the edirect folder
to your path.
It is very convenient to have that so that you can run the edirect programs from whatever
directory you happen to be in.
To correct that, I'll use the the nano text editor to open up the file called, .bash_profile.
Scrolling to the bottom of that file I see a PATH defined for cygwin, but not for edirect
-- you'll have to take my word for that since the full line is not displaying here.
One way to add a new path is to add another line, so I'll paste in, export PATH=$PATH:$HOME/edirect.
All right let's test again, but you will first want to log out of the terminal simply by
typing logout, or exit.
That allows the changes made in .bash_profile to take effect when you start the terminal
again.
So I've logged out and have opened the terminal again, and now I'll type, esearch -version,
and we see not only that I've got version 8.6.0, but this also means that the EDirect
programs are properly installed.
You very likely have a newer version, because EDirect gets updated fairly often -- check
the end of the EDirect documentation to see how to get on an email list that will notify
you of updates and other topics.
Another way to check the installation is to type the program name and dash help.
I'll type efetch -help | more, just so the documentation doesn't scroll all the way to
the bottom.
This is a quick way to see command line options without having to go to the documentation
on the web.
Hitting the space bar moves you through the text.
Okay, all seems well, but what the heck, let's run a real efetch command just to show you
how easy it is to use.
This command retrieves a protein record in FASTA format and sends that to a file called
np.faa, or whatever name you give it.
All I need is the accession number from the NCBI Protein database.
I'll use NP_000302 dot 1 so the command is,
efetch -db protein -id np_000302.1 -format fasta > np.faa
and there is the FASTA record.
And that's it.
You're now ready to run EDirect on your Windows machine.
In the YouTube Description of this video you will find some useful links, and if you have
any questions, write to, info@ncbi.nlm.nih.gov.