Question: Question: Blastp -- Add header on output file
0
gravatar for ouyaqing
3.3 years ago by
ouyaqing0
ouyaqing0 wrote:

Hi,

I've been using the blast (2.3.0) against a protein database via:

blastp -query 1.fasta -db 1.fasta -evalue 1e-5 -seg yes -soft_masking true -max_target_seqs 5000 -outfmt "7 qseqid sseqid evalue pident bitscore qstart qend qlen sstart send slen" -out 2.fasta.blastp

and the head of output fine is

# BLASTP 2.3.0+
# Query: 1
# Database: 1.fasta
# Fields: query id, subject id, evalue, % identity, bit score, q. start, q. end, query length, s. star
t, s. end, subject length
# 64 hits found
1   1   0.0 100.000 629 1   300 300 1   300 300
1   2   0.0 94.667  597 1   300 300 1   300 300
1   3   0.0 92.667  588 1   300 300 1   300 300
1   4   0.0 91.667  579 1   300 300 1   300 300
1   6   0.0 89.667  567 1   300 300 1   300 300
1   8   0.0 89.333  561 1   300 300 1   300 300
1   7   0.0 88.333  558 1   300 300 1   300 300
1   5   0.0 88.333  556 1   300 300 1   300 300
1   16  0.0 84.333  538 1   300 300 1   300 300
1   13  0.0 83.667  536 1   300 300 1   300 300

How can I directly insert the headline into the tabular? To make it show as follows:

query id   subject id   evalue   % identity   bit score    q. start   q. end   query length   s. start   s. end   subject length
1   1   0.0 100.000 629 1   300 300 1   300 300
1   2   0.0 94.667  597 1   300 300 1   300 300
1   3   0.0 92.667  588 1   300 300 1   300 300
1   4   0.0 91.667  579 1   300 300 1   300 300

Thanks!!!!!!

Sera

blast • 1.4k views
ADD COMMENTlink written 3.3 years ago by ouyaqing0

The header line you want is already there so you could remove the other lines that you don't want (untested, save an original copy before trying on a file, if using in OS X see note here)

$ sed -e '1,3d;5d' file | sed -e 's/# Fields:\ //' -e 's+,+\t+g' > new_file
ADD REPLYlink modified 3.3 years ago • written 3.3 years ago by genomax71k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1164 users visited in the last hour