Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Automating selection detection (Read 3496 times)
delta
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 10
Automating selection detection
Feb 8th, 2010 at 8:49am
 
Greetings,
I want to automate HyPhy's selection detection, to allow me to do it on a genome scale.  Do you have information on how to set up batch files? I'm confused. I've found examples of batch file code in Getting Started With HyPhy.pdf and hyphybook2007.pdf, and I've borrowed notes from the Nascent course, but it seems there may have been some changes over the years in the best way to do things.  Do you recommend inputRedirect or analysisOptions statements?

Put simply, I've been using QuickSelectionDetection.bf from the GUI and now I want to hard-code all my parameters choices and commands into a batchfile.  Do you have any examples or docs that might help me?
Back to top
 
 
IP Logged
 
wayne
Global Moderator
*****
Offline


I love YaBB 1G - SP1!

Posts: 57
San Diego, CA
Gender: male
Re: Automating selection detection
Reply #1 - Feb 8th, 2010 at 9:48am
 
hi, you can create a wrapper file that sets all the options and then launches the batchfile. For example, here is a sequence alignment wrapper file

Code:
fileToExe = HYPHY_BASE_DIRECTORY + "TemplateBatchFiles" + DIRECTORY_SEPARATOR + "SeqAlignment.bf";

/* a  list of file paths */
SetDialogPrompt ( "Provide a list of files to process:" );
fscanf ( PROMPT_FOR_FILE, "Lines", _inDirectoryPaths );

fprintf (stdout, "[READ ", Columns (_inDirectoryPaths), " file path lines]\n");

/* the options passed to the GUI are encoded here */
_options = {};
_options [ "00" ]	= "BLOSUM62";
_options [ "01" ]	= "No penalty";
_options [ "02" ]	= "Longest in file";
_options [ "03" ]	= "No";
/*option 4: file name */
_options [ "05" ]	= "No";
_options [ "06" ]	= "No";
_options [ "07" ]	= "Universal";
/*option 8: save protein alignent to .aln and codon alignment to .aln.nuc */

for ( _fileLine = 0; _fileLine < Columns ( _inDirectoryPaths ); _fileLine = _fileLine + 1 ) {

	_options [ "04" ]	= _inDirectoryPaths[ _fileLine ] + ".fasta";
	_options [ "08" ]	= _inDirectoryPaths[ _fileLine ] + ".aln";
	ExecuteAFile ( fileToExe, _options );
	Delete(unal); /* delete object */
}

 



This files processes all *.fasta files provided in list. the list file can be generated in *nix with

$ find `pwd` -name "*.fasta" > file.list

For QuickSelectionDetection.bf you would want to change the options to what is appropriate and delete the likelihood function object (lf) after each file executes. If you're using a separate wrapper for each file then its not necessary.

shout if you have more ?

cheers ./w
Back to top
 

Assistant Project Scientist&&Antiviral Research Center&&Department of Pathology&&University of California, San Diego
WWW WWW  
IP Logged
 
delta
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 10
Re: Automating selection detection
Reply #2 - Feb 8th, 2010 at 11:45am
 
Thanks for the response, Wayne.  I'll start by modifying the pipelin_hyphy.bf from the Nascent course.  I can figure out what many of the analysisOptions parameters are, from the order in which the GUI asks me questions.  For example, I know that I want to change
analysisOptions["03"]="Custom";
  to
analysisOptions["03"]="Default";
  in order to choose the HKY85xMG94 model.

But what do I do for analysisOptions 4?

What does
  analysisOptions["06"]="nucfit";
do?

I want FEL, so obviously I should change
  analysisOptions["08"]="Single Ancestor Counting";
to something.  Should it be
  analysisOptions["08"]="FEL";
or what?

And what do the following 3 lines do?
  analysisOptions["09"]="Full tree";
  analysisOptions["10"]="Averaged";
  analysisOptions["11"]="Approximate";
At this point, when running the GUI, I only get one question:
  "Branch Corrections Factor (<0 to estimate):"
