Skip to main content

alignmentrs

Quickly read and manipulate multiple sequence alignments in Python

Installation

pip install alignmentrs

Quickstart

Import alignment into Python

>>> import alignmentrs as rs
>>> aln = rs.Alignment.from_fasta('hiv.fna', 'HIV_alignment')
>>> aln
Alignment(nsamples=10, nsites=120, nmarkers=0)
>>> aln.sample_ids
['sample01', 'sample02', 'sample03', 'sample04', 'sample05', 'sample06'
 'sample07', 'sample08', 'sample09', 'sample10']

Select sites to remove from the alignment

>>> sites_to_remove = [i for i in range(120) if (i-2) % 3 != 0]  # remove 1st and 2nd position in codon triplet
>>> aln.remove_sites(sites_to_remove, copy=False)  # manipulate inplace, copy=True returns a new copy
Alignment(nsamples=10, nsites=40, nmarkers=0)

Select sites to retain in the alignment

>>> sites_to_retain = list(range(2, 3, 120))  # third position in codon triplet
>>> aln.retain_sites(sites_to_retain, copy=False)  # manipulate inplace, copy=True returns a new copy
Alignment(nsamples=10, nsites=40, nmarkers=0)

Get a subset of samples and sites

>>> sub_aln = aln.subset(samples=['sample01', 'sample03', 'sample05'], sites=list(range(2, 3, 120)))
>>> sub_aln
Alignment(nsamples=3, nsites=40, nmarkers=0)

License

MIT License

Metadata

Release files for alignmentrs 0.9.0

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

Built distributions (wheels)

Table of built distributions (wheels) for alignmentrs 0.9.0
File Interpreter ABI Platform
alignmentrs-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details
alignmentrs-0.9.0-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details
alignmentrs-0.9.0-cp35-cp35m-macosx_10_5_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.5+ x86-64 Details

Total release size: 11.5 MB

Release files / alignmentrs-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL alignmentrs-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl
Size 5.8 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
26625d18107baf620a6e7f76384a092d7526b66c56487f5aed2d5bde83b12cfd
BLAKE2b-256 checksum
How to use checksums
5631f12e65163a7530f385c3cd399770e93eb3e752cc9154dd9ab4090133af77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.2

Release files / alignmentrs-0.9.0-cp36-cp36m-macosx_10_7_x86_64.whl

Download URL alignmentrs-0.9.0-cp36-cp36m-macosx_10_7_x86_64.whl
Size 3.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
476ed6d3ef40023efef3dc5d134f2fe89c5c41fadf411e502d633e10dc43ff40
BLAKE2b-256 checksum
How to use checksums
cb2b1bafcf86da63f8f46513c537cc550a051d5846649d4ba0229294fd6f8526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.2

Release files / alignmentrs-0.9.0-cp35-cp35m-macosx_10_5_x86_64.whl

Download URL alignmentrs-0.9.0-cp35-cp35m-macosx_10_5_x86_64.whl
Size 1.9 MB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.5+ x86-64
SHA-256 checksum
How to use checksums
268a327d9e1db42c0e606b5b76f4e075e42285a61e2adb9889e7c8b57db88bb3
BLAKE2b-256 checksum
How to use checksums
645467e4dbccdd96571885ded23abdb0e59d1bd174ce657f54adb64472146d52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.2

Security for alignmentrs 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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