<p>Is there a way to tell blast to output the unmapped reads into a separate file or at least the name of the unmapped sequences?</p>

<p>I assume you have used blast to align some reads "reads.fa" onto a reference "ref.fa", and have a blast report in "out.bls" ?</p>

<pre><code>% formatdb -i ref.fa -p F
% blastall -p blastn -i reads.fa -d ./ref.fa -o out.bls
</code></pre>

<p>As RM answered, you can (hackily) get the read IDs that got no hits. I have added extra code to ensure a clean list of IDs only into "nohits.ids":</p>

<pre><code>% grep -B5 "***** No hits" out.bls | grep '^Query=' | sed 's/^Query= //' &gt; nohits.ids
</code></pre>

<p>Now if you want to get back the sequences listed in nohits.ids from reads.fa, you can use this trick:</p>

<pre><code>% formatdb -i reads.fa -p F
% fastacmd -d ./reads.fa -i nohits.ids -D 1 -o nohits.fa
</code></pre>

<p>Good luck!</p>
