This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blast Formatdb, Multiple Folders/Directories

I have downloaded viral genomes from the NCBI website I want to use formatdb so I can create a BLAST database of these viral genomes. However, they are present as nearly 300 folders, each containing the fasta files for each of the genomes/genome segments (named by NC_ ids). In the documentation for formatdb, it says to format multiple files I must quote the input files to be formatted. I do not have a list of these files as they are within the folders. Is there any way to formatdb using multiple folders/directories rather than the individual fasta files?

Any help much appreciated :-) Thanks

blast

3 answers

If you're using Linux:

cat `find /path/to/sequence/root -name "*.fasta"` > all_sequences.fasta
formatdb .... -i all_sequences.fasta (or makeblastdb)

If you're using Windows it's probably time to switch ;-)

Tell me if you get an "argument too long" error, then the command needs a slight modification.

or:

formatdb -i "`find ./ -iname '*.fasta' | perl -p -e "s/\n/ /"`" -n all.db

While doing it all in one command is nice it makes it more difficult to diagnose errors ;-)

Thanks for the responses, I think I've sorted it now :-)

If one of the answers solved your problem please accept it by clicking on the checkmark next to it.

Log in to answer this question.