Bwa On Mac : How To Run It On Terminal
3
0
Entering edit mode
11.0 years ago
freddy ▴ 40

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 • 15k views
ADD COMMENT
1
Entering edit mode
11.0 years ago
DG 7.3k

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 COMMENT
0
Entering edit mode

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 REPLY
2
Entering edit mode

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 REPLY
0
Entering edit mode
11.0 years ago

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

http://bioinformatics.anu.edu.au/groups/workgroup/revisions/e0693/4/

http://seqanswers.com/forums/showthread.php?t=16009

http://seqanswers.com/forums/showthread.php?t=4589

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

ADD COMMENT
0
Entering edit mode
11.0 years ago
KCC ★ 4.1k

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

defaults write com.apple.finder 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 com.apple.finder AppleShowAllFiles -bool false
killall Finder

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

ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 989 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6