• 0 views
•
link
sequence renaming
I have a fasta file how to rename the sequence according to the name of the file, for example, the sequence name in the gene.fasta file is >1, >2, renamed >gene1, gene2. Thank you very much for telling me
• 1,473 views
•
link
2 answers
Using Linux (any flavour), Unix (OSX)
perl -pi -e 's/^(>[0-9])+.*/\1gene/g' myfile.fa
myfile.fa
>1
AGTC
>2
AGTC
>3
AGTC
output
>1gene
AGTC
>2gene
AGTC
>3gene
AGTC
Its called perl pie (one liner) and is extremely quick at handling massive files. Happy to explain the reg-ex if needed. It will change the file in situ so there's not needed to pipe it, or make a copy, the -i takes care of that.
• 0 views
•
link
Log in to answer this question.