# Merging / Concatentating BLAST Databases

I was wondering if any one has had success merging BLAST databases from multiple references?

For a concrete example I have hg19 and a bunch of viral and bacterial genomes that all have been index separately but I want to do a single alignment to all of them. Is there a way I could say combine hg19, virus_A, virus_D and bacteria_X into a single database without having to regenerate? Since the problem could get combinatorial quickly and making a db with hg19 is time consuming I was wondering if there was a way around it.

This is similar to another ticket but asking for BLAST instead of alignment indexes.

There's an app for that, apparently.

Often we need to search multiple databases together or wish to search a specific subset of sequences within an existing database. At the BLAST search level, we can provide multiple database names to the “-db” parameter, or to provide a GI file specifying the desired subset to the “-gilist” parameter. However for these types of searches, a more convenient way to conduct them is by creating virtual BLAST databases for these. Note: When combining BLAST databases, all the databases must be of the same molecule type. The following examples assume that the two databases as well as the GI file are in the current working directory.

Aggregate existing BLAST databases

To combine the two nematode nucleotide databases, named “nematode_mrna” and “nematode_genomic", we use the following command line:

\$ blastdb_aliastool -dblist "nematode_mrna nematode_genomic" -dbtype nucl \
-out nematode_all -title "Nematode RefSeq mRNA + Genomic


So, you can use the blastdb_aliastool to create merged databases just like you asked for.