Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Batch files (Read 2647 times)
jhughes
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 5
Batch files
Aug 8th, 2011 at 9:05am
 
Hi,

I'm new to HYPHY. I am trying to create batch files for processing 100s of files. So far I have managed to do a batch for testing the best model using AIC. Now I want to use SLAC to calculate dN/dS and whether there are any sites under selection using the best model selected using modeltest. The QuickSelectionDetection.bf requests a ModelString. What is the best way to get and use the output from the MotelTest batch file and in particular the ModelString to use in the QuickSelectionDetection batch files.

Cheers,
Joseph
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: Batch files
Reply #1 - Aug 9th, 2011 at 4:17pm
 
Hi Joseph,

You probably want to use a wrapper file. Take a look at Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login

For ModelTest, if you run the hierarchical version of the test, the best model string will be in

Code:
modelStrings[chosenMatrix]
 

,

otherwise it will be in
Code:
modelStrings[aicMatrix]
 



In your wrapper file do something like

Code:
...

for (...)
{
     ...

     ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles" + DIRECTORY_SEPARATOR + "ModelTest.bf", modelTestOptions);

     slacOptions = {};
     ...

     slacOptions [".."] = modelStrings[aicMatrix];

     ...

 ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles" + DIRECTORY_SEPARATOR + "QuickSelectionDetectiob.bf", slacOptions);

}
 



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
 
jhughes
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 5
Re: Batch files
Reply #2 - Aug 10th, 2011 at 12:49am
 
In the end I succeeded by doing this, where every other line of the list of files provided is the ModelString from model test.

Code:
/* This is a HY-PHY Batch File for producing the SLAC analyses.

  
*/

fileToExe = HYPHY_BASE_DIRECTORY + "TemplateBatchFiles" + DIRECTORY_SEPARATOR + "QuickSelectionDetection.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 */
inputRedirect = {};
inputRedirect["01"]="Universal";
inputRedirect["02"]="New Analysis";
inputRedirect["04"]="Custom";
inputRedirect["08"]="Estimate + CI";
inputRedirect["09"]="Single Ancestor Counting";
inputRedirect["10"]="Full tree";
inputRedirect["11"]="Averaged";
inputRedirect["12"]="Approximate";
inputRedirect["13"]="0.05";
inputRedirect["14"]="Export to File";
inputRedirect["16"]="Skip";

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

	inputRedirect [ "03" ]	= "/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/UniqsNoStop/"+_inDirectoryPaths[ _fileLine ]+".fasta";
	inputRedirect [ "05" ]	= _inDirectoryPaths[ _fileLine + 1];
	inputRedirect [ "06" ]	= "/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/trees/"+_inDirectoryPaths[ _fileLine ]+".tre";
	inputRedirect [ "07" ]	= "/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/SLAC/"+_inDirectoryPaths[ _fileLine ]+".bf";
	inputRedirect [ "15" ]	= "/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/SLAC/"+_inDirectoryPaths[ _fileLine ]+".out";
	ExecuteAFile ( fileToExe, inputRedirect );
} 



I will try your more elegant approach.

Cheers,
Joseph
Back to top
 
 
IP Logged
 
jhughes
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 5
Re: Batch files
Reply #3 - Aug 10th, 2011 at 3:31am
 
And just in case someone finds this useful, here is the more elegant way that Sergei suggested: Code:
/* 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");


for ( _fileLine = 0; _fileLine < Columns ( _inDirectoryPaths ); _fileLine = _fileLine + 1 ) {
inputRedirect = {};
inputRedirect["01"]="Universal";
inputRedirect["02"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/UniqsNoStop/"+_inDirectoryPaths[ _fileLine ]+".fasta";
inputRedirect["03"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/trees/"+_inDirectoryPaths[ _fileLine ]+".tre";
inputRedirect["04"]="4";
inputRedirect["05"]="AIC Test";
inputRedirect["06"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/modeltest/"+_inDirectoryPaths[ _fileLine ]+".out";
ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles"+ DIRECTORY_SEPARATOR+"ModelTest.bf", inputRedirect);

inputRedirect = {};
inputRedirect["01"]="Universal";
inputRedirect["02"]="New Analysis";
inputRedirect["03"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/UniqsNoStop/"+_inDirectoryPaths[ _fileLine ]+".fasta";
inputRedirect["04"]="Custom";
inputRedirect["05"]=modelStrings[aicMatrix];
inputRedirect["06"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/trees/"+_inDirectoryPaths[ _fileLine ]+".tre";
inputRedirect["07"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/SLAC/"+_inDirectoryPaths[ _fileLine ]+".bf";
inputRedirect["08"]="Estimate + CI";
inputRedirect["09"]="Single Ancestor Counting";
inputRedirect["10"]="Full tree";
inputRedirect["11"]="Averaged";
inputRedirect["12"]="Approximate";
inputRedirect["13"]="0.05";
inputRedirect["14"]="Export to File";
inputRedirect["15"]="/Users/jhughes/Documents/PabloProjects/HYPHYanalyses/SLAC/"+_inDirectoryPaths[ _fileLine ]+".out";
inputRedirect["16"]="Skip";

ExecuteAFile (HYPHY_BASE_DIRECTORY + "TemplateBatchFiles"+
DIRECTORY_SEPARATOR+"QuickSelectionDetection.bf", inputRedirect);

} 

Joseph Smiley
Back to top
 
 
IP Logged