Hi,
I have mutiple fasta file and I want to change the header, for this I am using -
awk '/^>/{print ">C1_" ++i; next}{print}' C1_pandaseq.fasta > C1_pandaseq_new.fasta
input fasta-
>M03419:60:656544:1:1101:25150:3877:1
CCTACGGGTGGCTGCAGTGGGGAATTTTGGACAA
>M03419:60:656544:1:1101:8498:4267:1
ACTACGGGAGGCAGCAGGGGGGAATTTTGGACAATGGAAACCAGGG
>M03419:60:656544:1:1101:7884:4445:1
CCTACGGGTGGCAGCAGTGGGGAATATTGGACAATGCAACCCTGATCCAGC
output fasta-
>C1_1
CCTACGGGTGGCTGCAGTGGGGAATTTTGGACAAAAAAAAAAAAAAAA
>C1_2
ACTACGGGAGGCAGCAGGGGGGAATTTTGGACAATGGAAACCAGGG
>C1_3
CCTACGGGTGGCAGCAGTGGGGAATATTGGACAATGCAACCCTGATCCAGC
Similarly i have mutiple fasta file, which looks like-
C2_pandaseq.fasta
C4_pandaseq.fasta
C5_pandaseq.fasta
C8_pandaseq.fasta
T2_pandaseq.fasta
T7_pandaseq.fasta
So I need to rename all the fasta file header, e.g.,
for fasta file C2_pandaseq.fasta
>C2_1
AAAAAAAAAAAAAAAAAAAAAAA
>C2_2
ATTTTGGGGGGGGCCCCCCCGGGGGGGA
for fasta file C4_pandaseq.fasta
>C4_1
AAAAAAAAAAAAAAAAAAAAAAA
>C4_2
ATTTTGGGGGGGGCCCCCCCGGGGGGGA
and so on...
For each fasta file, i need to rename fasta header according to the file name only. Therefore, I need to write a for loop for this, but i dont know how can i do that.
Any help. Thanks
Hello bioinformaticssrm2011!
It appears that your post has been cross-posted to another site: http://seqanswers.com/forums/showthread.php?t=74234
This is typically not recommended as it runs the risk of annoying people in both communities.
I understand, but I was not able to use the script mentioned there for my work. Though I appreciate there help.