Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

BLAST and BioPerl

by GeneticistDrew (Initiate)
on Sep 03, 2013 at 14:22 UTC ( #1052113=perlquestion: print w/replies, xml ) Need Help??
GeneticistDrew has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I started to use Perl a couple a days ago and would like to ask my first question... I have been using BioPerl and all seems to be OK, however I cannot use StandAloneBlast. I've followed "" down to BLAST, which I have installed as instructed on "" but this is where the problems begin. To put it simply, I don’t know how to use/install NCBI Blast for use with BioPerl. I put a sequence database "Anopheles-gambiae-PEST_TRANSCRIPTS_AgamP3.7.fa" into the “db” folder of “blast-2.2.28+”. I then attempted to use the BLAST tool to find a specific DNA sequence within my database, as instructed on the bioperl beginners page.

#!/bin/perl -w use warnings; use Bio::Seq; use Bio::Tools::Run::StandAloneBlast; $blast_obj = Bio::Tools::Run::StandAloneBlast->new(-program => 'blast +n', -database => 'Anopheles-gambiae-PEST_TRANSCRIPTS_AgamP3.7.fa'); $seq_obj = Bio::Seq->new(-id =>"AGAP007280_query", -seq =>"TCTCGAGATG +GCGAACCTGCTGCAGGGGTTCAGCGAGATGGGTCCAGCCAAAGAGAAGACGACGCCACAGTATGAGG") +; $report_obj = $blast_obj->blastall($seq_obj); $result_obj = $report_obj->next_result; print $result_obj->num_hits;

The output is as follows:

Replacement list is longer than search list at C:/Dwimperl/perl/site/l +ib/Bio/Ran line 251. Use of uninitialized value $_[0] in string eq at C:/Dwimperl/perl/lib/ +File/Spec/ line 152. --------------------- WARNING --------------------- MSG: cannot find path to blastall --------------------------------------------------- Can't call method "next_result" on an undefined value at bioperl_blast line 12.

I don't know how to define the path to blastall, which for the moment is probably the biggest issue. I’m not sure if I have been very clear, but I’m very new to this… thanks in advance!

Replies are listed 'Best First'.
Re: BLAST and BioPerl
by choroba (Bishop) on Sep 03, 2013 at 14:27 UTC
    Please, remove <br> from your code samples, it is not needed here.

    You are using strict. While it is good and praiseworthy, it also means you have to follow its rules. One of the rules is "do not use a variable without declaring it first". None of your variables seem to be declared (see my).

    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      You are using strict.

      Unless the post was updated, no, the OP is not using strict. Both '-w' and 'use warnings' are being used (where only one or the other should be used...I prefer 'use warnings').

        Yes, the post was updated, not following the advice given in How do I change/delete my post?. strict was removed and the errors are now completely different.
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: BLAST and BioPerl
by ww (Archbishop) on Sep 03, 2013 at 15:03 UTC
    The messages you've quoted do NOT support your supposition that "the problem is that it needs to use the NCBI BLAST installed components, which it cannot find." They address themselves solely to what choroba pointed out: that the first use of each needs to be declared with a "my" as, for one possibility,
    my ($blast_obj, $seq_obj, $report_obj, $result_obj);

    If Perl couldn't find something you tried to use, it would have provided an additional message specifically stating that it can't find it (by name).

Re: BLAST and BioPerl
by glasswalk3r (Friar) on Sep 03, 2013 at 14:48 UTC

    I would also recommend reading How do I post a question effectively? and use <readmore> tags around the parts that could be omitted while previewing the post.

    Alceu Rodrigues de Freitas Junior
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1052113]
Approved by hdb
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2019-01-18 10:10 GMT
Find Nodes?
    Voting Booth?
    After Perl5, I'm mostly interested in:

    Results (322 votes). Check out past polls.