how to change the header of input file
3
1
Entering edit mode
9.1 years ago
Raghav ▴ 100

I have a fasta file input, I want change the header in my way like

>AGP1
AAAAAAAAAAAACTCAAAAG
>CRK25
AAAAAAAAAAAACTTTGAACTTGCTT
AT5G27080
AAAAAAAAAAAAGAAAGAA
>AT1G12620
AAAAAAAAAAACAAATT

I want output in this way

>chromosome1
AAAAAAAAAAAACTCAAAAG
>chromosome2
AAAAAAAAAAAACTTTGAACTTGCTT

change all the header in input file with chromosome

and chromosome number like chromosome1 , chromosome2... is equal to number of headers present in input file.

is there way to resolve this problem by using sed awk or shell script?

please suggest me

thank you in advance

fasta awk sed • 2.4k views
ADD COMMENT
2
Entering edit mode
9.1 years ago
Whoknows ▴ 960

Hi take a look at the

Renaming Entries In A Fasta File

hope it helps,

ADD COMMENT
1
Entering edit mode
9.1 years ago
$ awk 'BEGIN { seqIdx = 0; } { if (/^>/) { print ">chromosome"seqIdx; seqIdx++; } else { print $0; } }' in.fa > out.fa
ADD COMMENT
0
Entering edit mode

Dear Sir Alex thank you for your fruitful suggestions.

ADD REPLY
1
Entering edit mode
9.1 years ago
JC 13k

Perl One Liner:

perl -nle '(/>/) ? print ">chromosome" . ++$n : print' < FileIn.fa > FileOut.fa

ADD COMMENT
0
Entering edit mode

Dear Sir JC thank you for your fruitful suggestions.

ADD REPLY

Login before adding your answer.

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