Library for applying haplotypes to reference DNA sequences
Project description
happer
Daniel Standage, 2018
https://github.com/bioforensics/happer
happer is a minimal Python library for generating complete haplotype sequences. Given a reference sequence and haplotype alleles annotated in BED format, happer will mutate the reference and produce sequences to match the specified haplotypes.
Installation
To install:
pip3 install happer
To make sure the package installed correctly:
pip3 install pytest
py.test --pyargs happer
happer requires Python version 3.
Usage
Reference sequences must be provided in Fasta format, and haplotype alleles must be specified in BED format as follows.
Alleles corresponding to different haplotypes at the locus are separated by a |
character, so for example a diploid individual should have 2 |
-separated alleles annotated at each locus, while a tetraploid would have 4 alleles.
In the example below, the CCGA
alleles are phased and represent one haplotype, while the TATG
alleles are phased and represent another haplotype.
#SeqID Start End Alleles
chr1 38827 38828 C|T
chr1 59288 59289 C|A
chr2 24771 24772 G|T
chr4 201191 201192 A|G
To invoke happer from the command line:
[standage@lappy ~]$ happer --out haploseqs.fasta refr.fasta alleles.bed
To invoke happer directly in Python:
>>> import happer
>>> seqfile = open('refr.fasta', 'r')
>>> alleles = open('alleles.bed', 'r')
>>> for label, haploseq in happer.mutate.mutate(seqfile, alleles):
... # do whatever you'd like with the sequences
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 Distribution
File details
Details for the file happer-0.1.0.tar.gz
.
File metadata
- Download URL: happer-0.1.0.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b079dad93b1c0cc39bebd117e77d0535ad3fe8531dad5507635767eddc7678 |
|
MD5 | 46adec0694f376dbf794d5918a79b903 |
|
BLAKE2b-256 | b9fb65a8a5e7d38b91de180f9e0a8680b83b8d3a61f6c1579aba32c1173e1351 |