This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trim fasta sequence names

Dear all,

I have bunch of fasta files with following sequence names format:

>gi|113476179|ref|YP_722240.1| hypothetical protein Tery_2568 [Trichodesmium erythraeum IMS101]

Do you have any script, which would help me to change it to something like this:

>Trichodesmium erythraeum IMS101

Thank you in advance!

Petr

fasta

1 answer

cat input.txt | sed 's/.*\[/>/' | sed 's/\]//'

It did exactly, what I needed. Thank you Noolean!

Glad to help! Please also upvote my answer by clicking on the thumbs up green icon:)

Log in to answer this question.