This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Including file name of database into blast output

Hi everyone, can you please advise me on how to include the file name of my database into the output of blast while using outfmt 6?

The example below - I need the ${file} included in every ${file}.blast output file, so I could merge all the ${file}.blast files into one and still know which database ${file} did the sequence come from.

makeblastdb -in ${file}.fa -dbtype nucl -out ${file}

blastn -query query.fasta -db ${file} -out ${file}.blast -outfmt "6 qseqid sseqid pident length qstart qend sstart send evalue bitscore sseq" -num_threads 36 -max_target_seqs 5 -task blastn

Perhaps I am missing some obvious way. I'd prefer not to rename all the sequences in the database files and I'd rather not use outfmt 7 where I could get the database file name in the comment.

Thank you all so much, this is my first post.

outfmt blast makeblastdb database dbtype firstpost

1 answer

As far as I know, the database name is not available as an outfmt template parameter.

As a workaround you could prepend that information in your script:

echo "# dbname=${file}.fa > results.txt
blastn .... >> results.txt

interestingly there are other pieces of information that are only available with outfmt 7, not getting a hit with a query is mentioned in the comments of format 7 but not in format 6

Log in to answer this question.