Skip to content

CSynodinos/rename-fasta-headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

header_renamer

A Python script for renaming fasta file headers using regex pattern matching.

Authors

CSynodinos

Installation

  curl https://raw.githubusercontent.com/CSynodinos/rename-fasta-headers/master/header_renamer.py -o header_renamer.py

Dependencies

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
                                                    .   .   .

Example

    >>> python3 header_renamer.py -i yourfasta.fasta -cv patterns.csv  

For more information regarding all the options available:

    >>> python3 header_renamer.py -h

Features

  • Input file format to rename:

    • .fasta
  • Input pattern file format:

    • .csv