A Python script for renaming fasta file headers using regex pattern matching.
curl https://raw.githubusercontent.com/CSynodinos/rename-fasta-headers/master/header_renamer.py -o header_renamer.py
1) Biopython
2) Pandas
This fasta header renaming script works by looking for a pattern in every header of the .fasta file. Once found, it switches the id and description of that header according to a specified id and description respectively. The pattern to find, new id and new description are specified with a .csv file that has the following structure:
pattern,new_id,new_description
header,foo,bar
header2,foo2,bar2
. . .
>>> python3 header_renamer.py -i yourfasta.fasta -cv patterns.csv
For more information regarding all the options available:
>>> python3 header_renamer.py -h
-
Input file format to rename:
- .fasta
-
Input pattern file format:
- .csv