Answers.Body: <p>You can extract fasta sequence from a blastdb constructed from a fasta file using blastdbcmd which should be installed when you install blast/makeblastdb.</p>
  
  <pre><code>blastdbcmd -entry all -db &lt;database label&gt; -out &lt;outfile&gt;
  </code></pre>
  
  <p>If you had a database called <code>my_database</code> which contained the files:</p>
  
  <ul>
  <li><code>my_database.nhr</code> </li>
  <li><code>my_database.nsq</code> </li>
  <li><code>my_database.nin</code></li>
  </ul>
  
  <p>and you wanted your fasta output file to be called <code>reference.fasta</code> you would run the following:</p>
  
  <pre><code>blastdbcmd -entry all -db my_database -out reference.fasta
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-19T15:25:03.003Z
Answers.LastActivityDate: 2017-06-19T15:25:03.003Z
Answers.UserDisplayName: amblina
Body: <p>How to extract the sequence used to create a blast database.  This is useful when you download a blastdb from somewhere else e.g. one of the <a href="https://ftp.ncbi.nlm.nih.gov/blast/db" rel="noreferrer">databases provided by NCBI</a> including the 16SMicrobial database. Or alternatively, when you want to double check which version of a sequence you have included in a blastdb.</p>
  
Tags: <fasta><blast>
Title: How to extract fasta from a blastdb
ThreadText: # How to extract fasta from a blastdb
  
  (Asked by: username_0 on 2017-06-19)
  
  How to extract the sequence used to create a blast database. This is useful when you download a blastdb from somewhere else e.g. one of the [databases provided by NCBI](https://ftp.ncbi.nlm.nih.gov/blast/db) including the 16SMicrobial database. Or alternatively, when you want to double check which version of a sequence you have included in a blastdb.
  
  **Tags:** fasta, blast
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-06-19. Score: 9 | Accepted answer
  
  You can extract fasta sequence from a blastdb constructed from a fasta file using blastdbcmd which should be installed when you install blast/makeblastdb.
  
  ```
  blastdbcmd -entry all -db <database label> -out <outfile>
  
  ```
  
  If you had a database called `my_database` which contained the files:
  
  * `my_database.nhr`
  * `my_database.nsq`
  * `my_database.nin`
  
  and you wanted your fasta output file to be called `reference.fasta` you would run the following:
  
  ```
  blastdbcmd -entry all -db my_database -out reference.fasta
  
  ```
  
  
  ---
  
  