This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Return an empty file for blast result in local blast using php

Hi everyone, I tried to execute local blast command on php script. The command did created a file for blast output but it just an empty file. So I tried paste the command to Linux command prompt and it create a file with blast result.

I still can't figure out the problem. Hope you guys can help me with this.

$blast_path="/opt/lampp/htdocs/blasto/bin/";
$blast_database_directory="/opt/lampp/htdocs/blasto/db/";
$blast_result="/opt/lampp/htdocs/blasto/result/";

 $queryfname =tempnam($blast_result,"IN");
 $resultfname=tempnam($blast_result,"OUT");
    exec("find ".$queryfname." -type f -exec chmod 777 {} +");
    exec("find ".$resultfname." -type f -exec chmod 777 {} +");
    print("The query sequence:".$queryfname."<br>\n");
    print("The resulting output:".$resultfname."<br><br>\n");
    if ($qhandle=fopen($queryfname,"w")) {
    if ($bytes=fwrite($qhandle,$_POST['sequence'])) {
        print("Successfully wrote $bytes characters of data to $queryfname.<br /><br>\n");
    } else {
        print("Problem writing the file $queryfname at handle $qhandle!<br /><br>\n");
    }
    fclose($qhandle);
    }

print($blast_path.$_POST['program']." -query ".$queryfname." -db ".$blast_database_directory.$_POST['database']." -evalue ".$_POST['evalue']." -out ".$resultfname."<br><br>");
exec($blast_path.$_POST['program']." -query ".$queryfname." -db ".$blast_database_directory.$_POST['database']." -evalue ".$_POST['evalue']." -out ".$resultfname);
blast php linux

0 answers

No answers yet.

Log in to answer this question.