Skip to main content

Python bindings for nsearch, an efficient BLAST-like sequence comparison algorithm written in C++

Project description


npysearch implements an efficient BLAST-like sequence comparison algorithm, written in C++11 and using native Python datatypes and bindings. npysearch is light-weight, fast, and dependency-free. The code base of npysearch is adapted from nsearch.


from pypi

pip install npysearch

from conda-forge

Installing from the conda-forge channel can be achieved by adding conda-forge to your channes with:

conda config --add channels conda-forge
conda config --set channel_priority strict

You can skip the above step if conda-forge channel has been added already.

Once the conda-forge channel has been enabled, npysearch can be installed with:

conda install npysearch

from github

# Clone repository from github
git clone

# Install package using pip
pip install ./npysearch


# Import npysearch package
import npysearch as npy

# Read query file into a dictionary
query = npy.read_fasta("npysearch/data/query.fasta")

# Read database file into a dictionary
database = npy.read_fasta("npysearch/data/db.fasta")

# BLAST the query against the database
results_dna = npy.blast(query, database)

# BLAST protein sequence file against itself using filenames as blast function arguments

results_prot = npy.blast(query = "npysearch/data/prot.fasta",
                   		 database = "npysearch/data/prot.fasta",
                     	 alphabet = "protein")


  • The blast function automatically detects whether the query and database arguments were passed as string paths to fasta files or as dictionaries of sequences. Both of them need not be input as the same type.
  • Use help(npy) (assuming you've imported npysearch as npy) to get a list of the functions included and their docstrings. For docstrings of specific functions, for example blast, use help(npy.blast)

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

npysearch-1.3.1.tar.gz (38.0 kB view hashes)

Uploaded source

Built Distributions

npysearch-1.3.1-cp310-cp310-win_amd64.whl (137.4 kB view hashes)

Uploaded cp310

npysearch-1.3.1-cp39-cp39-win_amd64.whl (137.4 kB view hashes)

Uploaded cp39

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