Question: Bwa On Mac : How To Run It On Terminal
gravatar for freddy
6.7 years ago by
freddy40 wrote:

Can any one help me please I want use BWA aligner, when I downloaded I cd into the file and made it and it create bwa program. Previously somebody made me bin folder in my home directory and placed the bwa program their, and they also did something with usr/local/bin. After they did this I was able to use BWA aligner from my MAC terminal anywhere. I recently had to erase my hard drive and need to reinstall BWA, and don't know how to make it where I can run BWA from my MAC terminal.

bwa • 9.6k views
ADD COMMENTlink modified 5.8 years ago by Biostar ♦♦ 20 • written 6.7 years ago by freddy40
gravatar for DG
6.7 years ago by
DG7.1k wrote:

You can run a unix program from anywhere on the terminal if you specify the location. So for instance if, in your home directory, you make a bin directory and place it there. You can just specify the full path: ie. /Users/<your username="">/bin/bwa

Alternatively you can make the directory /usr/local/bin/ and place it there. Then be sure to add that directory to your path. You can also add other directories, like a bin directory in your home directory, to your path. You can specify your path in several different files. Mine is in a file, in my home directory, called .bash_profile and has a line like this:

export PATH="/usr/local/bin:/Users/dan/bin:$PATH"

ADD COMMENTlink written 6.7 years ago by DG7.1k

But how do I specify the full path: ie. /Users//bin/bwa I talked to some and they told me I need to create a .bash profile I really don't understand

ADD REPLYlink written 6.6 years ago by freddy40

My post above has the line to put in your bash profile (the file is called .bash_profile) for altering your path variable to include the /usr/local/bin directory and, in my case, the /Users/dan/bin directory.

When I said specify the full path what I meant was that on the command line instead of just typing bwa you would type something like /Users/dan/bin/bwa or /usr/local/bin/bwa

What you may want is to read a brief primer on the unix command line. OS X is a UNIX system.

ADD REPLYlink written 6.6 years ago by DG7.1k
gravatar for Ashutosh Pandey
6.7 years ago by
Ashutosh Pandey12k wrote:

I searched online and got some results that may be helpful.

Basically you should have gcc and xcode from Apple installed on your mac.

ADD COMMENTlink written 6.7 years ago by Ashutosh Pandey12k
gravatar for KCC
6.6 years ago by
Cambridge, MA
KCC4.0k wrote:

First you need to make hidden files visible. Type this in the command line:

defaults write AppleShowAllFiles -bool true
killall Finder

You need to get the to paths.d folder. On my system, it's possible to just type "cd /private/etc/paths.d"

However, you should be able to open Finder, navigate to the top most directory for your MAC hard drive. Find the etc folder, then the paths.d folder.

Inside this folder create any file you want, I created a file called "Bio" for all my bioinformatics software.

Here you can put the location of the binary files that you want to run universally. So you can write something like "/Users/yourusername/Desktop/bwa/"

(Change "yourusername" to your actual username.)

Assuming bwa is in a folder on your Desktop for example.

To make the system files hidden again type:

defaults write AppleShowAllFiles -bool false
killall Finder

You might need to restart terminal, but you should to be able to use bwa from the commandline

ADD COMMENTlink written 6.6 years ago by KCC4.0k

Wouldn't it be easier to just edit ~/.bashrc (a la Dan Gaston's reply)? That's works on OS X and Linux.

ADD REPLYlink written 6.6 years ago by Devon Ryan96k

Yup, I agree. Because then you know how UNIX does things, so if you ever have to do something similar on a linux system you'll at least have a decent idea of what you should do.

ADD REPLYlink written 6.6 years ago by DG7.1k

I was thinking this way was more modular as all your bioinformatics programs are in one file and you can move it easily to a new installation (if you keep all your executables in a generic location without your username in the path). You can copy the folder to a new mac, move the file in path.d to the new computer and then you are ready to go.

ADD REPLYlink written 6.6 years ago by KCC4.0k

Putting them in /usr/local/bin and editing .bash_profile accomplishes the same thing. I also think it is just plain worthwhile to have some knowledge of how a UNIX command line works in general, including the PATH and other environment variables, for anyone planning on doing any sort of bioinformatics work. You can also add any number of directories to the PATH this way and control their precedence or searching.

ADD REPLYlink written 6.6 years ago by DG7.1k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1043 users visited in the last hour