This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Local protein BLAST not working

I am trying to run a pblast locally. I have downloaded all the nr files from NCBI in a file with the following directory: '/home/lisa/Documents/nr' The first code is giving the error code 'Command line argument error: Argument "query". File is not accessible: and the function is returning ERROR right away

nr ='/home/lisa/Documents/nr'
BLAST_output = NcbiblastpCommandline(cmd='blastp', query='MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGTQDNLSGAEKAVQVKVKALPDAQFEVVHSLAKWKRQTLGQHDFSAGEGLYTHMKALRPDEDRLSPLHSVYVDQWDWERVMGDGERQFSTLKSTVEAIWAGIKATEAAVSEEFGLAPFLPDQIHFVHSQELLSRYPDLDAKGRERAIAKDLGAVFLVGIGGKLSDGHRHDVRAPDYDDWSTPSELGHAGLNGDILVWNPVLEDAFELSSMGIRVDADTLKHQLALTGDEDRLELEWHQALLRGEMPQTIGGGIGQSRLTMLLLQLPHIGQVQAGVWPAAVRESVPSLL', db=nr,  evalue=0.001, out='.xml', outfmt=5)
stdout, stderr = BLAST_output()
print(BLAST_output)

OR

def BLAST_local(id, seq):
    d = {}
    try:
        BLAST_output = NcbiblastpCommandline(cmd='blastp', query=seq, db='/home/lisa/Documents/nr', evalue=0.001, out='.xml',outfmt=5)
        stdout, stderr = BLAST_output()
        d.update({(Most_likely_PDB): BLAST_output})
        print("ADDED:", id)

    except:
        print("ERROR:", id)
alignment

Why dont you use blastp from the command line?

make db with

makeblastdb -in file.fasta -dbtype prot -out yourdbresult

blast -db yourdbresult -query linktoyouprotein.fasta -out blastp.txt

The db is a list of file downloaded from NCBI. It contains non-redundant sequences from GenBank translations and sequences from other databanks (Refseq, PDB, SwissProt, PIR and PRF)

Isn't it that you should give <filename> to "query=" arg, instead of raw amino acid sequence?

1 answer

This sounds more like a file permissions issue. Look up chmod and check the permissions granted to your file(s) with regards to read/write/execute...Also, depending on your OS, stdout and stderr may not do what you want. To be on page with most everyone, I recommend to use a Unix terminal cmd or R/Python package to do this.

Log in to answer this question.