How to run BLAST on a compressed FASTA file

FASTA files with sequences from next-generation sequencing projects can be large and are usually stored as compressed files using compression algorithms such as GZIP or ZIP. If you do not want to extract all the data or create another copy of the file when performing a BLAST search, you can combine the file extraction and the BLAST search using a pipe in Unix-based operating systems and tell the BLAST program to use the standard input. Here is one example on how to do that (assuming you have a GZIP compressed FASTA file):

$ gzip -dc file.fasta.gz | blastall -i stdin -p blastn -d database ...

The “|” sign makes the output of the gzip command available to the following command. Changing the -i parameter to “stdin” tells the blastall program to use the output of the previous command as input. The … should be replaced by additional parameters such as the output format (-m) or the word size (-W).