plink 软件中 --update-map 参数
--update-map:用于更新SNP的built(SNPID + POS)。
001、
root@DESKTOP-1N42TVH:/home/test4# ls newbuilt.txt outcome.map outcome.ped root@DESKTOP-1N42TVH:/home/test4# cat outcome.map ## 测试数据 1 snp1 0 55910 1 snp2 0 85204 1 snp3 0 122948 2 snp4 0 167127 2 snp5 0 176079 2 snp6 0 361433 3 snp7 0 144010 3 snp8 0 199910 3 snp9 0 234281 root@DESKTOP-1N42TVH:/home/test4# cat outcome.ped ## 测试数据 DOR 1 0 0 0 -9 G G C C G G A A A A G A G G G G G G DOR 2 0 0 0 -9 G G G C G G A A A A G G G G G G G G DOR 3 0 0 0 -9 G G C C G G A A A A G A G G G G G G DOR 4 0 0 0 -9 G G C C G G A A A A G A G G G G G G DOR 5 0 0 0 -9 G G C C G G A A A A G G G G G G G G root@DESKTOP-1N42TVH:/home/test4# cat newbuilt.txt ## 更新snp数据格式 snp1 261 snp2 522 snp3 783 snp4 1044 snp5 1305 snp6 1566 snp7 1827 snp8 2088 snp9 2349 root@DESKTOP-1N42TVH:/home/test4# plink --file outcome --update-map newbuilt.txt --recode tab --out result PLINK v1.90b6.26 64-bit (2 Apr 2022) www.cog-genomics.org/plink/1.9/ (C) 2005-2022 Shaun Purcell, Christopher Chang GNU General Public License v3 Logging to result.log. Options in effect: --file outcome --out result --recode tab --update-map newbuilt.txt 16007 MB RAM detected; reserving 8003 MB for main workspace. .ped scan complete (for binary autoconversion). Performing single-pass .bed write (9 variants, 5 people). --file: result-temporary.bed + result-temporary.bim + result-temporary.fam written. 9 variants loaded from .bim file. 5 people (0 males, 0 females, 5 ambiguous) loaded from .fam. Ambiguous sex IDs written to result.nosex . --update-map: 9 values updated. Using 1 thread (no multithreaded calculations invoked). Before main variant filters, 5 founders and 0 nonfounders present. Calculating allele frequencies... done. Total genotyping rate is exactly 1. 9 variants and 5 people pass filters and QC. Note: No phenotypes present. --recode ped to result.ped + result.map ... done. root@DESKTOP-1N42TVH:/home/test4# ls newbuilt.txt outcome.map outcome.ped result.log result.map result.nosex result.ped root@DESKTOP-1N42TVH:/home/test4# cat result.map ## 查看更新结果 1 snp1 0 261 1 snp2 0 522 1 snp3 0 783 2 snp4 0 1044 2 snp5 0 1305 2 snp6 0 1566 3 snp7 0 1827 3 snp8 0 2088 3 snp9 0 2349 root@DESKTOP-1N42TVH:/home/test4# cat result.ped DOR 1 0 0 0 -9 G G C C G G A A A A A G G G G G G G DOR 2 0 0 0 -9 G G G C G G A A A A G G G G G G G G DOR 3 0 0 0 -9 G G C C G G A A A A A G G G G G G G DOR 4 0 0 0 -9 G G C C G G A A A A A G G G G G G G DOR 5 0 0 0 -9 G G C C G G A A A A G G G G G G G G
002、shell实现
(1)
root@DESKTOP-1N42TVH:/home/test4# ls newbuilt.txt outcome.map outcome.ped root@DESKTOP-1N42TVH:/home/test4# cat newbuilt.txt snp1 261 snp2 522 snp3 783 snp4 1044 snp5 1305 snp6 1566 snp7 1827 snp8 2088 snp9 2349 root@DESKTOP-1N42TVH:/home/test4# cat outcome.map 1 snp1 0 55910 1 snp2 0 85204 1 snp3 0 122948 2 snp4 0 167127 2 snp5 0 176079 2 snp6 0 361433 3 snp7 0 144010 3 snp8 0 199910 3 snp9 0 234281 root@DESKTOP-1N42TVH:/home/test4# cat outcome.ped DOR 1 0 0 0 -9 G G C C G G A A A A G A G G G G G G DOR 2 0 0 0 -9 G G G C G G A A A A G G G G G G G G DOR 3 0 0 0 -9 G G C C G G A A A A G A G G G G G G DOR 4 0 0 0 -9 G G C C G G A A A A G A G G G G G G DOR 5 0 0 0 -9 G G C C G G A A A A G G G G G G G G root@DESKTOP-1N42TVH:/home/test4# cat newbuilt.txt | while read {i,j}; do awk -v a=$i -v b=$j '{j = 0; for(i = 1; i <= NF; i++) if($i == a) {$4 = b; j++} if(j != 0) {OFS = "\t"; print $0}}' outcome.map >> result.map; done root@DESKTOP-1N42TVH:/home/test4# ls newbuilt.txt outcome.map outcome.ped result.map root@DESKTOP-1N42TVH:/home/test4# cat result.map ## 结果文件 1 snp1 0 261 1 snp2 0 522 1 snp3 0 783 2 snp4 0 1044 2 snp5 0 1305 2 snp6 0 1566 3 snp7 0 1827 3 snp8 0 2088 3 snp9 0 2349
(2)、
root@DESKTOP-1N42TVH:/home/test4# ls newbuilt.txt outcome.map outcome.ped root@DESKTOP-1N42TVH:/home/test4# cat outcome.map 1 snp1 0 55910 1 snp2 0 85204 1 snp3 0 122948 2 snp4 0 167127 2 snp5 0 176079 2 snp6 0 361433 3 snp7 0 144010 3 snp8 0 199910 3 snp9 0 234281 root@DESKTOP-1N42TVH:/home/test4# cat newbuilt.txt snp1 261 snp2 522 snp3 783 snp4 1044 snp5 1305 snp6 1566 snp7 1827 snp8 2088 snp9 2349 root@DESKTOP-1N42TVH:/home/test4# paste newbuilt.txt outcome.map snp1 261 1 snp1 0 55910 snp2 522 1 snp2 0 85204 snp3 783 1 snp3 0 122948 snp4 1044 2 snp4 0 167127 snp5 1305 2 snp5 0 176079 snp6 1566 2 snp6 0 361433 snp7 1827 3 snp7 0 144010 snp8 2088 3 snp8 0 199910 snp9 2349 3 snp9 0 234281 root@DESKTOP-1N42TVH:/home/test4# paste newbuilt.txt outcome.map | awk '{OFS = "\t"; $NF = $2; print $3, $4, $5, $6}' 1 snp1 0 261 1 snp2 0 522 1 snp3 0 783 2 snp4 0 1044 2 snp5 0 1305 2 snp6 0 1566 3 snp7 0 1827 3 snp8 0 2088 3 snp9 0 2349