This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blastpcmd (Windows) - Too Many Positional Arguments

Hello, guys! I am a fresh man in bioinformatics. When I type:

blastp -db $db -query orf_trans.fasta -outfmt 7 -max_target_seqs 5 -out blastout_top5.txt

it occurs error:

Error: Too many positional arguments (1), the offending value: orf_trans.fasta
Error:  (CArgException::eSynopsis) Too many positional arguments (1), the offending value: orf_trans.fasta

Because I use sever to do this work. When I restart the sever, magically,the file blastout_top5.txt shows, but strangely, it is blank inside.

I still have no idea what to do for this error.. Would you please be able to help me out? Thank you so much in advance.

software error

Is orf_trans.fasta file in the current directory where you are running this from? I don't recall if -outfmt 7 has a standard number of fields or you need to specify ones you want. For example:

blastn -db ecoli -outfmt "7 qacc sacc evalue qstart qend sstart send"

Thank you for your helpful suggestions. Yes, orf_trans.fasta file is in the current directory where I am running this. I try the blastp -db $db -query orf_trans.fasta -outfmt "7 qacc sacc evalue qstart qend sstart send" -max_target_seqs 5 -out blastout_top5.txt, but unfortunatelly, it still occur the same error.

Thank you all. When I recreate the db, everything goes all right.

You can accept the answers below (green check mark) to provide closure to this thread. You can accept more than one answer.

2 answers

In addition to genomax's suggestion: what is the output of the command: echo $db ? Is the variable defined and pointing to an existing file? However, my suspect number 1 is the one pointed out by genomax, i.e. the fact that the file orf_trans.fasta is not in the current directory. You could try with head orf_trans.fasta to check.

The output of echo $db is nothing, I think this is the problem.Thank you for your helpful suggestion. The db is a directory. I once uesd makeblastdb -in orf_trans.fasta -out db/orf_trans -dbtype prot -parse_seqids to create a database in the current directory, where I am running the commands that I metioned in my question, and it was successful. When I use ls command to list content in db, there are : orf_trans.phr orf_trans.pog orf_trans.psi orf_trans.pin orf_trans.psd orf_trans.psq. Is the way I create database wrong?

As Fabio Marroni , I suspect the variable $db is empty, so blastp interprets -query as a blast database name, and as orf_trans.fasta is not preceded by a dash hyphen, it is also interpreted as a blast database name. Hence, two positional arguments (database names), and the error.

When I restart the sever

Why do you have to restart the server? This error shouldn't lead to further problems, and one wouldn't need to restart the server.

Also, why the title of your post says blastdbcmd - too many positional arguments, but the body uses blastp command?

edit: another common cause for this error (but it doesn't seem to be your case) is when the command is copy and pasted from the internet or from some pdf file, and the hyphens which should denote the command parameters are instead replaced by dashes.

Thank you for your helpful suggestions. Sorry, I should edit my title to blastpcmd. And restarting was an accident actually. Yes, when I run echo $db, it was nothing. But when I run blastp -db $db -query orf_trans.fasta -out blastout.txt before, it works.

Log in to answer this question.