[Biophp-dev] Re: BLAST interface and parsers - take 2

S Clark biophp-dev@bioinformatics.org
Sat, 15 Nov 2003 11:45:02 -0700


=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I got your email - I think it is about time I wrote up at least a minor
example of how to use the frontend(s), so I will try to do that today
(hooray for weekends!). =20

The email you sent just contains the page with the HTML form, so a quick
summary (before I do a 'real' example later today) is that you will want
to give your form elements names and values based on what parameters
they will translate to for the blast.exe options, so for example,=20
instead of "select3", you could name the "programme" select option
"-p", and the values of the options would be "blastn", "blastp"
"blastx", and "tblastn".
=2D ----------------------------------------------------------------
<font color=3D"#004080"><strong>Programme</strong></font>
      <select name=3D"-p">
        <option value=3D"blastn" selected >blastn</option>
        <option value=3D"blastp" >blastp</option>
        <option value=3D"blastx" >blastx</option>
        <option value=3D"tblastn" >tblastn</option>
      </select>
=2D --------------------------------------------------------------

Another example is you might change the name of "textarea" to "sequence", a=
nd
the selection for the database could be named "-d" and the values would be =
the
database filenames (just like you would type it in 'by hand' on the command
line.)

It isn't NECESSARY to do it this way, but I sometimes like to do that
because it simplifies coding for using the frontend.

Then in the page that the form submits its data to (maybe call it
"doblast.php", and set action=3D"doblast.php" in the form) you will just se=
nd
those values to the frontend object, like (this isn't a COMPLETE example
but it should give you a good idea of how it works):
=2D -----------------------------------------------------------------------=
=2D--------
<?php
$frontend =3D new frontend_blast("C:\BLAST\BLAST.EXE");
//or in my case $frontend =3D new frontend_blast("/usr/local/bin/blastall");
$frontend->blastDataDir("C:\BLAST");//if your data is in same dir as program
$frontend->blastSequence=3D$_POST['sequence'];

unset($_POST['sequence']); //just so it doesn't confuse the next section

foreach (array_keys($_POST) as $parameter) {
    $frontend->blastParam($parameter,$_POST[$parameter]);
}

$frontend->blastParam("-m","0");=20
$frontend->blastParam("-T","T");//to set HTML output

$frontend->doBlast();

print($frontend->results());
?>
=2D ------------------------------------------------------------------------
That is just an incomplete example, but it might give you a start.  I will
try to get more complete "official" examples written later today for
everyone, and if I get time I will finally add the "nice" interface methods
for setting the parameters, so that they're the same between the local
blast frontend and the NCBI online blast frontend.  Then the whole thing
should be pretty much ready for a 1.0 release.

Oh, and one last thing to remember, you may have to increase the
script timeout setting, if it is a big database and/or you have a
slow computer or slow hard drive.  If I remember correctly, the
default is 30 seconds, so if it normally takes that long or longer
to run the BLAST from the command line, you'll need to increase it
in the doblast.php script.

Sean

On Friday 14 November 2003 08:21 am, you wrote:
> dear clark !
> have u recieved my mail and attached file ! is there any possibility to
> integrate frontend_blast.php into the script i sent u ! thanks
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/tnQ1J6yQLhNTzSkRAr75AKCLMCKWaK6tdkuCUztxBtOyQnWuaACZAQbr
bbjA6XSS/LmnKwSrcecoSGo=3D
=3DcVtI
=2D----END PGP SIGNATURE-----