HyPhy message board
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl
HYPHY Package >> HyPhy feedback >> How to use HyPhy without interactive shell?
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl?num=1383676300

Message started by CodieR on Nov 5th, 2013 at 10:31am

Title: How to use HyPhy without interactive shell?
Post by CodieR on Nov 5th, 2013 at 10:31am
Hello!

I would like to use HyPhy on a HPC, that has no interactive shell.

How do I use the HyPhy-Batch-Language to accomplish this?

I read on the wiki something about this inputRedirect-Array, but I can't get it to work.


Code (]
inputRedirect = {};
inputRedirect["01"):

= "10"; // (10) Positive Selection
inputRedirect["02"] = "1"; //  (1) Use the random effects branch-site model (2010) to find lineages subject to episodic selection.
inputRedirect["03"] = "1"; //  (1):[Universal] Universal code. (Genebank transl_table=1).
inputRedirect["04"] = "1"; //  (1):[Yes] Both alpha and beta vary along branch-site combinations
inputRedirect["05"] = HYPHY_BASE_DIRECTORY + "inputfile1";
inputRedirect["06"] = HYPHY_BASE_DIRECTORY + "treefile1";
inputRedirect["07"] = HYPHY_BASE_DIRECTORY + "testoutput1";

ExecuteAFile(HYPHY_BASE_DIRECTORY + "test.bf", inputRedirect);


My goal is to execute "./HYPHYMP ./mybatchfile.bf" and it should run without interaction. :)

Is this possible?

Best Regards,
CodieR

Title: Re: How to use HyPhy without interactive shell?
Post by Sergei on Nov 5th, 2013 at 10:38am
Hi CodieR,

You are on the right track with the input redirect array; what exactly isn't working?

Sergei

Title: Re: How to use HyPhy without interactive shell?
Post by CodieR on Nov 6th, 2013 at 3:26am
Hi,

if I use the code from above (without the ExecuteAFile-line) and place it in a file called "run.bf" and then execute

./HYPHYMP ./run.bf

nothing happens.

I can't find out, how to tell HyPhy to use the inputredirect-Array.

I tried to use the ExecuteAFile-Command, but I don't know what commands should be placed in the file "test.bf".

Which command tells HyPhy to use the data from the inputRedirect-Array?

Thanks,
CodieR

Title: Re: How to use HyPhy without interactive shell?
Post by Sergei on Nov 6th, 2013 at 4:06pm
Hi CodieR,

You must use the ExecuteAFile command inside a file (like you had in the example) if you want to use the input redirection facility.

If all you want is to bypass the stdin you can always use Unix stream redirections or pipes, like


Code (]
$HYPHYMP run.bf < input > output
[/code):

or

[code]
$(echo option1; echo option 2; ... ; echo option N) | HYPHYMP run.bf > output


The input file would have to include the inputs you would normally supply interactively, e.g.

[code]
1
/path/to/file
2
/path/to/output/file
[/code]

Sergei

Title: Re: How to use HyPhy without interactive shell?
Post by CodieR on Nov 7th, 2013 at 8:03am
Hi,

I can't use stream redirection or pipes, because the system is on runlevel 3.

The output of ./HYPHYMP looks just like this:


Code (][root@hpc hyphy):
# ./HYPHYMP

/usr/local/lib/hyphy/Batch file to run::


Therefore a Batch file with an inputRedirect-Array is the only solution, I guess.

I played around with this run.bf:


Code (]fprintf(stdout, "Hello!\n");

inputRedirect = {};
inputRedirect["01"):

= "10"; // (10) Positive Selection
inputRedirect["02"] = "1";  //  (1) Use the random effects branch-site model (2010) to find lineages subject to episodic selection.
inputRedirect["03"] = "1";  //  (1):[Universal] Universal code. (Genebank transl_table=1).
inputRedirect["04"] = "1";  //  (1):[Yes] Both alpha and beta vary along branch-site combinations
inputRedirect["05"] = HYPHY_BASE_DIRECTORY + "testinput1";
inputRedirect["06"] = HYPHY_BASE_DIRECTORY + "testinput2";
inputRedirect["07"] = HYPHY_BASE_DIRECTORY + "testoutput";


It just returns this, but no job is running in the background.


Code (][root@hpc hyphy):
# ./HYPHYMP run.bf
Hello!


So I am looking for a command to tell HyPhy to read my menu selection from a batch file.

Or am I understanding this wrong?

How do my users can make use of the various options of HyPhy via HyPhy-Batch-File/Language?

I read the documentation, but that chapter is barely explained.

Thanks so far!
CodieR

Title: Re: How to use HyPhy without interactive shell?
Post by CodieR on Nov 18th, 2013 at 2:46pm
Problem solved!

Solution: (Follow the instructions ;) )

[code]
cmake -DINSTALL_PREFIX=/your/install/path/HyPhy/ .
make MP2
make install
[/code]

Running HYPHYMP from /your/install/path shows me the interactive menu and piping commands works.
It just doesn't run as expected from the folder where it was compiled.

Cheers,
CodieR

HyPhy message board » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.