用popart构建常染色体单倍型网络(Autosomal haplotypes network construction with popart)
1)将vcf转化为plink格式,假定输入的vcf文件名为:17893893-17898893.vcf,也可以参考链接:将vcf文件转化为plink格式并且保持phasing状态
/vcftools --vcf 17893893-17898893.vcf --plink-tped --out 17893893-17898893
/plink --tfile 17893893-17898893 --recode --out 17893893-17898893
2) 用PLINK确定要研究的位点是否处于连锁的状态;生成blocks和blocks.det两种后缀格式文件;
/plink --file 17893893-17898893 --blocks no-pheno-req --out 17893893-17898893


以上结果说明rs62033246|rs7189274|rs7187782|rs62033247|rs7194607|rs7200159|rs199711091|rs2361776|rs8054992|rs1845376|rs35902958|rs9928657|rs9928743|rs56078865|rs62033249|rs62033250|rs9936044|rs7184460|rs4781927|rs7202082|rs4780669|rs7202439|rs7195939|rs57418698|rs34615631|rs533867711|rs555603620|rs567435894|rs7499772|rs62033251|rs56248612|rs7202488|rs61671028|rs62033253|rs9928974这35个位点是连锁的
3) 提取这35个位点作为接下来的单倍型网络构建;去掉vcf的头文件,保存为txt格式,见如下图,17893893-17898893.txt:

4)准备17893893-17898893_singstring.txt文件,该文件其实就是去掉 0|0,0|1,1|0,1|1的“|”。

5)接下来,生成两条单链,用R输入如下命令:
install.packages("xlsx")
library(xlsx)
kg_ame<-read.table("E:/17893893-17898893.txt")
kg_ame<-data.frame(kg_ame);
library("stringr");
newdata=c()
for (i in 0:34){
i=i+1
kk=kg_ame[i,6:2509];
kk[which(kk=="0|0")]=paste(kg_ame[i,4],kg_ame[i,4]);
kk[which(kk=="0|1")]=paste(kg_ame[i,4],kg_ame[i,5]);
kk[which(kk=="1|0")]=paste(kg_ame[i,5],kg_ame[i,4]);
kk[which(kk=="1|1")]=paste(kg_ame[i,5],kg_ame[i,5]);
newdata=rbind(newdata,kk)
}
##6:2509指的是2000多个样本对应的碱基;
##0:34指的是35个碱基;这一步是将0|0,0|1,1|0,1|1转化为碱基形式,类似vcf转化为Ped的步骤;
openxlsx::write.xlsx(newdata,file ="E:/17893893-17898893_change.xlsx")
kk=kg_ame[1,7:15];kk
kk[which(kk=="0|0")]=paste(kg_ame[1,4],kg_ame[1,4]);kk
#####分为两条链,转换为ped格式;
library(xlsx)
kg_ame<-read.table("E:/17893893-17898893_singstring.txt")
kg_ame<-data.frame(kg_ame);
library("stringr");
newdata=c()
for (i in 0:34){
i=i+1
kk=kg_ame[i,6:5013];
kk[which(kk=="0")]=kg_ame[i,4];
kk[which(kk=="1")]=kg_ame[i,5];
newdata=rbind(newdata,kk)
}
openxlsx::write.xlsx(newdata,file ="E:/17893893-17898893_changesingstring.xlsx")
se1<-seq(from=1,to=5008,by=2);
se2<-seq(from=2,to=5008,by=2);
stringone<-newdata[,se1];
stringtwo<-newdata[,se2];
openxlsx::write.xlsx(stringone,file ="E:/17893893-17898893_changesingstringone.xlsx")
openxlsx::write.xlsx(stringtwo,file ="E:/17893893-17898893_changesingstringtwo.xlsx")
####以上步骤为转为两条单链
6) 将上述的两条单链生成fas格式;
paste -d "\n" 17893893-17898893_changesingstringone_firstdot.txt 17893893-17898893_changesingstringone.txt > 17893893-17898893_changesingstringone_dot.fas
paste -d "\n" 17893893-17898893_changesingstringtwo_firstdot.txt 17893893-17898893_changesingstringtwo.txt > 17893893-17898893_changesingstringtwo_dot.fas
cat 17893893-17898893_changesingstringone_dot.fas 17893893-17898893_changesingstringtwo_dot.fas >> 17893893-17898893_changesingstring_onetwo_dot.fas #这两条链合并在一起
17893893-17898893_changesingstringone_firstdot.txt 文件格式如下:

17893893-17898893_changesingstringone.txt的文件格式如下:这个文件就是5)生成出来的其中一条单链。

生成的fas文件如下:

第二条链的处理同上。最后一步,就是把这两条链合并在一起
7)用DnaSP6将fas文件生成nex文件

8)统计nex文件中不同群体的haplotype的数量
准备17893893-17898893_hap.xlsx文件

准备allsample.txt文件

