This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to remove certain portion of a description line of a multifasta file?

I have a sequence file having description lines like

>AR_DN39_c0_g1_i1|m.1 AR_DN39_c0_g1_i1|g.1 type:5prime_partial len:209 gc:universal AR_DN39_c0_g1_i1:881-255(-)
RGQELNTFSLPALSSSLEDLFSMVVCSTGNSFSKEVSIRRRIVNIFNKREEDFPSLREYNDYLEEVEDMTFKLVEGIDVPAIEAKIAKYQEENAEQIINNRARKAEEVARSLKEHQEQPATGVANDTGLAQNSQAMGIGQYNPIFMQPRPPGLTQQPVPIGGSNAHSVPEDEATLRQRAERAARAGGWTNELCRKRAFEEAFSSLWVS*

I need to remove everything beyond "|" so tha I can retain only AR_DN39_c0_g1_i1 in the heading.

sed awk

There are plenty of past threads on biostars to do this. Please take some time to search. Use google and not the built in Biostars search.

Hello majeedaasim!

FAQ. Many past threads with answers. There are two usable answers here.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

1 answer

You can do

sed 's/|.*//' file.fasta > newfile.fasta

This will remove everything after |

Log in to answer this question.