Blast in parallel with edible outfmt
1
1
Entering edit mode
3.8 years ago
K.Gee ▴ 40

Hello Biostars

I know that I can run blast with with "edible" output by using this command:

blastp -query -FASTA.faa - db MYDATABASE -evalue 1e-5 -outfmt "6 sseqid pident evalue bitscore staxids"

If I want to run the same command in parallel, i am using

ls *.fna| parallel -a - blastp -query {} -db MYDATABASE -evalue 1e-5 -outfmt 6 -out {.}.txt

My issue is when I am trying to combine the outfmt in parallel I got an error and I want to know if I can combine those two commands in one?

I tried:

ls *.fna| parallel -a - blastp -query {} -db MYDATABASE -evalue 1e-5 -outfmt "6 sseqid pident evalue bitscore staxids sscinames sskingdoms stitle" -out {.}.txt

This gives me:

Error: Too many positional arguments (1), the offending value: evalue Error: (CArgException::eSynopsis) Too many positional arguments (1), the offending value: evalue

sorry for my terminology, but I'm a new kid on the block

Thank you in advance

blast output • 1.7k views
ADD COMMENT
0
Entering edit mode

I suspect this is just a matter of how bash and parallel are handling the " differently. Have you tried hard-quoting instead with '?

ADD REPLY
0
Entering edit mode

I did but doesnt work either :-(, but thanks for your response anyhow!!!

ADD REPLY
0
Entering edit mode

does the cmdline using only -outfmt 6 work ? (== the problem starts when you add the "6 ...." part ? )

on a side note: I don't see any immediate advantage in using parallel here (if you want to speed it up somehow, run it on multiple threads)

ADD REPLY
0
Entering edit mode

Yes with -outfmt 6 works perfectly!!! My issue starts when I am editing the out format

ADD REPLY
1
Entering edit mode

This is almost certainly a quirk of how parallel is treating " I would think, but I can't spot the issue off hand.

ADD REPLY
0
Entering edit mode

I tried almost everything before posting my issue. Also I realised that I cannot increase the -num_threads as I am doing in the "normal" blast search, so I guess that it is a bag of the parallel command than a mistake during my typing.

ADD REPLY
0
Entering edit mode

see if this is populating correct queries and then try removing dry-run

$ parallel --dry-run  'blastp -query {} -db MYDATABASE -evalue 1e-5  -outfmt "6 sseqid pident evalue bitscore staxids" -out {.}.txt' ::: *.fna

Also check your parallel version.

ADD REPLY
0
Entering edit mode

Works too!!! thank you very much!

ADD REPLY
4
Entering edit mode
3.8 years ago
ATpoint 86k

I second the other suggestions of conflicts with how parallel and bash interpret quotations. I generally find it best to write a function for the command and then feed the function into parallel, avoiding exactly what you experience. I do not see a reason to use -a so leaving it out here (untested, based on your code, I do not know the blast syntax):

function blasty {

  blastp \
    -query "${1}" \
    -out "${1%.fna}".txt \
    -db MYDATABASE -evalue 1e-5 -outfmt "6 sseqid pident evalue bitscore staxids sscinames sskingdoms stitle"

}; export -f blasty

ls *.fna | parallel blasty {}

MYDATABASE is worth checking as well, is this a variable or in this case simply a spaceholder for the actual path to the file (or whatever it is, as said not a blast user myself)?

ADD COMMENT
0
Entering edit mode

Thank you for the response. I got some question regarding your answer. I paste the command at my terminal but it looks like it missing something as I get a blinking ">" Did I have to remove the \ or I have to run the code in different way?. I m sorry for that but I am still learning bash

ADD REPLY
0
Entering edit mode

Just changed it, I accidentally wrote blastp rather than blasty in the parallel call, please try again. When I paste the function it works, make sure this database variable is correct.

ADD REPLY
0
Entering edit mode

It works . Thanks a lot !!!!! :-)

ADD REPLY

Login before adding your answer.

Traffic: 2272 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6