linux shell 统计plink格式样本缺失率
1、shell脚本
[root@centos79 test]# cat test.sh #!/bin/bash ## step1 for i in $(seq `sed -n "$=" $1`); do sed -n "$i"p $1 | cut -d " " -f 7- | grep -o "0" | wc -l >> result1; done echo "step1 done!" ## step2 paste result1 $1 | awk '{OFS = "\t"} {print $3, $1/2, $1/(NF - 7)}' > result.txt rm -f result1 echo "step2 done!" ## step3 sed '1i id\tmisssite\trate' result.txt -i echo "finished!"
2、测试数据、及测试
[root@centos79 test]# ls outcome.map outcome.ped test.sh [root@centos79 test]# cat outcome.map 1 snp1 0 55910 1 snp2 0 85204 1 snp3 0 122948 1 snp4 0 203750 1 snp5 0 312707 1 snp6 0 356863 1 snp7 0 400518 1 snp8 0 487423 [root@centos79 test]# cat outcome.ped DOR 1 0 0 0 -9 G G 0 0 0 0 0 0 A A T T G G 0 0 DOR 2 0 0 0 -9 0 0 G G 0 0 0 0 A A T T A G 0 0 DOR 3 0 0 0 -9 0 0 C C 0 0 G G G G T T A G 0 0 DOR 4 0 0 0 -9 0 0 C C 0 0 G G G G A A G G G G DOR 5 0 0 0 -9 G G C C 0 0 G G G G A A A G G C DOR 6 0 0 0 -9 G G C C 0 0 G G G G A A A A C C [root@centos79 test]# bash test.sh outcome.ped step1 done! step2 done! finished! [root@centos79 test]# ls outcome.map outcome.ped result.txt test.sh [root@centos79 test]# cat result.txt id misssite rate 1 4 0.5 2 4 0.5 3 3 0.375 4 2 0.25 5 1 0.125 6 1 0.125
3、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 [root@centos79 test]# cat result.txt id misssite rate 1 4 0.5 2 4 0.5 3 3 0.375 4 2 0.25 5 1 0.125 6 1 0.125
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 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图形用户界面)