Modify chromosome name in fasta file
I have a fasta file with chromosome naming starting with
NW_018085366.1, NW_018085367.1, ..NC_010450.4
and I want to add chr ahead of it.
chrNW_018085366.1, chrNW_018085367.1, ..chrNC_010450.4
I tried to fix but it just rename whole chromosome. Is there a way to ass chr ahead of it. I will be thankful for the suggestion.
• 7,797 views
•
link
2 answers
Using sed
cat genome.fa | sed -r 's/(N[CTW]_[0-9]*)/chr\1/g' > genome.modified.fa
• 0 views
•
link
If you are familiar with command line working environment, then the following command might help you:
perl -lpe '/>(\S+)/ and $_=qq{>chr$1}' in.fa > out.fa
If you want to make this easier, try TBtools with it functions "ID Rename".

• 0 views
•
link
Log in to answer this question.