通过PAML中的CODEML模块计算dnds的过程以及踩坑
最近帮女朋友做毕业设计的时候用到了 PAML这个软件的codeml功能,发现网上相关的资料很少,于是把自己踩的一些坑分享一下,希望能帮到其他有相同困难的人
一、下载与安装
PAML软件下载地址
http://abacus.gene.ucl.ac.uk/software/paml4.9j.tgz
DAMBE软件下载地址
http://dambe.bio.uottawa.ca/DAMBE/dambe_install_win.aspx
二、使用方法
首先准备好你的fas文件
我们需要将fas文件转换一下格式,方法很多,我这边说两种方法,这两种方法最后得到的文件内容完全相同,只是后缀名不同
方法一:
使用python脚本转换
将你的*.fas文件与脚本放在同一目录下,执行脚本,会生成一个.phy文件
import re
with open('seven.fas', 'r') as fin:
sequences = [(m.group(), ''.join(m.group().split()))
for m in re.finditer(r'(?m)^>([^ \n]+)[^\n]*([^>]*)', fin.read())]
with open('seven.phy', 'w') as fout:
fout.write('%d %d\n' % (len(sequences), len(sequences[][])))
for item in sequences:
fout.write('%-20s %s\n' % item)
方法二:
使用DAMBE软件转换格式
1.打开DAMBE,选择 File -> Open standard sequence file -> 文件类型选择为包含 fas 类型 -> 选择你的fas文件

2.点击 go

3.点击 File -> save or convert sequence format -> 选择 paml 格式

4.手动修改 *.pml 的后缀名为 *.nuc
通过以上两个方法会得到一份 *.phy 或者 *.nuc 文件
接下来需要去除序列中的终止密码子
你可以全选文件内容查找替换 将 TAG/TAA/TGA 替换为 ---
也可以使用下面这个python脚本
import re with open(r'seven.phy', 'r') as f:
content = f.read()
content = content.replace("TAG","---")
content = content.replace("TAA", "---")
content = content.replace("TGA", "---")
# print(content) with open('sevenend.phy', 'w') as f:
f.write(content)
会生成一个去除过终止密码子的文件
现在将这个处理过后的序列文件*.phy与树文件、配置文件codeml.ctl三个放在 \paml4.9j\bin 目录下
配置文件codeml.ctl内容如下可参考 一般修改前面三行即可 按顺序为序列文件名 树文件名 输出文件名
seqfile = seven.nuc * sequence data filename
treefile = Newick * tree structure file name
outfile = test.txt * main result file name noisy = * ,,,,: how much rubbish on the screen
verbose = * : concise; : detailed, : too much
runmode = - * : user tree; : semi-automatic; : automatic
* : StepwiseAddition; (,):PerturbationNNI; -: pairwise seqtype = * :codons; :AAs; :codons-->AAs
CodonFreq = * :/ each, :F1X4, :F3X4, :codon table * ndata =
clock = * :no clock, :clock; :local clock; :CombinedAnalysis
aaDist = * :equal, +:geometric; -:linear, -:G1974,Miyata,c,p,v,a
aaRatefile = dat/jones.dat * only used for aa seqs with model=empirical(_F)
* dayhoff.dat, jones.dat, wag.dat, mtmam.dat, or your own model =
* models for codons:
* :one, :b, : or more dN/dS ratios for branches
* models for AAs or codon-translated AAs:
* :poisson, :proportional, :Empirical, :Empirical+F
* :FromCodon, :AAClasses, :REVaa_0, :REVaa(nr=) NSsites = * :one w;:neutral;:selection; :discrete;:freqs;
* :gamma;:2gamma;:beta;:beta&w;:betaγ
* :beta&gamma+; :beta&normal>; :&2normal>;
* :3normal> icode = * :universal code; :mammalian mt; -:see below
Mgene =
* codon: :rates, :separate; :diff pi, :diff kapa, :all diff
* AA: :rates, :separate fix_kappa = * : kappa fixed, : kappa to be estimated
kappa = * initial or fixed kappa
fix_omega = * : omega or omega_1 fixed, : estimate
omega = . * initial or fixed omega, for codons or codon-based AAs fix_alpha = * : estimate gamma shape parameter; : fix it at alpha
alpha = . * initial or fixed alpha, :infinity (constant rate)
Malpha = * different alphas for genes
ncatG = * # of categories in dG of NSsites models getSE = * : don't want them, 1: want S.E.s of estimates
RateAncestor = * (,,): rates (alpha>) or ancestral states ( or ) Small_Diff = .5e-
cleandata = * remove sites with ambiguity data (:yes, :no)?
* fix_blength = * : ignore, -: random, : initial, : fixed, : proportional
method = * Optimization method : simultaneous; : one branch a time * Genetic codes: :universal, :mammalian mt., :yeast mt., :mold mt.,
* : invertebrate mt., : ciliate nuclear, : echinoderm mt.,
* : euplotid mt., : alternative yeast nu. : ascidian mt.,
* : blepharisma nu.
* These codes correspond to transl_table to of GENEBANK.
在此目录下打开命令行
输入一下命令即可
codeml

