NCBI Bookshelf. A service of the National Library of Medicine, National Institutes of Health.

BLAST® Command Line Applications User Manual [Internet]. Bethesda (MD): National Center for Biotechnology Information (US); 2008-.

Cover of BLAST® Command Line Applications User Manual

BLAST® Command Line Applications User Manual [Internet].

Show details

Display BLAST search results with custom output format

Estimated reading time: 2 minutes

The –outfmt option permits formatting arbitrary fields from the BLAST tabular and comma-separated-value (CSV) formats. Use the –help option on the command-line application (e.g., blastn) to see the supported fields. The max_target_seqs option should be used with any tabular output to control the number of matches reported.

Example of custom output format: field selection

The following example shows how to display the results of a BLAST search using a custom output format. The tabular output format with comments is used, but only the query accession, subject accession, evalue, query start, query stop, subject start, and subject stop are requested. For brevity, only the first 10 lines of output are shown:

$ echo 1786181 | ./blastn -db ecoli -outfmt "7 qacc sacc evalue 
qstart qend sstart send"
# BLASTN 2.2.18+
# Query: gi|1786181|gb|AE000111.1|AE000111
# Database: ecoli
# Fields: query acc., subject acc., evalue, q. start, q. end, s.
start, s. end
# 85 hits found
AE000111 AE000111 0.0 1 10596 1 10596
AE000111 AE000174 8e-30 5565 5671 6928 6821
AE000111 AE000394 1e-27 5587 5671 135 219
AE000111 AE000425 6e-26 5587 5671 8552 8468
AE000111 AE000171 3e-24 5587 5671 2214 2130
$

Example of custom output format: output separator

One can also customize the output separator in the tabular and comma-separated-value output formats using the delim token immediately after the numeric output format selector. In the example below ‘@’ is used as a custom output separator:

$ echo 1786181 | blastn -db ecoli -outfmt '6 delim=@' | head 
AE000111.1@AE000111.1@100.000@10596@0@0@1@10596@1@10596@0.0@19568
AE000111.1@AE000174.1@88.991@109@9@3@5565@5671@6928@6821@7.69e-30@132
AE000111.1@AE000394.1@92.941@85@6@0@5587@5671@135@219@1.29e-27@124
AE000111.1@AE000425.1@91.860@86@5@2@5587@5671@8552@8468@5.99e-26@119
AE000111.1@AE000171.1@90.588@85@8@0@5587@5671@2214@2130@2.78e-24@113
AE000111.1@AE000171.1@90.476@84@8@0@5587@5670@10559@10642@1.00e-23@111
AE000111.1@AE000376.1@88.889@90@7@3@5587@5675@129@42@1.30e-22@108
AE000111.1@AE000268.1@89.412@85@9@0@5587@5671@6174@6090@1.30e-22@108
AE000111.1@AE000112.1@100.000@58@0@0@10539@10596@1@58@1.30e-22@108
AE000111.1@AE000447.1@89.286@84@9@0@5587@5670@681@598@4.66e-22@106
$

Trace-back operations (BTOP)

The “Blast trace-back operations” (BTOP) string describes the alignment produced by BLAST. This string is similar to the CIGAR string produced in SAM format, but there are important differences. BTOP is a more flexible format that lists not only the aligned region but also matches and mismatches. BTOP operations consist of 1.) a number with a count of matching letters, 2.) two letters showing a mismatch (e.g., “AG” means A was replaced by G), or 3.) a dash (“-“) and a letter showing a gap. The box below shows a blastn run first with BTOP output and then the same run with the BLAST report showing the alignments.

$ blastn -query test_q.fa -subject test_s.fa -dust no -outfmt "6 
qseqid sseqid btop" -parse_deflines
query1 q_multi 7AG39
query1 q_multi 7A-39
query1 q_multi 6-G-A41
$ blastn -query test_q.fa -subject test_s.fa -dust no -parse_deflines
BLASTN 2.2.24+

Query= query1
Length=47

Subject=
Length=142

Score = 82.4 bits (44), Expect = 9e-22
Identities = 46/47 (97%), Gaps = 0/47 (0%)
Strand=Plus/Plus

Query 1 ACGTCCGAGACGCGAGCAGCGAGCAGCAGAGCGACGAGCAGCGACGA 47
||||||| |||||||||||||||||||||||||||||||||||||||
Sbjct 47 ACGTCCGGGACGCGAGCAGCGAGCAGCAGAGCGACGAGCAGCGACGA 93


Score = 80.5 bits (43), Expect = 3e-21
Identities = 46/47 (97%), Gaps = 1/47 (2%)
Strand=Plus/Plus

Query 1 ACGTCCGAGACGCGAGCAGCGAGCAGCAGAGCGACGAGCAGCGACGA 47
||||||| |||||||||||||||||||||||||||||||||||||||
Sbjct 1 ACGTCCG-GACGCGAGCAGCGAGCAGCAGAGCGACGAGCAGCGACGA 46


Score = 78.7 bits (42), Expect = 1e-20
Identities = 47/49 (95%), Gaps = 2/49 (4%)
Strand=Plus/Plus

Query 1 ACGTCC--GAGACGCGAGCAGCGAGCAGCAGAGCGACGAGCAGCGACGA 47
|||||| |||||||||||||||||||||||||||||||||||||||||
Sbjct 94 ACGTCCGAGAGACGCGAGCAGCGAGCAGCAGAGCGACGAGCAGCGACGA 142
Copyright Notice

BLAST is a Registered Trademark of the National Library of Medicine

Bookshelf ID: NBK279682

Views

Other titles in this collection

Recent Activity

Your browsing activity is empty.

Activity recording is turned off.

Turn recording back on

See more...