How To Rename FASTA Headers
1
0
Entering edit mode
2.7 years ago
kari_vo3 • 0

Hello, i want to change the fasta header of this input file :

>M04631:312:000000000-C6V6K:1:2107:11495:1734 1:N:0:ACTGAGCG+TTATGCGA

>M04631:312:000000000-C6V6K:1:2107:13059:1785 1:N:0:ACTGAGCG+TTATGCGA

In this fasta header:

>adjH001

>adjH002

>adjH....

>adjH099

>adjH100

what script do I have to use??

next-gen • 1.3k views
ADD COMMENT
0
Entering edit mode

Looks like you have MiSeq data, please provide the actual context about what you're doing. It should include the words "MiSeq" and "fastq". It's highly unlikely that your actual question will end up actually renaming fasta entries.

ADD REPLY
0
Entering edit mode

You need to explain your naming convention further. There’s no information in those headers to generate what you’re asking for.

If you just want all the sequences named adjH followed by some number, how high should these numbers go? How many sequences do you have? Since you want them 0-padded this matters.

Are the names arbitrary in order?

ADD REPLY
0
Entering edit mode

i have 300000 reads and then i'll renamed them to a metagenomic analysis :

ADD REPLY
0
Entering edit mode

renamed them to a metagenomic analysis

That's not clear. We still don't know where the adjH001 identifiers are based on.

ADD REPLY
0
Entering edit mode

You need to tell us how:

>adjH001 pairs with >M04631:312:000000000-C6V6K:1:2107:11495:1734 1:N:0:ACTGAGCG+TTATGCGA

or any other sequence. Is it purely based on the order in which they occur?

ADD REPLY
0
Entering edit mode

You may be interested in SEDA (https://www.sing-group.org/seda/), a user-friendly GUI-based tool with a powerful option to rename FASTA headers (https://www.sing-group.org/seda/manual/operations.html#rename-header).

ADD REPLY
4
Entering edit mode
2.7 years ago
5heikki 10.0k
awk 'BEGIN{N=1;S=">adjH"}{if(/^>/){printf("%s%03d\n",S,N);N++}else{print $0}}' in.fa > out.fa
ADD COMMENT
0
Entering edit mode

Thank you!!!!!. It works.

ADD REPLY
0
Entering edit mode

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

ADD REPLY

Login before adding your answer.

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