1

I'm working on a server where users should be able to run protein sequences against a database, and it uses an executable called blastall. The server generates an executable which it should then run using batch. However, it doesn't appear to be running. Here is an example of an executable is generates (cmd.sh):

#!/usr/bin/env sh
cd /var/www/dbCAN
php -q /var/www/dbCAN/tools/blast.php -e -w /var/www/dbCAN/data/blast/20121019135548

Where the crazy number at the end of that is an auto-generated job ID based on when the job was submitted. There are 2 issues, and I'm trying to solve one at a time. The first issue is that when manually executed (by me simply running ./cmd.sh), I get the following errors:

sh: 1: /var/www/dbCAN/tools/blast/bin/blastall: not found
sh: 1: /var/www/dbCAN/tools/blast/bin/blastall: not found
sh: 1: -t: not found

But this doesn't really make sense to me, as the directory specified does in fact contain blastall. It has full rwx permissions and every directory along the way has appropriate permissions.

The blast.php file in tools looks like this:

try {
  do_blast($opts["w"]);
  $info['status'] = 'done';
  $fp = fopen("$opts['w']/info.yaml","w")
  fwrite($fp, Sypc::YAMLDump($info)); fclose($fp);  
}

With of course variable declarations above it, and the do_blast function looks like this (again with variables declared above it and a cd so the directories work out):

function do_blast($workdir)
{
  system("/var/www/dbCAN/tools/blast/bin/blastall -d data/blast/all.seq.fa -m 9 -p blastp -i $workdir/input.faa -o $workdir/output.txt")
  system("/var/www/dbCAN/tools/blast/bin/blastall -d data/blast/all.seq.fa -p blastp -i $workdir/input.faa -o $workdir/output2.txt")
}

Any idea what may be causing this issue? I thought it may be because I'm running it and it was created by apache, but rwx is allowed for all users. I can include more information if needed, but I chose not to at this point because the original person who wrote the PHP split up everything into tons of little files, so it's difficult to pinpoint where the problem is exactly. Any ideas (if not complete solutions) are very appreciated.

EDIT: Solution found. As it turns out, the blastall executable had been compiled on a different linux system. Switched to a different executable and it ran flawlessly.

Nathan
  • 2,093
  • 3
  • 20
  • 33
  • can you add the relevant section of your ./cmd.sh to your posting. What is the -t that the error messages are pointing to? – shellter Oct 22 '12 at 18:35
  • The first code block is cmd.sh – Nathan Oct 22 '12 at 18:38
  • Add a `system("ls -la /var/www/dbCAN/tools/blast/bin/blastall");` to see if it recognizes `blastall`, `echo getcwd();` to verify the directory (one never knows!), and system("ls -la data/blast/all.seq.fa"). After that, you can only try `strace`. – LSerni Oct 22 '12 at 18:39
  • Also, try doing `die("/var/www/dbCAN/tools/blast/bin/blastall -d data/blast/all.seq.fa -m 9 -p blastp -i $workdir/input.faa -o $workdir/output.txt")`. The command will stop echoing what would have been executed. Then impersonate the `apache` user, and run the same command from the shell. – LSerni Oct 22 '12 at 18:41

2 Answers2

1

Could it be an issue with relative paths in your script? See my answer here, maybe it helps:

finding a file in php that is 4 directories up

Community
  • 1
  • 1
CodeAngry
  • 12,760
  • 3
  • 50
  • 57
0

The solution was to recompile the blastall executable. It had been compiled for Redhat and I am using Ubuntu. Unfortunately I assumed the executable I was given was for my system, not the previous one.

Nathan
  • 2,093
  • 3
  • 20
  • 33