Renaming Fasta ID's according to their number and on specific string length
1
0
Entering edit mode
4.2 years ago

Hi all,

I have a question about renaming my sequences in fasta format. I have 36,008 nucl. sequences and I need (want) rename them according to the following form. For every sequence, after > mark should follow string E_nip_trans_ (for all sequences) and after this I want place only digit string with length five, growing by one (from 00001 to 36008). But I don't have any idea how to do it.

>E_nip_trans_00001
>E_nip_trans_00002
>E_nip_trans_00003
> ...
>E_nip_trans_00010
> 
> ...
>E_nip_trans_00111  
> 
> ...
>E_nip_trans_36008

Thank you for reply!

sequence • 1.2k views
ADD COMMENT
2
Entering edit mode
4.2 years ago
cschu181 ★ 2.6k
awk '/^>/ {printf("%05i\n",i+1); i+=1; next;} {print $0;}' /path/to/your/fasta/file
ADD COMMENT
0
Entering edit mode

Thank you very much. It's work fine.

ADD REPLY
0
Entering edit mode

If this answer was helpful it is appropriate to upvote it, and if this answer resolved your question completely you can 'accept' the answer, as such marking your question as solved.

ADD REPLY

Login before adding your answer.

Traffic: 1661 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6