This is a test version of Biostars. For the public version, visit https://www.biostars.org.
modify header of sequences file

Hello everybody, I am not and expert with sed and I am sure that someone will do this work faster and better than me.

I would like to edit multiple fasta header from this format.

input file :

 >sp|O35215|DOPD_MOUSE D-dopachrome decarboxylase OS=Mus musculus GN=Ddt PE=1 SV=3
MPFVELETNLPASRIPAGLENRLCAATATILDKPEDRVSVTIRPGMTLLMNKSTEPCAHL
LVSSIGVVGTAEQNRTHSASFFKFLTEELSLDQDRIVIRFFPLEAWQIGKKGTVMTFL

Result should be like below:

>O35215 DOPD_MOUSE D-dopachrome decarboxylase OS=Mus musculus GN=Ddt PE=1 SV=3
MPFVELETNLPASRIPAGLENRLCAATATILDKPEDRVSVTIRPGMTLLMNKSTEPCAHL
LVSSIGVVGTAEQNRTHSASFFKFLTEELSLDQDRIVIRFFPLEAWQIGKKGTVMTFL
sequencing

1 answer

`sed 's/^>[^|]*|/>/;/^>/s/|/ /g'` in.fasta

Log in to answer this question.