I would like to test for positive selection in a large set of genes.

I want to have a yes/no answer to the question if gene was evolving under positive selection. Therefore I chose model BUSTED for my analysis, which is implemented in HYPHY.

When I launch HYPHY in the command-line, I get a series of question I have to answer in the interactive form.

Is there way to perform a batch analysis involving multiple datasets, i.e. many sequence alignments?

  • 2
    $\begingroup$ What is BUSTED and HYPHY? What have you tried to do that. Does the manual help you? $\endgroup$
    – llrs
    May 17, 2017 at 10:48
  • $\begingroup$ @Llopis HYPHY is a software for positive seleciton analysis, which is popular but complicated to use. BUSTED is a model for gene-wide identification of positive selection. doi.org/10.1093/molbev/msv035 I added some background to the question, so it is more clear. This question is brought up quite regularly by people trying to perform dN/dS analysis. I shared my knowledge here in Q & A form. $\endgroup$ May 17, 2017 at 10:52
  • $\begingroup$ This is not a yet an official Q&A if the site doesn't work it will be closed and deleted. Adding (editing) the context to the question would make the question better for future readers if the site finally lunchs $\endgroup$
    – llrs
    May 17, 2017 at 10:55
  • $\begingroup$ @Llopis I corrected the question. Do you think it is better now? $\endgroup$ May 17, 2017 at 11:09
  • $\begingroup$ It is better but what king of series of questions and answers do you get? Which version of the program are you using ? Under which OS (if that matters)? (I am still not convinced it is on-topic... but let's see) $\endgroup$
    – llrs
    May 17, 2017 at 11:16

1 Answer 1



I made the following bash script to generate an input file for HYPHY.

cat << EOF
inputRedirect = {};
inputRedirect["01"]="Universal"; // genetic code
inputRedirect["02"]="$(readlink -f $1)"; // codon data
inputRedirect["03"]="$(readlink -f $2)"; // tree
inputRedirect["04"]="${3:-All}"; // Test for selection on a branch
inputRedirect["05"]=""; // complete selection

ExecuteAFile (HYPHY_LIB_DIRECTORY+"TemplateBatchFiles/BUSTED.bf", inputRedirect);

If you want to test all the branches jointly run:

./gen_busted.sh alignment.phy tree.nwk > script.bf

Or for a particular branch:

./gen_busted.sh alignment.phy tree.nwk branchLabel > script.bf

And then run:

HYPHYMP script.bf

Now you can use the script to generate a .bf file for every sequence alignment you have, and run HYPHY for every file.

Longer version

I will describe how to make a similar script for any model, such as MEME, RELAX or PARRIS.

First, find the .bf script which performs the analysis. On GNU/Linux it should be at HYPHY_INSTALLATION_PATH/lib/hyphy/TemplateBatchFiles (it might be different between different OS). In case of BUSTED your script has a name BUSTED.bf.

Now run this model in the interactive mode in order to record all the inputs required by the model. Make sure to specify full paths to all the files.


In case of BUSTED the inputs are:

  1. Genetic code.
  2. Codon data (sequence alignment in phylip format).
  3. Tree (in newick format).
  4. Which branches to test.

Now for every input alignment you need to generate a batch file which looks like this:

inputRedirect = {};
inputRedirect["01"]="Universal"; // genetic code
inputRedirect["02"]="/path/to/alignment.phy"; // codon data
inputRedirect["03"]="/path/to/tree.nwk"; // tree
inputRedirect["04"]="All"; // Test for selection on all branches
inputRedirect["05"]="BRANCH1"; // Test for selection on branch1 
inputRedirect["06"]="BRANCH2"; // Test for selection on branch2 
inputRedirect["07"]=""; // complete selection

ExecuteAFile (HYPHY_LIB_DIRECTORY+"TemplateBatchFiles/BUSTED.bf", inputRedirect);

Now you can create a script which generates the file. The most important thing, don't forget to use full paths in the .bf file.

  • $\begingroup$ I am not a moderator, but we should be asking expert questions that would define the on-topicness of the site at this stage of the site. If we start asking about how to do X in each program. We'll end up without expert question. $\endgroup$
    – llrs
    May 17, 2017 at 10:51
  • 2
    $\begingroup$ @Llopis I was sharing similar (but less detailed) information with the three colleagues of mine from my department, some of them where postdocs. This particular question is brought up over and over again, because despite the fact the the software is used a lot (almost 2k citations), the documentation is very preliminary and scattered. $\endgroup$ May 17, 2017 at 10:56
  • $\begingroup$ To document that you could use your private site, or a blog, not necessarily this site. Or you could even contact with the software providers to address that problem if they want people to use their software. $\endgroup$
    – llrs
    May 17, 2017 at 11:17
  • $\begingroup$ It probably is still up for debate, but what is wrong with answering commonly asked question like: 'How to make tool X do task Y'? The bioinformatics field is probably littered with poorly documented tools abandoned by the authors due to lack of funding. For sure Stack Overflow is full of these kind of questions: stackoverflow.com/search?q=how+to $\endgroup$
    – holmrenser
    May 17, 2017 at 13:55
  • $\begingroup$ @holmrenser nothing wrong, but the private beta compels us to write great questions for experts: "The private beta gives you the opportunity to get the site off to a great start with expert questions and answers.". I am saying the answers doesn't seem to me an expert question. But I might be totally wrong :D $\endgroup$
    – llrs
    May 17, 2017 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.