This is a test version of Biostars. For the public version, visit https://www.biostars.org.
modify header of sequencs in fasta 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.

>NV_000007.1 very long-chain specific acyl-CoA dehydrogenase, mitochondrial isoform 1 precursor [Homo sapiens]
MQAARMAASLGRQLLRLGGGSSRLTALLGQPRPGPARRPYAGGAAQLALDKSDSHPSDALTRKKPAKAES

Result should be like below:

>sp|NV_000007.1|very long-chain specific acyl-CoA dehydrogenase, mitochondrial isoform 1 precursor [Homo sapiens]
MQAARMAASLGRQLLRLGGGSSRLTALLGQPRPGPARRPYAGGAAQLALDKSDSHPSDALTRKKPAKAES
sequencing

1 answer

sed 's/^>/>sp|/;/^>/s/ /|/'

Log in to answer this question.