Question: how to change the header of input file
1
gravatar for Raghav
5.6 years ago by
Raghav100
Allahabad, India
Raghav100 wrote:

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 out put 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

 

awk sed header fasta file • 1.6k views
ADD COMMENTlink modified 5.6 years ago by JC9.1k • written 5.6 years ago by Raghav100
2
gravatar for Whoknows
5.6 years ago by
Whoknows750
Tehran,Iran
Whoknows750 wrote:

Hi take a look at the

Renaming Entries In A Fasta File

hope it helps,

ADD COMMENTlink modified 5.6 years ago • written 5.6 years ago by Whoknows750
1
gravatar for Alex Reynolds
5.6 years ago by
Alex Reynolds29k
Seattle, WA USA
Alex Reynolds29k wrote:
$ awk 'BEGIN { seqIdx = 0; } { if (/^>/) { print ">chromosome"seqIdx; seqIdx++; } else { print $0; } }' in.fa > out.fa
ADD COMMENTlink modified 5.6 years ago • written 5.6 years ago by Alex Reynolds29k

Dear Sir Alex thank you for your fruitful suggestions.

ADD REPLYlink written 5.6 years ago by Raghav100
1
gravatar for JC
5.6 years ago by
JC9.1k
Mexico
JC9.1k wrote:

Perl One Liner:

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

ADD COMMENTlink written 5.6 years ago by JC9.1k

Dear Sir JC thank you for your fruitful suggestions.

ADD REPLYlink written 5.6 years ago by Raghav100
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2207 users visited in the last hour