plink2.0和plink1.9的忧伤笔记

news2024/10/7 12:19:25

虽然plink2.0已经存在好久了,但是一直用的都是plink1.9,因为语法熟悉。更主要是plink2.0语法变动太大,害怕步子迈得太大了……

今天看一下plink2.0的读入和输出数据常用参数,

plink2.0用是不会用的,2022年都不会用!!!但是碰到bgen,pgen数据进行转化为bed,bim,fam文件,然后用plink1.9使用的想法还是有的,而且很大!!!

本篇目的:使用plink2.0软件将下面格式随便输入、输出

  • plink1.9的ped和map数据,不如:a.ped, a.map
  • plink1.9的bed和bim和fam数据,比如:a.bim, a.bed, a.fam
  • plink2.0的bgen和sample数据,比如:a.bgen, a.sample
  • plink2.0的pgen和bim和fam数据,比如a.pgen,a.fam,a.bim
    • vcf数据,比如a.vcf

1,plink2.0的提升

plink2.0主要是从以下几个方面,相对于plink1.9有较大的提升:

  • 1,保留参考等位基因的信息,比如vcf格式的数据,不要添加参数 --keep-allele-order。这样vcf变为plink,plink变为vcf就可以不用指定ref和alt了,切换无障碍!

  • 2,新的.pgen文件,结合SNPack-style的压缩,可以节约80%的文件大小。比如1000个Genomes,比压缩的gzip文件小70%,且不丢失任何信息。压缩文件空间更小,速度更快。

  • 3,旧版的二进制文件(bed,bim和fam)文件,plink2.0依旧支持,输出文件包括两种:–make-bpgen 和 --make-bpfile文件。可以支持plink1.9的文件格式,无论是map和ped数据,还是bed,bim和fam格式。

  • 4,分析模块,进行了优化。标准的logistic回归分析失败产生NA或者无意义的结果,–glm比plink1.9的–linear速度提升1000倍。尤其是填充的剂量效应的基因型值(比如0.2,1.8这样的非整数型数据)。PCA分析汇总,增加了参数PCA approx,当样本超过1万,这个参数可以不影响精度(影响不到1%),大大提升计算效率。样本量支持得更多,处理速度更快!

2,plink2.0 安装

plink2.0 网站:https://www.cog-genomics.org/plink/2.0/

二进制文件,直接执行,支持:

  • Intel
  • AMD
  • 苹果M1

建议:plink1.9简写为plink,plink2.0 简写为plink2

3,plink帮助文档

可以通过官网查询具体参数:https://www.cog-genomics.org/plink/2.0/

也可以在命令行中调出帮助文档:

比如直接键入plink2,出现基础参数:

$ plink2



PLINK v2.00a3.7LM AVX2 Intel (24 Oct 2022)     www.cog-genomics.org/plink/2.0/
(C) 2005-2022 Shaun Purcell, Christopher Chang   GNU General Public License v3

  plink2 <input flag(s)...> [command flag(s)...] [other flag(s)...]
  plink2 --help [flag name(s)...]

Commands include --rm-dup list, --make-bpgen, --export, --freq, --geno-counts,
--sample-counts, --missing, --hardy, --het, --fst, --indep-pairwise, --ld,
--sample-diff, --make-king, --king-cutoff, --pmerge, --pgen-diff,
--write-samples, --write-snplist, --make-grm-list, --pca, --glm, --adjust-file,
--score, --variant-score, --genotyping-rate, --pgen-info, --validate, and
--zst-decompress.

"plink2 --help | more" describes all functions.

想查看一下–export的用法,可以看到主要功能:

  • A,是0-1-2编码
  • ped,是map和ped格式
  • vcf,是vcf格式
  • bgen-1.x,包括1.1, 1.2, 1.3,都是bgen格式
$ plink2 --export --help
PLINK v2.00a3.7LM AVX2 Intel (24 Oct 2022)     www.cog-genomics.org/plink/2.0/
(C) 2005-2022 Shaun Purcell, Christopher Chang   GNU General Public License v3
--help present, ignoring other flags.