输入如下命令:
#####统计nex生成的所有haplotype所在的样本和群体,这里假定生成了100个haplotype
library(dplyr)
library(xlsx)
model_57hanchip<-read.xlsx("E:/17893893-17898893_hap.xlsx",2)
model_57hanchip<-data.frame(model_57hanchip)
kg_ame<-read.table("E:/allsample.txt")
kg_ame<-data.frame(kg_ame);
newdata=c()
for (i in 0:99){
i=i+1
HAP1<-kg_ame[,2];
df1 <- data.frame(id = HAP1, kg_ame[,3],kg_ame[,4])
HAP2<-model_57hanchip[,i]
df2 <- data.frame(id = HAP2)
k=merge(df1, df2, by = "id",all = FALSE)
j=table(k[,3])
newdata=rbind(newdata,j)
print(i)
}
openxlsx::write.xlsx(newdata,file ="E:/17893893-17898893_hapcount.xlsx")
9)修改生成的nex文件
DnaSP6生成的nex文件并没有BEGIN TRAITS的头文件,因此这一步是需要手动修改的。
这一步,除了圈出来的数字和AFR AMR EAS EUR SAS是需要修改,其他照抄。

10)用popart构建单体型网络
导入文件后,选择适合的算法,即可生成。

用popart构建常染色体单倍型网络(Autosomal haplotypes network construction with popart)的更多相关文章
- 构建 CDN 分发网络架构简析
构建 CDN 分发网络架构 CDN的基本目的:1.通过本地缓存实现网站的访问速度的提升 CDN的关键点:CNAME在域名解析:split智能分发,引流到最近缓存节点
- 基因调控网络 (Gene Regulatory Network) 01
本文为入门级的基因调控网络文章,主要介绍一些基本概念及常见的GRN模型. 概念:基因调控网络 (Gene Regulatory Network, GRN),简称调控网络,指细胞内或一个基因组内基因和基 ...
- VMware虚拟机上网络连接(network type)的三种模式--bridged、host-only、NAT
VMware虚拟机上网络连接(network type)的三种模式--bridged.host-only.NAT VMWare提供了三种工作模式,它们是bridged(桥接模式).NAT(网络地址转换 ...
- [USACO08JAN]手机网络Cell Phone Network
[USACO08JAN]手机网络Cell Phone Network 题目描述 Farmer John has decided to give each of his cows a cell phon ...
- linux 网络虚拟化: network namespace 简介
linux 网络虚拟化: network namespace 简介 network namespace 是实现网络虚拟化的重要功能,它能创建多个隔离的网络空间,它们有独自的网络栈信息.不管是虚拟机还是 ...
- 洛谷 P2812 校园网络【[USACO]Network of Schools加强版】 解题报告
P2812 校园网络[[USACO]Network of Schools加强版] 题目背景 浙江省的几所OI强校的神犇发明了一种人工智能,可以AC任何题目,所以他们决定建立一个网络来共享这个软件.但是 ...
- Solaris11.1网络配置(Fixed Network)
Solaris11的网络配置与Solaris10有很大不同,Solaris11通过network configuration profiles(NCP)来管理网络配置. Solaris11网络配置分为 ...
- 洛谷P2899 [USACO08JAN]手机网络Cell Phone Network
P2899 [USACO08JAN]手机网络Cell Phone Network 题目描述 Farmer John has decided to give each of his cows a cel ...
- (58)zabbix网络拓扑图配置network map
zabbix网络地图介绍 “zabbix network map”可以简单的理解为动态网络拓扑图,可以针对业务来配置zabbix map, 通过map可以了解应用的整体状况:服务器是否异常.网络是否有 ...
随机推荐
- JQ获取URL中是否含有某个字符的话,对页面进行某种操作
一.//JQ获取URL中是否含有某个字符的话,对页面进行某种操作 例:如果URL中含有xia的字符,就在页面引入一个cssvar str=window.location.href; //获取地址栏UR ...
- 和docket的第一次亲密接触
很久很久以前,第一次听说docker时,感觉很高大上,同时自我感觉会很难.所以一直没有详细了解.前一段时间偶尔看到关于docker的详细介绍,于是乎来了兴趣.自已折腾了一下,发现不是想象中的那么难. ...
- essential-phone的相关体验
一.adb环境配置 1.下载adb工具 工具网上一搜一大把,注意路径不能有中文. 2.系统配置环境变量 找到环境变量,点击新建.变量名根据自己的习惯随便建,变量值为下载的adb工具解压后存放的路径. ...
- draknet网络配置参数
https://blog.csdn.net/hrsstudy/article/details/65447947?utm_source=itdadao&utm_medium=referral [ ...
- spring 在容器中一个bean依赖另一个bean 需要通过ref方式注入进去 通过构造器 或property
spring 在容器中一个bean依赖另一个bean 需要通过ref方式注入进去 通过构造器 或property
- 【NLP】Recurrent Neural Network and Language Models
0. Overview What is language models? A time series prediction problem. It assigns a probility to a s ...
- HTML5-Video视频-基础篇
展示视频 视频 <video width=" controls="controls"> <source src="movie.mp4" ...
- 在一台服务器上配置多个Tomcat的方法
原文来自:http://blog.csdn.net/lmb55/article/details/49561669 这段时间在开发智能导航的热部署功能,需要从一台服务器去访问其它的24台服务器去进行相关 ...
- Typecho——数据库无法连接问题
报错 对不起,无法连接数据库,请先检查数据库配置再继续进行安装 解决方案 创建数据库 reate database databaseName; 远程权限 开启远程权限 GRANT ALL PRIVIL ...
- C# 动态调用泛型方法
static void Main(string[] args) { #region 具体类型可传递. Personal specifiedPersonal = new Personal(); Empl ...