This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is it possible to get taxonomy identifiers from diamond output without using --taxonmap during makedb?

I want to run diamond and also get taxon identifiers for each hit. Is the only way to do this by incorporating it during the makedb step? Is there any other option? The reason why I'm asking is because I would have to ask IT to recreate the databases but it would be cool if I could do it post hoc. I have my own scripts going from taxon id to species/genus/etc but I still need the taxonomy identifier.

Command

source activate diamond_env
diamond blastp -f 6 qseqid sseqid pident nident length mismatch gapopen qstart qend sstart send evalue bitscore staxids stitle -o cylindrotheca.diamond.nr.blast6 -p 16 -d /usr/local/db/diamond/nr.dmnd -e 0.001 -q ./assembly_cylindrotheca/assembly.orf.faa"

Output

diamond v0.9.29.130 | by Benjamin Buchfink <buchfink@gmail.com>
Licensed under the GNU GPL <https://www.gnu.org/licenses/gpl.txt>
Check http://github.com/bbuchfink/diamond for updates.

#CPU threads: 16
Scoring parameters: (Matrix=BLOSUM62 Lambda=0.267 K=0.041 Penalties=11/1)
Temporary directory:
Opening the database...  [0.040975s]
Error: Output format requires taxonomy mapping information built into the database (use --taxonmap parameter for the makedb command)

Can I use any of these files?

(diamond_env) -bash-4.1$ ls /usr/local/db/taxdb/taxdb_current/
taxdb.btd  taxdb.bti

(diamond_env) -bash-4.1$ ls /usr/local/scratch/METAGENOMICS/jespinoz/db/ncbi_taxonomy/
citations.dmp  delnodes.dmp  division.dmp  gc.prt  gencode.dmp  merged.dmp  names.dmp  nodes.dmp  readme.txt  taxdump.tar.gz
diamond blast protein alignment taxonomy

Have you solved this problem?

No I gave up. Have you?

1 answer

In order to incorporate the taxonomy information into the diamond database, you'd have to use the prot.accession2taxid with nodes.dmp when you build the diamond database.

More info: http://www.diamondsearch.org/index.php?pages/command_line_options/

This can be achieved by using the following command:

 diamond makedb --in nr --db nr_diamond --taxonmap prot.accession2taxid --taxonnodes nodes.dmp --threads 20

Where do you get this file: prot.accession2taxid?

Edit: wget ftp://ftp.ncbi.nlm.nih.gov/pub/taxonomy/accession2taxid/prot.accession2taxid.gz

Log in to answer this question.