Modify Fasta header
1
0
Entering edit mode
9.0 years ago
utkarsh.sood ▴ 40

Hello

I have a fasta file with sequence headers written as

>0|quiver|1..2075|-
>0|quiver|2210..3058|-
>0|quiver|3112..4169|-

and so on till around 1000 sequences. I want to modify these as

>1|quiver_1|1..2075|-
>2|quiver_2|2210..3058|-
>3|quiver_3|3112..4169|-

and so on. Please help

sequence fasta • 1.9k views
ADD COMMENT
3
Entering edit mode
9.0 years ago
awk -F '|' '/>/ {i++;printf(">%d|%s_%d|%s|%s\n",i,$2,i,$3,$4,$5);next;} {print;}' input.fa
ADD COMMENT
0
Entering edit mode

Thanks for your help!

I also have one more query, please solve it.

can I modify the following headers

>gi|392981410|ref|NC_018080|pseudocap|273_483_2027_+
>gi|392981410|ref|NC_018080|pseudocap|273_2056_3159_+

so on

to

>protein 1 [Pseudomonas aeruginosa 19BR]
>protien 2 [Pseudomonas aeruginosa 19BR]

so on

thanks!

ADD REPLY
0
Entering edit mode

ask this as a new question + show us what you have already tried.

ADD REPLY

Login before adding your answer.

Traffic: 2172 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6