Quickly read and manipulate multiple sequence alignments in Python
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
File details
Details for the file alignmentrs-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: alignmentrs-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.7m, macOS 10.7+ x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26625d18107baf620a6e7f76384a092d7526b66c56487f5aed2d5bde83b12cfd |
|
MD5 | 11de586fc710a9bb8c690dcd6668459a |
|
BLAKE2b-256 | 5631f12e65163a7530f385c3cd399770e93eb3e752cc9154dd9ab4090133af77 |
File details
Details for the file alignmentrs-0.9.0-cp36-cp36m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: alignmentrs-0.9.0-cp36-cp36m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.6m, macOS 10.7+ x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 476ed6d3ef40023efef3dc5d134f2fe89c5c41fadf411e502d633e10dc43ff40 |
|
MD5 | 00a753b00efcca3dce82db68a69751fb |
|
BLAKE2b-256 | cb2b1bafcf86da63f8f46513c537cc550a051d5846649d4ba0229294fd6f8526 |
File details
Details for the file alignmentrs-0.9.0-cp35-cp35m-macosx_10_5_x86_64.whl
.
File metadata
- Download URL: alignmentrs-0.9.0-cp35-cp35m-macosx_10_5_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.5m, macOS 10.5+ x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268a327d9e1db42c0e606b5b76f4e075e42285a61e2adb9889e7c8b57db88bb3 |
|
MD5 | a6f935fac1b1ac4668cde82908c1474f |
|
BLAKE2b-256 | 645467e4dbccdd96571885ded23abdb0e59d1bd174ce657f54adb64472146d52 |