Plink常用命令總結

2021-09-28 14:10:52 字數 2664 閱讀 4877

1、–bfile 、 --file 和 --tfile

讀取檔案

–bfile 讀取二進位制檔案,bed、bim和fam格式

–file 讀取文字檔案,ped和map格式

使用以上兩個命令時,檔案命名要一致,如test.bed、test.bim、test.fam

二進位制檔案比較小,處理速度比較快

2、–out

指定輸出檔案的名稱

3、–recode、 --make-bed 和 --transpose

格式轉換

(1)ped/map 轉換為tped/tfam格式:

plink --ped test.ped --map test.map  --recode --transpose --out test1
或者

plink --file test --recode --transpose --out test1
(2)tped/tfam轉化為ped/map檔案:

plink --tped test1.tped --tfam test1.tfam  --recode --out test2
或者

plink --tfile test1 --recode --out test2
(3)ped/map轉為二進位制格式

plink --file test --make-bed --out test3
(4)tfam/tped轉為二進位制格式

plink --tfile test1 --make-bed --out test3
(5)二進位制格式轉為tped/tfam:

plink --bfile test3  --recode --transpose --out test4
(6)二進位制格式轉為ped/map:

plink --bfile test3 --recode --out test
4、–keep 和 --remove保留或刪除指定的樣本

keep為保留,remove為刪除

(2020.12.08更新,附加一些說明)

下面這條命令中的sampleid.txt由兩列構成,第一列為提取的樣本family id,第二列為within-family id(iid)。

plink --bfile test --keep sample.txt --recode --make-bed --out sample
5、–extrac保留指定的snps

(2020.12.08更新,附加一些說明)

下面這條命令中的snp.txt由一列構成,該列為snp id,每行為乙個snp位點。

plink --bfile test --extract snp.txt --make-bed --out snp
1、–geno2、–hwe3、–maf4、–mind

一行命令完成質量控制:

plink --bfile test --geno 005

--hwe 0.000001

--mad 0.5

--mind 0.1

--make-bed --out test_qc1

2020/05/06 更新

最近把質量控制部分又展開寫了寫,詳細可參看

使用plink對snp資料進行質量控制

1、–recode vcf

預設輸出檔案格式為vcf(廢話)

輸出檔案每行是乙個snp,表示形式如 0/1,缺失為na

2、–recode 12

預設輸出檔案格式為ped和map

輸出檔案每行是乙個樣本

a1編碼為1,a2編碼為2,兩位代表乙個snp位點,強制使用 --missing-genotype來定義缺失基因的編碼形式

3、–recode 23

預設輸出檔案格式暫時不知道,沒使用過

因為需要配合其他命令使用

4、–recode ad 和 --recode a

預設輸出檔案格式為raw,r語言可讀

使用0,1,2進行編碼,ad還包含dominant項(het為1,其他為0),ad每個snp編碼為兩位,a為一位

以上命令均基於plink1.90。

(2020.12.08更新,增加鏈結一條)

上文中只介紹了plink格式檔案的相互轉化,在基因組資料中還有一種很常見的檔案格式——vcf,下面鏈結介紹了三種vcf格式轉為plink格式的方法,其中有一種方法是利用plink命令來轉。

參考:

常用命令總結

一,vim常用命令 set nu 顯示行號 dd 刪除當前行 yy 拷貝當前行 p 粘接內容 行號gg 定位改行到行號 g 切換到檔案尾部 gg 切換到檔案頭部 二,linux常用命令 全路徑cp a 拷貝目錄 a dpr cat n 行號 檢視檔案內容前面10行 rename 改名 rm rf 刪...

常用命令總結

1 lsof i 埠號 2 netstat tunlp grep 埠號 1.徹底置空,也就是ls檔案的大小為0,檔案裡面什麼都沒有 1 filename 2 true filename 3 cat dev null filename 4 filename 2.置空檔案,但是檔案中有空行,ls檔案的大...

mysql常用命令總結 mySql常用命令總結

總結一下自己常用的mysql資料庫的常用命令 mysql u root p 進入mysql bin目錄後執行,回車後輸入密碼連線。資料庫操作 1 create database dbname 建立資料庫,資料庫名為dbname 2 create database todo default chara...