将单倍型应用于参考DNA序列的库
项目描述
happer
Daniel Standage, 2018
https://github.com/bioforensics/happer
happer是一个用于生成完整单倍型序列的最小Python库。给定一个参考序列和以BED格式注释的单倍型等位基因,happer将变异参考序列并生成与指定单倍型匹配的序列。
安装
要安装
pip3 install happer
为确保软件包安装正确
pip3 install pytest
py.test --pyargs happer
happer需要Python版本3。
用法
参考序列必须以Fasta格式提供,而单倍型等位基因必须按以下方式以BED格式指定。位于位点的不同单倍型的等位基因由一个|
字符分隔,因此例如二倍体个体应在每个位点有2个|
分隔的等位基因注释,而四倍体应具有4个等位基因。在下面的示例中,CCGA
等位基因是相位的,代表一个单倍型,而TATG
等位基因是相位的,代表另一个单倍型。
#SeqID Start End Alleles
chr1 38827 38828 C|T
chr1 59288 59289 C|A
chr2 24771 24772 G|T
chr4 201191 201192 A|G
从命令行调用happer
[standage@lappy ~]$ happer --out haploseqs.fasta refr.fasta alleles.bed
直接在Python中调用happer
>>> 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