当前目录下就会出现结果文件 test.txt 以及其他文件了
在过程中我遇到过许多报错提供给大家参考一下
67 columns are converted into ??? because of stop codons
这个报错是因为没有去除文件中的终止密码子,可以参考上面的步骤去除
Error: Error in sequence data file: . in 1st seq.?.
Error: check #seqs and tree: perhaps too many '('?.
Make sure to separate the sequence from its name by 2 or more spaces.
以上报错均为你的序列文件内容/格式有问题,麻烦按照上面的步骤重新生成序列文件或者参考其他人的文件格式
通过PAML中的CODEML模块计算dnds的过程以及踩坑的更多相关文章
- 在mac版virtual box中安装ubuntu虚拟机的NAT/Host-Only网络配置踩坑记录
之前用惯了vmware和parallels desktop,网络配置十分智能,基本不用自己配置.由于版权原因,工作电脑上换了免费的virtual box用,四五年都完全在虚拟机里干活的本菜鸡居然在虚拟 ...
- 13.在项目中部署redis企业级数据备份方案以及各种踩坑的数据恢复容灾演练
到这里为止,其实还是停留在简单学习知识的程度,学会了redis的持久化的原理和操作,但是在企业中,持久化到底是怎么去用得呢? 企业级的数据备份和各种灾难下的数据恢复,是怎么做得呢? 1.企业级的持久化 ...
- 游戏中VIP会员模块的简单实现
哈哈 今天周末有时间,再整理一篇博文上来,虽然已经不做游戏老长时间了,但还是要把以前做过的东西总结一下,借此可以回顾以前的东西,也可以分享给大家. 今天说一下游戏中VIP会员模块的实现思路.每款游戏 ...
- Python中函数和模块的体验与使用
函数基础 目标 函数的快速体验 函数的基本使用 函数的参数 函数的返回值 函数的嵌套调用 在模块中定义函数 01. 函数的快速体验 1.1 快速体验 所谓函数,就是把 具有独立功能的代码块 组织为一个 ...
- python中的常用模块
python中常用的模块 time: 1)time.localtime([secs]):将一个时间戳转换为当前时区的struct_time.secs参数未提供,则以当前时间为准. 2)time.gmt ...
- 创建多进程之multiprocess包中的process模块
创建多进程之multiprocess包中的process模块 1.process模块是一个创建进程的模块 Process([group [, target [, name [, args [, kwa ...
- python使用datetime模块计算各种时间间隔的方法
python使用datetime模块计算各种时间间隔的方法 本文实例讲述了python使用datetime模块计算各种时间间隔的方法.分享给大家供大家参考.具体分析如下: python中通过datet ...
- 【转帖】一文看懂docker容器技术架构及其中的各个模块
一文看懂docker容器技术架构及其中的各个模块 原创 波波说运维 2019-09-29 00:01:00 https://www.toutiao.com/a6740234030798602763/ ...
- PIL 中的 Image 模块
转载:http://www.cnblogs.com/way_testlife/archive/2011/04/20/2022997.html PIL 中的 Image 模块 本文是节选自 PIL ...
随机推荐
- IDEA惊天bug:进程已结束,退出代码-1073741819 (0xC0000005)
由于昨天要写的文章没有写完,于是今天早上我四点半就"自然醒"了,心里面有事,睡觉也不安稳.洗漱完毕后,我打开电脑,正襟危坐,摆出一副要干架的态势,不能再拖了. 要写的文章中涉及到一 ...
- 链表数据-PHP的实现
首先,链表数据的结构是: 其次,链表数据的结构特点: 随后,填充链表结构: 链表结构的数据,从链表尾部塞入数据. 最后,删除链表结构:
- 2019-2020-1 20199308《Linux内核原理与分析》第九周作业
<Linux内核分析> 第八章 可执行程序工作原理进程的切换和系统的一般执行过程 8.1 知识点 进程调度的时机 ntel定义的中断类型主要有以下几种 硬中断(Interrupt) 软中断 ...
- BootStrap的栅格式布局
1.栅格系统(布局) Bootstrap内置了一套响应式.移动设备优先的流式栅格系统,随着屏幕设备或视口(viewport)尺寸的增加,系统会自动分为最多12列. 我在这里是把Bootstrap中的栅 ...
- 在独立的 Root 和 Home 硬盘驱动器上安装 Ubuntu
安装 Linux 系统时,可以有两种不同的方式.第一种方式是在一个超快的固态硬盘上进行安装,这样可以保证迅速开机和高速访问数据.第二种方式是在一个较慢但很强大的普通硬盘驱动器上安装,这样的硬盘转速快并 ...
- mybatis if test标签的使用
2019独角兽企业重金招聘Python工程师标准>>> 在使用mybatis 有时候需要进行判断的. 而我们知道mybatis获取值有两种方式 #{}和${}的. 那么,在mybat ...
- jQuery里面click、this事件遇到(Django模型里for)相同的id名和class名想获取值
遇到的原型是这样的!下面我把它简化一下; click事件: 在浏览器里面只能获取横线上面的值,和下面的第一个值!! 这是因为id等级比class高,而且js要求id不能重复! 当 转载于:https: ...
- bfs—Catch That Cow—poj3278
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 87152 Accepted: 27344 ...
- ISA Introduction
介绍一下X86.MIPS.ARM三种指令集: 1. X86指令集 X86指令集是典型的CISC(Complex Instruction Set Computer)指令集. X86指令集外部看起来是CI ...
- keep-alive的深入理解与使用(配合router-view缓存整个路由页面)
原文链接: 点我 在搭建 vue 项目时,有某些组件没必要多次渲染,所以需要将组件在内存中进行‘持久化’,此时 <keep-alive> 便可以派上用场了. <keep-alive& ...