Perl Script 6: How to search NCBI database using PERL script

I was thinking that will not it be an exciting idea to search my favorite database NCBI right from my desktop. in search of solution of this weird think, i found that some people have already wrote down some PERL script for searching the NCBI database without going on their webpage again and again. this PERL script is written by Paul Stothard of University of Alberta and you can download the original PERL script along with its documentation from HERE or you can copy paste and save the script from below also,



Script name Download
NCBI search.pl

This PERL script for NCBI search will accept following argument


 -q [STRING]     : raw query text (Required)
 -o [FILE]           : output file to create (Required).
 -d [STRING]     : name of the NCBI database to search, such as 'nucleotide', 'pubmed' (Required).
 -r [STRING]     : the type of information requested. For sequences, 'fasta' is often used.
 -m [INTEGER]    : the maximum number of records to return (Optional)

Uses:
perl ncbi_search.pl -q dysphagia AND homo sapiens -o results.txt -d pubmed -r uilist -m 100

will search two terms 'dysphagia AND homo sapiens' in database 'pubmed ' and write down the '100' results in file 'result.txt'.

perl ncbi_search.pl -q dysphagia AND homo sapiens -o results.txt -d protein -r fasta -m 100

will search two terms 'dysphagia AND homo sapiens'  in database 'pubmed ' and write down the '100' results in file 'result.txt'.




Problem ?????? drop a comments below :)

4 comments:

  1. Hi, so excited that I fond this website. I tried to use the "ncbi_search.pl" script with Windows Gitbash. The Hello World script example works, so I think the perl script reads in correctly.

    When I searched for "perl ncbi_search.pl -q cave AND bacteria -o major.fasta -d nucleotide -r fasta"
    I got the following error:
    "Can't locate LWP/Simple.pm in @INC at ncbi_search.pl line 9"

    Any ideas what this is? Thank you!

    ReplyDelete
    Replies
    1. Nice to see you. I think you have to install Bioperl to run this perl script. You can install bioperl easily by follow this methods
      How to install Bioperl in windows

      Delete
  2. Hello! I think I already commented about using a long query string with this perl command. my long query string:
    bacteria AND 16S AND (cave OR karst OR aquifer OR groundwater OR mine OR lava) AND 250:1000[SLEN]

    does run, but after some time I get the error:
    Too many failures --giving up search. at perl line 144.

    Is this a failure on NCBI or the script? I did use this query in NCBI and it worked, but the download process with this script and perl is much more favorable.

    Thank you!

    ReplyDelete

Have Problem ?? Drop a comments here!