This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to change header of fasta file

Hello all, I have the following fasta file, but I want to change the header, please give mea hint, Thanks a lot

>7a11faf04904a091a0150f1de2091c13
GATCGAAGGAATCGGTCCGCCGTCA
>f04f5b529914f21e583996fbe22db642
GGACCTGGCCGGGCGGTCCGCTTTACGGCGTG
...
...
>503af07882c049f957b6a11c7d551400
TTCGAGCTCGACAAGTGGTCTAGGATTTTCCGAGTACTGTCTTGTCGAGCTC

Here is the what I want:

>ASV1
GATCGAAGGAATCGGTCCGCCGTCA
>ASV2
GGACCTGGCCGGGCGGTCCGCTTTACGGCGTG
...

>ASV1008
TTCGAGCTCGACAAGTGGTCTAGGATTTTCCGAGTACTGTCTTGTCGAGCTC
sequence next-gen

What have you tried? bioawk (or even plain awk) should be able to help you with this.

1 answer

awk '/^>/{print ">ASV" ++i; next}{print}' < file.fasta

this one works perfectly for this kind of issue. Thanks for your both @Medhat and @RamRS

Thank you for following up. Please accept your answer so the question is marked as solved.

Thanks for informing me this. Again, thank for your help!

Log in to answer this question.