Search code examples
phpwindowscmdblast

How can I run blast on php using windows


I'm trying to run blast in my php program, but I'm getting no result from it. I've never used blast before, so I'm not sure about what I'm supposed to do. I'm using windows, and it is working just fine, but when i try to run it through the php I get no results. This it my code:

$texto = "7 qseqid qseq sseqid sseq evalue bitscore";
$cmd = "blastp -query -test_query.fa -db notas.fa -task blastp -outfmt '.$texto.' -out musica1.fa  2>&1";
$result = shell_exec($cmd);
print_r ($result);

What I want is to search the test_query.fa in the notas.fa database, and put the results on musica1.fa. But I'm getting nothing on my musica1.fa file. Can someone help me with that? I'm really lost here. The files I just told you about are on my directory, should I have any other file in there for it to work? When I ran this code I got the following message:

' Blastp ' not recognized as an internal or external command, operable program or batch file.


Solution

  • I'm assuming when you say 'on windows' you mean in the command terminal and 'in my php program' you mean running on the same windows machine thatblastp works via command terminal a php script.

    This seems like an environment path issue that your user has but isn't set for the php script.*

    Try using the full path name to the blastp executable in your php script like:

    $cmd = "C:/full/path/to/blastp ...";
    

    I think you can use where blast* in the command terminal to find the path to the program if you don't know it.