R语言统计 plink格式数据样本缺失率

 

1、R脚本

复制代码
dir()
dat <- read.table("outcome.ped")
dat
id <- dat[,2]
dat <- dat[, -(1:6)]

result <- data.frame()

for (i in 1:nrow(dat)) {
  count = 0
  for (j in 1:ncol(dat)) {
    if (dat[i,j] == 0) {
      count = count + 1
    }
  }
  temp <- c(count/2,ncol(dat)/2, count/ncol(dat))
  result <- rbind(result, temp)
}

result <- cbind(id, result)
colnames(result)[2:4] <- c("misssite","totalsite","rate")
result
复制代码

 

 

2、plink验证

复制代码
[root@centos79 test]# ls
outcome.map  outcome.ped  result.txt  test.sh
[root@centos79 test]# plink --file outcome --missing --out verify > /dev/null; rm *.log *.nosex
[root@centos79 test]# ls
outcome.map  outcome.ped  result.txt  test.sh  verify.imiss  verify.lmiss
[root@centos79 test]# cat verify.imiss
 FID  IID MISS_PHENO   N_MISS   N_GENO   F_MISS
 DOR    1          Y        4        8      0.5
 DOR    2          Y        4        8      0.5
 DOR    3          Y        3        8    0.375
 DOR    4          Y        2        8     0.25
 DOR    5          Y        1        8    0.125
 DOR    6          Y        1        8    0.125
复制代码

 

posted @   小鲨鱼2018  阅读(139)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
历史上的今天:
2020-10-31 linux系统 服务的访问控制列表
2020-10-31 linux系统中firewalld防火墙管理工具firewall-config(GUI图形用户界面)
点击右上角即可分享
微信分享提示