← All tools

any2fasta

Popularity 85 Updated Development & Build

Convert various sequence formats to FASTA

homebrewauto-collected

Installation

Homebrew
brew install any2fasta

Install with Homebrew.

[](https://anaconda.org/bioconda/any2fasta)

any2fasta

Convert various sequence formats to FASTA

Quick start

% conda install -c bioconda any2fasta
% any2fasta genome.gbk > genome.fasta
% any2fasta seq.gbk.gz > seq.fasta
% any2fasta protein.pdb.bz2 > protein.fasta

Motivation

You may wonder why this tool even exists. Well, I tried to do the right thing and use established tools like readseq and seqret from EMBOSS, but they both mangled IDs containing | or . characters, and there is no way to fix this behaviour. This resulted in inconsitences between my .gbk and .fna versions of files in my pipelines.

Then you may wonder why I didn't use Bioperl or Biopython. Well they are heavyweight libraries, and actually very slow at parsing Genbank files. This script uses only core Perl modules, has no other dependencies, and runs very quickly.

It supports the following input formats:

  • Genbank flat file, typically .gb, .gbk, .gbff (starts with LOCUS)
  • EMBL flat file, typically .embl, (starts with ID)
  • GFF with sequence, typically .gff, .gff3 (starts with ##gff)
  • FASTA DNA, typically .fasta, .fa, .fna, .ffn (starts with )
  • FASTQ DNA, typically .fastq, .fq (starts with @)
  • CLUSTAL alignments, typically .clw, .clu (starts with CLUSTAL or MUSCLE)
  • STOCKHOLM alignments, typically .sth (starts with # STOCKHOLM)
  • GFA assembly graph, typically .gfa (starts with ^[A-Z]\t)
  • PDB protein data bank structure, typicall .pdb (starts with ^HEADER)

Files may be compressed with:

  • gzip, typically .gz
  • bzip2, typically .bz2
  • zip, typically .zip

plus any other formats supported by your installed version of Perl's IO::Uncompress::AnyUncompress module.

Installation

any2fasta has no dependencies except Perl 5.10 or higher. It only uses core modules, so no CPAN needed.

Conda

% conda install -c bioconda any2fasta