Return an empty file for blast result in local blast using php
0
0
Entering edit mode
8.0 years ago
asar7295 • 0

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 • 1.9k views
ADD COMMENT

Login before adding your answer.

Traffic: 3277 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6