Skip to main content

Grep-like tool for retrieving matching sequence records from a FASTA file

Project description

Better FASTA Grep

BFG logo - a pair of binoculars

Better FASTA Grep, or BFG for short, is a Grep-like utility for retrieving matching sequence records from a FASTA file. Given one or more patterns and a FASTA file, it searches the file for matching headers and or sequences and outputs any matching headers, sequences, or both.

Features

  • Search headers, sequences, or both
  • Search via regular expressions or plain strings
  • Case-insensitive search
  • Select non-matching sequence records
  • Count the number of matches
  • Display line numbers in the result
  • Sequence records, not individual lines, are selected
  • Multi-line sequences are treated as singular units
  • Flexible output options: output headers, sequences, or both
BFG Screenshot

A screenshot of running BFG under macOS Mojave.

Quick installation

Download the script onto your computer by clicking the 'Download' button on this page, or use git to copy the bfg project into your current directory:

git clone https://github.com/fethalen/better_fasta_grep

Make the script executable by typing chmod +x bfg, while in the bfg directory. bfg can now be run by typing the following command.

./bfg --help

If you see yourself using this tool frequently, then you can add it to your path, so that you can reference it from any working directory. First, put the bfg directory into a permanent location (not your Desktop or Downloads folder). I keep my copy of bfg in my ~/projects directory, so for me I would type:

export PATH=$PATH:${HOME}/projects/bfg >> ~/.bashrc

Documentation

  1. Introduction
  2. Installation
  3. Invoking bfg
  4. Regular Expressions
  5. Input Data
  6. Usage

© Department for Animal Evolution and Biodiversity 2019

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better_fasta_grep-1.0.1.tar.gz (148.5 kB view hashes)

Uploaded Source

Built Distribution

better_fasta_grep-1.0.1-py3-none-any.whl (20.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page