This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Modify Fasta headers

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?

sequence

1 answer

awk 'BEGIN{counts=1} { if ($0 ~ /^>/)  { print ">protein "counts" [Pseudomonas aeruginosa 19BR]"; counts++ } else { print }}' <input_file>

Log in to answer this question.