Skip to main content

Build Status

yabul

Yet Another Bioinformatics Utilities Library

This is a small collection of Python functions for working with protein, DNA, and RNA sequences. We use pandas data frames wherever possible.

Yabul currently supports:

  • Reading and writing FASTAs
  • Pairwise local and global sequence alignment (uses parasail)

Requires Python 3.6+.

Installation

Install using pip:

$ pip install yabul

You can run the unit from a checkout of the repo as follows:

$ pip install pytest
$ pytest

Example

Reading and writing FASTAs

The read_fasta function returns a pandas.DataFrame:

>>> import yabul
>>> df = yabul.read_fasta("test/data/cov2.fasta")
>>> df.head(3)
                                                             description                                           sequence
id
sp|P0DTC2|SPIKE_SARS2  sp|P0DTC2|SPIKE_SARS2 Spike glycoprotein OS=Se...  MFVFLVLLPLVSSQCVNLTTRTQLPPAYTNSFTRGVYYPDKVFRSS...
sp|P0DTD1|R1AB_SARS2   sp|P0DTD1|R1AB_SARS2 Replicase polyprotein 1ab...  MESLVPGFNEKTHVQLSLPVLQVRDVLVRGFGDSVEEVLSEARQHL...
sp|P0DTC1|R1A_SARS2    sp|P0DTC1|R1A_SARS2 Replicase polyprotein 1a O...  MESLVPGFNEKTHVQLSLPVLQVRDVLVRGFGDSVEEVLSEARQHL...

The write_fasta function takes (name, sequence) pairs:

>>> yabul.write_fasta("out.fasta", [("protein1", "TEST"), ("protein2", "HIHI")])
>>> yabul.write_fasta("out2.fasta", df.sequence.items())

Sequence alignment

The align_pair function will give a local (Smith-Waterman) and global (Needleman-Wunsch) alignment of two sequences. It returns a pandas.Series with the aligned sequences.

By default, the alignment is global:

>>> yabul.align_pair("AATESTDD", "TEST")
query             AATESTDD
reference         --TEST--
correspondence      ||||
score                   -5
dtype: object

To do a local alignment, pass local=True.

>>> yabul.align_pair("AATESTDD", "TEST", local=True)
query             TEST
reference         TEST
correspondence    ||||
score               19
dtype: object

Dependencies

The alignment routine is a thin wrapper around the Smith-Waterman and Needleman-Wunsch implementations from parasail.

Contributing

We welcome contributions of well-documented code to read and write common bioinformatics file formats using pandas objects. Please include unit tests in your PR. Additional functionality like multiple sequence alignment would also be nice to add.

Releasing

To push a new release to PyPI:

  • Make sure the package version specified in __init__.py is a new version greater than what's on PyPI.
  • Tag a new release on GitHub matching this version

Travis should deploy the release to PyPI automatically.

Documentation at https://yabul.readthedocs.io/en/latest/ should update automatically on commit.

To build the documentation locally, run:

$ cd docs
$ pip install -r requirements.txt
$ sphinx-build -b html . _build

Metadata

Release files for yabul 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yabul 0.0.3
File Size Uploaded
yabul-0.0.3.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yabul 0.0.3
File Interpreter ABI Platform
yabul-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / yabul-0.0.3.tar.gz

Download URL yabul-0.0.3.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8c861e3774aa3e192df7d9e1647dc9b3750d29379cf243c5eb1880e6cc17647b
BLAKE2b-256 checksum
How to use checksums
1dba2fda31d15d32b7cb5a612c9331cc3f37a49dc773f2628c5e5c6b54d946bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.10

Release files / yabul-0.0.3-py3-none-any.whl

Download URL yabul-0.0.3-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8de822f38f2ed957038898084aa4f3948ad3228690aace45131e17af257bcf3
BLAKE2b-256 checksum
How to use checksums
01decab054d9d0126707d6a9511d1128b552a5103936a9a7849162a3352ec1fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page