incrementing and renaming fasta header
1
0
Entering edit mode
3 days ago
sunilthorat ▴ 30

I have multiple fasta files like:

>TestSample1/India/Jan/2021 
CAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTGTC ACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGA

>TestSample2/India/Jan/2021 
CAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTGTC ACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGA

I want to rename the header like this:

>ABCD_0001 
CAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTGTC ACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGA

>ABCD_0001 
CAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTGTC ACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGA

I used this code which didnt worked, It says - You are not permitted to execute this command. Contact the systems administrator for further assistance.

ls *.fas       | rush 'cat {} | seqkit replace -p ".+" -r "{^.fas}_{nr}" > {.}.fas'
and headers renaming incrementing fasta • 132 views
ADD COMMENT
1
Entering edit mode

Both the sequences have same header /ID. That would be confusing. There is also a gap (empty space) in sequences, which is not expected. Try this:

$ seqkit -w 0 replace -p ".*" -r 'seq_{nr}' test.fa
ADD REPLY
1
Entering edit mode
ADD COMMENT

Login before adding your answer.

Traffic: 1014 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