Closed AGrusz closed 8 years ago
Hi Amanda,
You can prefix a call to the SelectionLRT
wrapper by setting an appropriate environment variable as in the code snipper below
ALWAYS_RELOAD_FUNCTION_LIBRARIES = 1;
/* set this to use LoadFunctionLibrary which automatically searches
knowns paths and avoid explicit specification through "ExecuteAFile" */
for (file_id = 0; file_id < file_count; file_id += 1) {
GLOBAL_FPRINTF_REDIRECT = "/path/to/output/for/this/file";
LoadFunctionLibrary ("SelectionLRT", options);
}
GLOBAL_FPRINTF_REDIRECT = ""; // back the stdout
Sergei
Hi Sergei,
LoadFunctionLibrary ("GrabBag");
fileToExe = "/Users/Grusz/bin/hyphy-2.2.3/res/TemplateBatchFiles/SelectionLRT.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["03"]="012345"; inputRedirect["04"]="/Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/species.stree"; inputRedirect["05"]="Node7";
for ( _fileLine = 0; _fileLine < Columns ( _inDirectoryPaths ); _fileLine = _fileLine + 1 ) {
inputRedirect [ "02" ] = _inDirectoryPaths[ _fileLine ]; pathInfo = splitFilePath (_inDirectoryPaths[ _fileLine ]); outputFile = pathInfo["DIRECTORY"] + DIRECTORY_SEPARATOR + pathInfo["FILENAME"] + ".hyphy.out"; GLOBAL_FPRINTF_REDIRECT = outputFile;
ExecuteAFile ( fileToExe, inputRedirect );
}
GLOBAL_FPRINTF_REDIRECT = ""; // back the stdout
When I ran this inputRedirect.bf file, I received the following error messages:
/HYPHY 2.220150114beta(MP) for Darwin on x86_64\
***** TYPES OF STANDARD ANALYSES *****
(1) Basic Analyses
(2) Codon Selection Analyses
(3) Compartmentalization
(4) Data File Tools
(5) Miscellaneous
(6) Model Comparison
(7) Kernel Analysis Tools
(8) Molecular Clock
(9) Phylogeny Reconstruction
(10) Positive Selection
(11) Recombination
(12) Selection/Recombination
(13) Relative Rate
(14) Relative Ratio
(15) Substitution Rates
Please select type of analyses you want to list (or press ENTER to process custom batch file):
/usr/local/lib/hyphy/Batch file to run::/Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/backtranslated/test/inputRedirect.bf
/Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/backtranslated/test/Provide a list of files to process::test_list.txt [READ 2 file path lines] Error: Could not find source dataset file:PROMPT_FOR_FILE Path stack: {/usr/local/lib/hyphy/,/Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/backtranslated/test/,/Users/Grusz/bin/hyphy-2.2.3/res/TemplateBatchFiles/}
2 : ExecuteAFile from file fileToExe using basepath /Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/backtranslated/test/. reading input from inputRedirect {"01":"Universal", "03":"012345", "04":"/Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/species.stree", "05":"Node7", "02":"/Users/Grusz/Documents/A_Vittariods/Pteridaceae_transcriptomes/Rates_Analyses/backtranslated/test/1/1.nuc.fasta"}
Segmentation fault: 11
Do you have any suggestions?
Thanks!
Amanda
Hi Sergei,
I would like to use InputRedirect to run SelectionLRT.bf on several hundred trees/files. In the command line version of HYPHYMP there is no prompt for an output file; the output is printed to the screen and related messages to message.log. I would like to have the output for each run printed to a file; is this possible?
Thanks in advance, Amanda