--export <output format(s)...> [{01 | 12}] ['bgz'] ['id-delim='<char>]
         ['id-paste='<column set descriptor>] ['include-alt']
         ['omit-nonmale-y'] ['spaces'] ['vcf-dosage='<field>] ['ref-first']
         ['bits='<#>] ['sample-v2']
  Create a new fileset with all filters applied.  The following output
  formats are supported:
  (actually, only A, AD, Av, bcf, bgen-1.x, haps, hapslegend, ind-major-bed,
  oxford, ped, tped, and vcf are implemented for now)
  * '23': 23andMe 4-column format.  This can only be used on a single
          sample's data (--keep may be handy), and does not support
          multicharacter allele codes.
  * 'A': Sample-major additive (0/1/2) coding, suitable for loading from R.
         If you need uncounted alleles to be named in the header line, add
         the 'include-alt' modifier.
  * 'AD': Sample-major additive (0/1/2) + dominant (het=1/hom=0) coding.
          Also supports 'include-alt'.
  * 'Av': Variant-major 0/1/2.
  * 'beagle': Unphased per-autosome .dat and .map files, readable by early
              BEAGLE versions.
  * 'beagle-nomap': Single .beagle.dat file.
  * 'bgen-1.x': Oxford-format .bgen + .sample.  For v1.2/v1.3, sample
                identifiers are stored in the .bgen (with id-delim and
                id-paste settings applied), and default precision is 16-bit
                (use the 'bits' modifier to reduce this).
  * 'bimbam': Regular BIMBAM format.
  * 'bimbam-1chr': BIMBAM format, with a two-column .pos.txt file.  Does not
                   support multiple chromosomes.
  * 'fastphase': Per-chromosome fastPHASE files, with
                 .chr-<chr #>.phase.inp filename extensions.
  * 'fastphase-1chr': Single .phase.inp file.  Does not support
                      multiple chromosomes.
  * 'haps', 'hapslegend': Oxford-format .haps + .sample[ + .legend].  All
                          data must be biallelic and phased.  When the 'bgz'
                          modifier is present, the .haps file is
                          block-gzipped.
  * 'HV': Per-chromosome Haploview files, with .chr-<chr #>{.ped,.info}
          filename extensions.
  * 'HV-1chr': Single Haploview .ped + .info file pair.  Does not support
               multiple chromosomes.
  * 'ind-major-bed': PLINK 1 sample-major .bed (+ .bim + .fam).
  * 'lgen': PLINK 1 long-format (.lgen + .fam + .map), loadable with --lfile.
  * 'lgen-ref': .lgen + .fam + .map + .ref, loadable with --lfile +
                --reference.
  * 'list': Single genotype-based list, up to 4 lines per variant.  To omit
            nonmale genotypes on the Y chromosome, add the 'omit-nonmale-y'
            modifier.
  * 'rlist': .rlist + .fam + .map fileset, where the .rlist file is a
              genotype-based list which omits the most common genotype for
              each variant.  Also supports 'omit-nonmale-y'.
  * 'oxford', 'oxford-v2': Oxford-format .gen + .sample.  When the 'bgz'
                           modifier is present, the .gen file is
                           block-gzipped.  'oxford' requests the original
                           .gen file format with 5 leading columns
                           (understood by older PLINK builds); 'oxford-v2'
                           requests the current 6-leading-column flavor.
  * 'ped', 'compound-genotypes': PLINK 1 sample-major (.ped + .map),
                                 loadable with --pedmap.
  * 'structure': Structure-format.
  * 'tped': PLINK 1 variant-major (.tped + .tfam), loadable with --tfile.
  * 'vcf',     : VCF (default version 4.3).  If PAR1 and PAR2 are present,
    'vcf-4.2',   they are automatically merged with chrX, with proper
    'bcf',       handling of chromosome codes and male ploidy.
    'bcf-4.2'    When the 'bgz' modifier is present, the VCF file is
                 block-gzipped.  (This always happens with BCF output.)
                 The 'id-paste' modifier controls which .psam columns are
                 used to construct sample IDs (choices are maybefid, fid,
                 iid, maybesid, and sid; default is maybefid,iid,maybesid),
                 while the 'id-delim' modifier sets the character between the
                 ID pieces (default '_').
                 Genotypes are always exported.  If you want to export a
                 sites-only VCF instead, see --make-pgen/--make-just-pvar's
                 'vcfheader' column set.
                 Dosages are not exported unless the 'vcf-dosage=' modifier
                 is present.  The following six dosage export modes are
                 supported:
                 'GP': genotype posterior probabilities (v4.3 only).
                 'DS': Minimac3-style dosages, omitted for hardcalls.
                 'DS-force': Minimac3-style dosages, never omit.
                 'DS-only': Same as DS-force, except GT field is omitted.
                 'HDS': Minimac3-style phased dosages, omitted for hardcalls
                        and unphased calls.  Also includes 'DS' output.
                 'HDS-force': Always report DS and HDS.
  In addition,
  * The '12' modifier causes alt1 alleles to be coded as '1' and ref alleles
    to be coded as '2', while '01' maps alt1 -> 0 and ref -> 1.
  * The 'spaces' modifier makes the output space-delimited instead of
    tab-delimited, whenever both are permitted.
  * For biallelic formats where it's unspecified whether the reference/major
    allele should appear first or second, --export defaults to second for
    compatibility with PLINK 1.9.  Use 'ref-first' to change this.
    (Note that this doesn't apply to the 'A', 'AD', and 'Av' formats; use
    --export-allele to control which alleles are counted there.)
  * 'sample-v2' exports .sample files according to the QCTOOLv2 rather than
    the original specification.  Only one ID column is exported ('id-paste'
    and 'id-delim' settings apply), parental IDs are exported if present, and
    category names are preserved rather than converted to positive integers.

--export-allele <file> : With --export A/AD/Av, count alleles named in the
                         file, instead of REF alleles.

4. plink2.0 笔记

4.1 读取plink的ped和map数据

plink2.0,没有–file这个参数了,变为了:--pedmap,也可以分开写,比如 --ped --map分别接ped和map数据。

plink2 --ped yuanshi.ped --map yuanshi.map

或者写为:

plink2 --pedmap yuanshi

默认输出文件:

plink2.log  plink2.pgen  plink2.psam  plink2.pvar

  • plink2.log,log日志,不用理会
  • plink2.pgen,二进制文件,类似plink1.9的bim文件
  • plink2.psam,个体和性别信息
  • plink2.pvar,snp的信息,包括染色体、物理位置、名称、ref和alt

4.2 读取plink的bed,bim和fam数据

plink1.9的二进制数据是bed,bim和fam数据,plink2.0通过–bfile指定。

比如读取plink1.9的二进制文件,输出bgen格式:

plink2 --bfile a1 --export bgen-1.1 --out t1

日志:

$ plink2 --bfile a1 --export bgen-1.1 --out t1
PLINK v2.00a3.7LM AVX2 Intel (24 Oct 2022)     www.cog-genomics.org/plink/2.0/
(C) 2005-2022 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to t1.log.
Options in effect:
  --bfile a1
  --export bgen-1.1
  --out t1

Start time: Thu Dec  1 18:59:10 2022
1031523 MiB RAM detected; reserving 515761 MiB for main workspace.
Using up to 96 threads (change this with --threads).
86 samples (0 females, 0 males, 86 ambiguous; 86 founders) loaded from a1.fam.
50904 variants loaded from a1.bim.
Note: No phenotype data present.
Writing t1.bgen ... done.
Writing t1.sample ... done.

4.3 读取bgen和sample格式

导出ped和map的格式:

plink2 --bgen t1.bgen 'ref-last' --sample t1.sample --export ped --out x1

注意:bgen和sample是一对数据,读取时,要分开指定,–bgen, --sample,同时要指定‘ref-last’,即后面的是ref,前面的是alt,也可以修改。

4.4 读取vcf数据

导出ped和map数据

读取vcf,导出ped和map数据:需要定义--export ped

plink2 --vcf x2.vcf --export ped --out y1

导出bed和bim和fam数据

读取vcf数据,导出bim,bed和fam数据:需要定义--make-bed

plink2 --vcf x2.vcf --make-bed --out y2

导出bgen数据

读取vcf数据,导出bgen和sample数据,需要定义--export bgen-1.1

plink2 --vcf x2.vcf --export bgen-1.1 --out y3

上面就是我的总结,更多内容,欢迎关注我的公众号:育种数据分析之放飞自我

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/51997.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

计算机网络基础

前言 计算机网络学习的核心内容就是网络协议的学习。网络协议是为计算机网络中进行数据交换而建立的规则、标准或者说是约定的集合。因为不同用户的数据终端可能采取的字符集是不同的&#xff0c;两者需要进行通信&#xff0c;必须要在一定的标准上进行。一个很形象地比喻就是…

平时健身买什么耳机好、分享五款最好的运动耳机推荐

不少人喜欢在健身房或者户外运动中使用手机或者MP3来听音乐&#xff0c;这种方式不仅可以减少运动中的枯燥感&#xff0c;而且那些节奏较强的音乐还能够进一步激发人们的运动潜能&#xff0c;达到事半功倍的效果。作为音乐传递的桥梁&#xff0c;一款佩戴舒适的运动耳机是必不可…

又撸了一个开源项目!!!

花了两周左右&#xff0c;写了一个客户关系管理系统&#xff0c;基于 Vue Go 实现&#xff0c;主要功能有仪表盘、客户管理、合同管理、产品管理&#xff0c;订阅等功能。 前几天已经在 Github 上开源了&#xff0c;今天也把项目部署到云服务器上了&#xff0c;很完美&#x…

负载均衡组件Ribbon核心-@LoadBalanced-上

引言 书接上篇 微服务负载均衡小能手-Ribbon 使用RIbion实现负载均衡远程调用 Bean LoadBalanced public RestTemplate restTemplate(){return new RestTemplate(); } 都知道没有LoadBalanced注解前&#xff0c;RestTemplate就是一个简单的http请求工具类&#xff0c;贴上该…

AI-多模态-2021:DALL-E模型【文本生成图像工具】【OpenAI】

Dall-e&#xff1a;从拟物文字到图片的创造 人类不断地从五种感官接收和整合信息&#xff0c;通过视觉、听觉、触觉、嗅觉和味觉等生物信息来理解文字和图片。然而文字和图片属于符号&#xff0c;Dall-e模型在理解符号的含义时并不能通过生物信息的传递。通过将对自然语言的理…

Ambari-yarn-timeline 内置 HBase数据表清理

HDP 集群 timeline 内置的 HBase 数据表持续增大&#xff0c;我们将默认TTL30改 为7 天。 ambari界面YARN 服务中 的 timeline v2.0 timeline 内置 HBase数据HDFS路径 &#xff1a; 表在HDFS上的大小 使用如下命令进入 Hbase shell [hdfswinner-backup-hdp root]$ hbase -…

网站变灰代码如何让网页变灰

1.网站变灰代码应用场景 一般在清明节&#xff0c;全国哀悼日&#xff0c;大地震的日子&#xff0c;以及一些影响力很大的伟人逝世或纪念日的时候&#xff0c;身为站长的我们都会让自己的网站的全部网页变成灰色&#xff08;黑白色&#xff09;&#xff0c;以表示我们对逝者的…

数据分析之人力资源管理驾驶舱

驾驶舱是数据分析报表中用于展示关键分析指标和综合展示数据情况的&#xff0c;因此需要展示的内容多&#xff0c;需要做的内容甄选也多。 一 前言 人力资源作为企业的关键生产力&#xff0c;是一个企业成长发展的根本。随着“知识经济”时代的到来、市场竞争的加剧&#xff…

Shiro-全面详解(学习总结---从入门到深化)

Shiro介绍_Shiro简介 Shiro是apache旗下的一个开源安全框架&#xff0c;它可以帮助我们完成身 份认证&#xff0c;授权、加密、会话管理等功能。它有如下特点&#xff1a; 1、易于理解的API 简单的身份认证&#xff0c;支持多种数据源 2、简单的授权和鉴权 3、简单的加密API 4、…

《机器学习实战》11.Apriori算法进行关联分析

目录 使用Apriori算法进行关联分析 1 关联分析 2 Apriori原理 3 使用Apriori算法来发现频繁集 3.1 生成候选项集 3.2 组织完整的Apriori算法 4 从频繁项集中挖掘关联规则 5 示例&#xff1a;发现国会投票中的模式 6 示例&#xff1a;发现毒蘑菇的相似特征 7 本章小结…

线上服务Java进程假死快速排查、分析

线上服务Java进程假死快速排查、分析 最近我们有一台服务器上的Java进程总是在运行个两三天后就无法响应请求了&#xff0c;具体现象如下&#xff1a; 请求业务返回状态码502&#xff0c;查看进程还在&#xff0c;意味着Java进程假死&#xff0c;无法响应请求了&#xff1b;该…

React18 基础入门API、JSX语法糖

文章目录一、react的一次使用react.development.jsreact-dom.development.jsReact.createElement()二、三个APIReact.createElement()ReactDOM.createRoot()root.render() 渲染页面三、JSX&#xff08;JavaScript Syntax Extension&#xff09;、babelbabelJSX使用注意事项一、…

mysql与磁盘的关系

1.如今一直在说mysql存储方式和磁盘的关系&#xff0c;但是现在都是硬盘存储啊 磁盘分为硬盘和软盘 硬盘结构&#xff08;机械硬盘和固态硬盘&#xff09;详解 硬盘的大小是使用"磁头数 x 柱面数 x 扇区数 x 每个扇区的大小 如下&#xff1a; 每个扇区的大小是固定的…

javaEE高阶---Spring MVC

一 : 什么是Spring MVC ? 1.1 概述 Spring MVC全称Spring Web MVC,又称为Spring Web,它是一个原始的基于Servlet API 的 web 框架.Q : 经典问题 : Spring/Spring Boot/Spring MVC 有什么区别 ? A : Spring&#xff0c;一般指代的是Spring Framework&#xff0c;它是一个开源…

业务数据分析-常见业务指标

目录 1、什么是指标&#xff1f; 2、以互联网电商数据为例分析常用的指标 3、如何选择指标 4、电商指标体系详细介绍 1、什么是指标&#xff1f; 我们说过分析的最终目的就是为了通过客观的数据去发现公司业务存在的问题&#xff0c;那怎么通过什么数据呢&#xff1f;业务…

连接MySQL问题的错题小集

目录 一. 连接不上数据库 踩坑 解决过程 二. Can‘t connect to MySQL server on ‘localhost:3306‘ (10061) 排查1&#xff1a;数据库没有启动 排查2&#xff1a;判断数据库是否存在 排查3&#xff1a;数据库没有启动 ​编辑 过程&#xff1a; 报错了&#xff0c;排…

12.Java 技术栈中间件优雅停机方案设计与实现全景图

Java 技术栈中间件优雅停机方案设计与实现全景图 本系列 Netty 源码解析文章基于 4.1.56.Final 版本 本文概要 在上篇文章 中笔者为大家详细介绍了 Netty 在处理连接关闭时的完整过程&#xff0c;并详细介绍了 Netty 如何应对 TCP 连接在关闭时会遇到的各种场景。 在连接关闭…

软件压力测试有哪些测试流程?软件测试报告收费情况

软件压力测试是一种基本的质量保证行为&#xff0c;它是每个重要软件测试工作的一部分。通过给软件系统不断施压&#xff0c;强制其在极限条件下运行&#xff0c;以观察软件系统可运行到哪种程度&#xff0c;从而发现系统性能缺陷。测试人员根据测试过程进行总结和分析&#xf…

[附源码]Python计算机毕业设计Django个性化产品服务管理系统论文

项目运行 环境配置&#xff1a; Pychram社区版 python3.7.7 Mysql5.7 HBuilderXlist pipNavicat11Djangonodejs。 项目技术&#xff1a; django python Vue 等等组成&#xff0c;B/S模式 pychram管理等等。 环境需要 1.运行环境&#xff1a;最好是python3.7.7&#xff0c;…

电脑重装系统后序列号怎么查

最近很多网友都在问怎么看桌面操作系统序列号&#xff0c;我们安装系统的时候是需要知道&#xff0c;其实想要知道自己电脑的序列号非常简单的&#xff0c;网友们看看下面操作就知道了。 工具/原料&#xff1a; 系统版本&#xff1a;win10 型号&#xff1a;联想小新Air 13 Pro…