命令行工具,用于从mrbayes的输出模拟预测数据集。
predsim的Python项目详细描述
predsim是模拟预测的简单命令行工具 来自MrBayes’输出文件的数据集。 数据集可以在gtr+g+i替代模型或任何嵌套的 Bayes先生提供的变体(JC69、HKY85等)。代码包含在 在可以使用python的导入机制导入的单个模块中。 该工具使用Seq-Gen作为 模拟dna序列并构建第三方库 DendroPy。
代码已经用Python3.3和3.6进行了测试。
源存储库:https://github.com/jmenglund/predsim
先决条件
让python在您的计算机上工作的一个简单方法是安装免费的 Anaconda distribution。
安装
对于大多数用户来说,最简单的方法可能是安装最新版本 主持于PyPI:
$ pip install predsim
该项目位于https://github.com/jmenglund/predsim和 也可以使用git安装:
$ git clone https://github.com/jmenglund/predsim.git $ cd predsim $ python setup.py install
您可以考虑安装predsim及其所需的python包 在虚拟环境中,以避免系统混乱 python路径。
用法
$ predsim --help usage: predsim [-h] [-V] [-l N] [-f #A #C #G #T] [-g N] [-s N] [-n N] [-o {nexus,phylip}] [-p FILE] [--seeds-file FILE] [--commands-file FILE] [--trees-file FILE] pfile tfile A command-line utility that reads posterior output of MrBayes and simulates predictive datasets with Seq-Gen. positional arguments: pfile path to a MrBayes p-file tfile path to a MrBayes t-file optional arguments: -h, --help show this help message and exit -V, --version show program's version number and exit -l N, --length N sequence lenght (default: 1000) -f #A #C #G #T, --freqs #A #C #G #T base frequences (overrides any base frequences in MrBayes' output) -g N, --gamma-cats N number of gamma rate categories (default: continuous) -s N, --skip N number of records (trees) to skip at the beginning of the sample (default: 0) -n N, --num-records N number of records (trees) to use in the simulation -o {nexus,phylip}, --out-format {nexus,phylip} output format (default: "nexus") -p FILE, --seqgen-path FILE path to a Seq-Gen executable (default: "seq-gen") --seeds-file FILE path to file with seed numbers (e.g. for debugging purposes) --commands-file FILE path to output file with commands used by Seq-Gen --trees-file FILE path to output file with trees used by Seq-Gen
- 如果mrbayes的输出中缺少基频,则必须手动设置这些基频 使用-f(或--freqs)标志。
- 建议您使用--commands-file和--trees-file 用于检查给定给seq-gen的输入的标志。
运行测试
使用pytest:
进行测试$ pytest test_predsim.py
可以使用以下命令使用Coverage.py计算测试覆盖率:
$ coverage run -m pytest test_predsim.py $ coverage report -m predsim.py
代码遵循PEP 8中的样式约定,可以检查 使用pycodestyle:
$ pycodestyle predsim.py test_predsim.py setup.py
许可证
predsim分布在 MIT license。
引用
如果你在科学研究中使用这个包产生的结果 出版物,请在文中注明包装名称 引用这个项目的zenodo doi:
您可以在“引用为”部分中选择您喜欢的引用样式 在Zenodo页面上。
predsim依赖于其他也应该被引用的软件。下面是 Seq Gen和Dendropy的建议引用:
- 兰巴特A,北卡罗来纳州格拉斯利。1997年。Seq Gen:Monte的申请 进化树dna序列进化的carlo模拟。 计算。申请。比奥西。13:235-238。内政部: 10.1093/bioinformatics/13.3.235
- Sukumaran J,持有人2010年。dendropy:python库 系统进化计算。生物信息学26:1569–1571。内政部: 10.1093/bioinformatics/btq228