Skip to main content

Provides tools to extract nucleotide sequences from a genome using NCBI BLAST

Project description

Blast-Extract

Extract subsequences from a genome using NCBI BLAST and reference sequences.

Minimal usage:

extract-sequences --references references.fasta genome.fasta > extracted.fasta

Installation

Requirements:

The BLAST bin directory must be added to the PATH.

Install the package using pip. This will also create the entry point scripts to use the commands as described below.

pip install blast-extract

Usage

All commands can use STDIN and STDOUT, so can be chained using pipes (|) on UNIX-like systems.

cat genome.fasta | extract-sequences --references references.fasta | hash-sequences > seqhashes.tsv

Commands

extract-sequences

The extract-sequences command extracts nucleotide sequences from an input (multi-)FASTA file. It requires a multi-FASTA file with references to search for. Its output is a multi-FASTA whose headers start with the identifier of the corresponding matched reference.

The script will by default normalize and extend the BLAST results so they are in the same strand as the reference and cover as much of the reference as possible. This is an important improvement over using solely BLAST, as its score optimization may drop nucleotides at the outer ends of the alignment.

Behind the scenes, a BLAST nucleotides database will be created, by default in the current working directory. You can specify a different directory for the databases with --dbdir. The derived BLAST database will be updated if needed, by comparing the last modification time of the files. Each reference filepath will generate a uniquely named database, so can be used in conjunction.

There are two filter options: --pident (default 80.0) for minimum percentage identity, and --pcov (default 80.0) for minimum percentage coverage. By nature of using BLAST, less strict settings will increase the likelyhood of false-negatives: when a subsequence may exist that satisfies the filters, but due to BLAST heuristics was not found. The underlying blastn call will actually use a slightly lower percentage identity threshold and no coverage requirement. Both are checked by the python script after post-BLAST corrections.

hash-sequences

The hash-sequences command is used to get hash values for each sequence in an input multi-FASTA file. You may choose any of the algorithms available to your python installation, which will be listed if you give an invalid value. It is recommended to stick to the defaults unless needed for compatibility with other tools or organisations. The output uses TSV format, with the first column containing the sequence name and the second containing the generated sequence hash.


Copyright (C) Jan Deneweth 2022

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

blast-extract-0.1.0.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blast_extract-0.1.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file blast-extract-0.1.0.tar.gz.

File metadata

  • Download URL: blast-extract-0.1.0.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.0

File hashes

Hashes for blast-extract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 742bd41d6c3b6e4267b5e1ece528fe206eac36b246b62d6b53258ddd9e0e0b40
MD5 88d46164b6c66c4ba74319fb7e46239d
BLAKE2b-256 11222a0dffa382e0429c2f3706d8d14156d637a7e2a969a24d74bc91546add46

See more details on using hashes here.

File details

Details for the file blast_extract-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: blast_extract-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.0

File hashes

Hashes for blast_extract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd76058ecc50a784c09fb0ac32a08c81b448850e24422290d8175807009cc4a1
MD5 859b94747957c0650190b36ea4c921bf
BLAKE2b-256 24aa7466f7eb53948ad4a313fd369d80d45e6b6fcaa835362cfdfca39bf91642

See more details on using hashes here.

Supported by

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