This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Execute Tophat Via Java

Hi all,

I'm trying to run tophat via an Java interface. With other mapping tools like bowtie etc. it works perfect. If i execute the tophat start command via java runtime exec() it doesn't work! But if i copy the command into the shell it works fine...so what is wrong?! Is it becaue of the nested program structure, that java doesn't allow tophat to execute bowtie??

Can anyone help me or has experiences about that??

Cheers! Steve

tophat java

post the error message that you get

2 answers

I guess tophat is in your $PATH that's why it runs without any problem with the shell.

try to put the full path to the tophat executable in the exec command.

Tophat actually runs.....but the output stream says:

[Fri Jul 15 07:49:32 2011] Beginning TopHat run (v1.3.1)

[Fri Jul 15 07:49:32 2011] Preparing output location /home/chg/Desktop/ [Fri Jul 15 07:49:32 2011] Checking for Bowtie index files [Fri Jul 15 07:49:32 2011] Checking for reference FASTA file [Fri Jul 15 07:49:32 2011] Checking for Bowtie Error locating program: bowtie

BUT BOWTIE IS IN THE $PATH....ahhh :(

Can you use exec("echo $PATH") to check $PATH of the java can find bowtie?

As others posted without error message its difficult to give advice.[?] a) Recent versions of tophat also need bowtie and samtools in the path. You have to add the path to them to the environment when you execute the call to tophat. Although by default the subprocess should inherit our environment.[?]

Runtime.exec(String[] cmdarray, String[] envp)
Executes the specified command and arguments in a separate process with the specified environment.

b) make sure to handle the runtime output correctly (even if its no a lot) javaworld.

Log in to answer this question.