This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to perform bidirectional BLAST?

I have 100s of complete genome sequences, downloaded from NCBI. And I have query gene sequences which I would like to BLAST against the complete genomes.

To perform the bidirectional BLAST, I would like to create a local database from one genome. The second genome will be queried against the database. The BLAST would be repeated by interchanging the database and query genomes.

Is there any R package to do the above?

bidirectional blast

What is the point of doing this exercise? Are you planning to transfer annotations from one strain to others?

If you are looking for genome-wide similarities/rearrangements then using mauve is perfect solution.

3 answers

Proteinortho does a bi-directional blast if you are looking for orthologs. Also, you can look for paralogs with self-hits and reduce false-orthologs with the synteny option using poff0extension.

As @Ashley stated, BLAST is by default bidirectional. Download blast+

makeblastdb -in genome1.fa -dbtype nucl
makeblastdb -in genome2.fa -dbtype nucl

blastn -query genome1.fa -db genome2.fa (-out outfilename -outfmt *N* -num_threads *N*)
blastn -query genome2.fa -db genome1.fa (-out outfilename -outfmt *N* -num_threads *N*)

For each genome in a directory, you can also make a loop that will blast each genome to the given db. If the files are not huge, you can concatenate them and run them together, if you have unique sequence headers per genome, and parse the blast results after.

I prefer outfmt 6, which is tab-delimited. From the results, you will be able to tell the direction of the alignment, based on the qstart/qend, sstaart/send values. For more parameters, blastn -help

So, while the two steps outlined are the core steps to doing bi-directional blast queries, I want to point out that this is not "bidirectional by default". Bi-directional by default would imply that when you run a single blast query against a database, it would do the reverse query of the database against the query FASTA by default. This is not the case.

It may be clearer to specify that what is being done is more commonly referred to (at least back in the day when I did this routinely) as reciprocal BLAST.

The software is default bidirectional.

could you send me a tutorial or a link of the software? since I need run it locally

Hmm. I don't understand that statement. What do you mean by "default bidirectional"? While blast+ can work that way it does not do bidirectional blasts by default. Unless I am missing something.

Log in to answer this question.