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
[email protected]@100.000@10596@0@0@1@10596@1@[email protected]@19568
[email protected]@88.991@109@9@3@5565@5671@6928@[email protected]@132
[email protected]@92.941@85@6@0@5587@5671@135@[email protected]@124
[email protected]@91.860@86@5@2@5587@5671@8552@[email protected]@119
[email protected]@90.588@85@8@0@5587@5671@2214@[email protected]@113
[email protected]@90.476@84@8@0@5587@5670@10559@[email protected]@111
[email protected]@88.889@90@7@3@5587@5675@129@[email protected]@108
[email protected]@89.412@85@9@0@5587@5671@6174@[email protected]@108
[email protected]@100.000@58@0@0@10539@10596@1@[email protected]@108
[email protected]@89.286@84@9@0@5587@5670@681@[email protected]@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
Publication Details
Publication History
Created: June 23, 2008; Last Update: January 7, 2021.
Copyright
BLAST is a Registered Trademark of the National Library of Medicine
Publisher
National Center for Biotechnology Information (US), Bethesda (MD)
NLM Citation
BLAST® Command Line Applications User Manual [Internet]. Bethesda (MD): National Center for Biotechnology Information (US); 2008-. Display BLAST search results with custom output format. 2008 Jun 23 [Updated 2021 Jan 7].