How do I set the branch corrections factor?
Does
  analysisOptions["12"]="0.1";
set the significance level for likelihood ratio tests to 0.1?
And what do the last 2 options do?
  analysisOptions["13"]="Chart";
  analysisOptions["14"]="Skip";

Finally, I don't see any place to put in the input file.  Do I need to have a line like
  DataSet nucleotideSequences = ReadDataFile ("../data/sample.nuc");
and, if so, where does it go?

-------------------------------------------------------------------------------
analysisOptions = {};

analysisOptions["00"]="Universal";
analysisOptions["01"]="New Analysis";
analysisOptions["02"]="";
analysisOptions["03"]="Custom";
analysisOptions["04"]="010020";
analysisOptions["05"]="y";  /* asume the input file has a tree*/
analysisOptions["06"]="nucfit";
analysisOptions["07"]="Estimate dN/dS only";
analysisOptions["08"]="Single Ancestor Counting";
analysisOptions["09"]="Full tree";
analysisOptions["10"]="Averaged";
analysisOptions["11"]="Approximate";
analysisOptions["12"]="0.1";
analysisOptions["13"]="Chart";
analysisOptions["14"]="Skip";

ExecuteAFile (HYPHY_BASE_DIRECTORY +
                 "TemplateBatchFiles" +
                 DIRECTORY_SEPARATOR +
                 "QuickSelectionDetection.bf",
                 analysisOptions);
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Automating selection detection
Reply #3 - Feb 8th, 2010 at 9:03pm
 
Hi delta,

As Wayne pointed out, all you really need to do is to run through the analysis (e.g. FEL) by hand ONCE, record all the options and populate the input array as shown in his example. Those analysis options (like file names) that will change from analysis to analysis you can either leave blank ("") - then HyPhy will prompt for them, or define them programmatically. If you take a closer look at Wayne's example (inside the loop), he sets two of the analysis options (["04"] for the path to the input alignment and ["08"] for the path to the output alignment) programmatically based on the contents of a text file where each line stores a path to the file. This enables HyPhy to step through the analysis one file at a time and supply the right options to the subsidiary analysis (FEL in your case).

Best,
Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
delta
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 10
Re: Automating selection detection
Reply #4 - Feb 9th, 2010 at 8:47am
 
Thanks for the comment, Sergei.
I was already doing just what you suggested, but I had some questions about what some of the options do.  Could someone please address those questions (in my previous post)? I know you are busy, but I'd be more comfortable doing these analyses if I was more sure about how to select the parameters Smiley.
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Automating selection detection
Reply #5 - Feb 9th, 2010 at 8:54am
 
Hi delta,

You may find this example, which runs IFEL, but all you need to do is modify option "10" to run FEL.

Sergei

Code:
felSettings = {};
felSettings	["00"] = "Universal";
felSettings ["01"] = "New Analysis";
felSettings ["02"] = "";
felSettings ["03"] = "Custom";
felSettings ["04"] = "012345"; /* REV */
felSettings ["05"] = "y";
felSettings ["06"] = "";
felSettings ["07"] = "Estimate dN/dS only";
felSettings ["08"] = "Two rate FEL";
felSettings ["09"] = "0.05"; /* p-value */
felSettings ["10"] = "Internal Only";
felSettings ["11"] = "";

for (simID = 0; simID < replicateCount; simID = simID+1)
 {
 		fprintf (stdout, "... Processing replicate ", simID+1, "/", replicateCount, "\n");
		outFile = _baseSummaryPath + "_" + simID + "_ifel.dat";
 		felSettings ["02"] = outFile;
 		felSettings ["06"] = felSettings ["02"] + ".fit";
 		felSettings ["11"] = felSettings ["02"] + ".csv";
}
 




Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
delta
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 10
Re: Automating selection detection
Reply #6 - Feb 9th, 2010 at 12:09pm
 
Thanks Sergei,
It runs now.
Back to top
 
 
IP Logged