Skip to main content

A simple library for executing BLAST searches with ncbi-blast+

Project description

simple_blast

This is a library that provides a very basic wrapper around ncbi-blast+. Currently, the library supports searches with blastn only, but I may expand the library to include wrappers for other BLAST executables if I need them.

Requirements

This library depends on Pandas for parsing BLAST output. The library has been tested with Pandas 1.5.3, but it likely works with other versions.

Of course, this library assumes that ncbi-blast+ is installed. The library has been tested with ncbi-blast 2.12.0+, and it likely works with newer versions of the software as well.

Basic usage

You can define a blastn search to be carried out using the BlastnSearch class. BlastnSearchobjects are constructed with two required arguments—the subject sequence and the query sequence files, in that order. For example, to set up a balstn search for sequences in seqs1.fasta against those in seqs2.fasta, you could construct a BlastnSearch object like this:

from simple_blast import BlastnSearch

search = BlastnSearch("seqs2.fasta", "seqs1.fasta")

The BLAST search is not carried out until you ask for the results by accessing the hits property of the search. This property returns a Pandas dataframe containing the HSPs identified in the BLAST search.

results = search.hits

The columns in the output may be configured by passing either the out_columns or additional_columns arguments when constructing the BlastnSearch. The former argument overrides the set of output columns; the latter argument is added to the list of default output columns.

You can also specify an e-value cutoff through the evalue argument.

DB caches

When the same sequence file is used as a subject in multiple searches, it can be efficient to build a BLAST database up front. The BlastDBCache class can be used to handle this mostly automatically. To make a BlastDBCache, you need to specify the location of the on the file system.

from simple_blast import BlastDBCache

cache = BlastDBCache("cache_dir")

To add a file to the cache, use the makedb method.

cache.makedb("seqs2.fasta")

When constructing a BlastnSearch object, give it the BlastDBCache as the db_cache parameter to make the BlastnSearch object use the cache for searches.

search = BlastnSearch("seqs2.fasta", "seqs1.fasta", db_cache=cache)

Now search will use the database we created for seqs2.fasta.

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

simple_blast-0.1.4.tar.gz (54.0 kB view details)

Uploaded Source

Built Distribution

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

simple_blast-0.1.4-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file simple_blast-0.1.4.tar.gz.

File metadata

  • Download URL: simple_blast-0.1.4.tar.gz
  • Upload date:
  • Size: 54.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for simple_blast-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7a75f3583af932eed18db5dfac828c6b45e556038f3775ec6d7e1a336e39d464
MD5 074942e69f40322b056842ae693a78dc
BLAKE2b-256 f1ae50faa9eb26fdf90dccf4fcc6b04391e7c19373df79685391e617edeb2747

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_blast-0.1.4.tar.gz:

Publisher: package.yml on actapia/simple_blast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_blast-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: simple_blast-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for simple_blast-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 49d34e544d97547806c81ff8f8ad74cd17baa90a7833479831ba650ef8b692c6
MD5 200dad7287f6be897e2aabe251179340
BLAKE2b-256 d081368d8b2c7fce37b91d0aaebd872f2bdc18b805892156a3ce6b8eeeda3333

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_blast-0.1.4-py3-none-any.whl:

Publisher: package.yml on actapia/simple_blast

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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