Thank you very much! It helped me to solve the issue.
Modify Fasta header
Hello
I have a fasta file with amino acids sequences, which was translated from nucleotide sequence by transeq.
>CE99543_15407_1
MAV.....
>CE99641_51257_1
MSQ......
I want to delete _1 at the end of fasta header because it was somehow added by transeq.
>CE99543_15407
MAV.....
>CE99641_51257
MSQ......
Just deleting _1 would not work because there are headers including _1 in the middle.
Could you please tell me how to do it?
Thank you very much for your help.
• 1,902 views
•
link
2 answers
sed 's/_1$//'
• 0 views
•
link
• 0 views
•
link
You need to add end-of-line character \n to the replace command to make sure that _1 found anywhere else is not replaced.
perl -pi -e 's/_1\n/\n/g' input_file
• 0 views
•
link
Log in to answer this question.