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
Close
Hashes for alignmentrs-0.9.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26625d18107baf620a6e7f76384a092d7526b66c56487f5aed2d5bde83b12cfd |
|
MD5 | 11de586fc710a9bb8c690dcd6668459a |
|
BLAKE2b-256 | 5631f12e65163a7530f385c3cd399770e93eb3e752cc9154dd9ab4090133af77 |
Close
Hashes for alignmentrs-0.9.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 476ed6d3ef40023efef3dc5d134f2fe89c5c41fadf411e502d633e10dc43ff40 |
|
MD5 | 00a753b00efcca3dce82db68a69751fb |
|
BLAKE2b-256 | cb2b1bafcf86da63f8f46513c537cc550a051d5846649d4ba0229294fd6f8526 |
Close
Hashes for alignmentrs-0.9.0-cp35-cp35m-macosx_10_5_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268a327d9e1db42c0e606b5b76f4e075e42285a61e2adb9889e7c8b57db88bb3 |
|
MD5 | a6f935fac1b1ac4668cde82908c1474f |
|
BLAKE2b-256 | 645467e4dbccdd96571885ded23abdb0e59d1bd174ce657f54adb64472146d52 |