从ID到GWAS

#!/bin/bash
#use id to keep vcf and hmp
#author leee
#time 2021.8.23
echo "Input ID_file as args1 and Phenofile as args2!" >>${1}.log
echo "Your ID_file is $1">>${1}.log
echo "Your Phenofile is $2">>${1}.log

bfile=/public/home/caisl/lee/gwas/pruned_v2.1
rmvp=/public/home/caisl/lee/shell/rmvp/mvp.r
mrmlm=/public/home/caisl/lee/shell/mrmlm/mrmlm.r
#extract target id
plink --bfile $bfile --noweb --keep-fam $1 --recode --make-bed --out ${1}_keep
#filter
plink --bfile ${1}_keep --maf 0.05 --geno 0.2 --make-bed --out ${1}_filter --allow-extra-chr
#bed to vcf
plink --bfile ${1}_filter --export vcf-iid --out ${1}_filter
#vcf2hmp
#/public/home/caisl/biosoft/miniconda3/envs/gwas/bin/run_pipeline.pl -Xms10g -Xmx100g -vcf ${1}_filter.vcf -sortPositions -export ${1}.txt -exportType HapmapDiploid
#remove mediate file
#rm ${1}_keep*
#rm ${1}_vcf*

#rMVP to perform gwas
#/public/home/caisl/biosoft/miniconda3/envs/r4.1/bin/Rscript $rmvp ${1}_filter.vcf $2
#mrMLM to perform gwas
col=$(head -n1 $2 |awk '{print NF-1}')
/public/home/caisl/biosoft/miniconda3/envs/r4.1/bin/Rscript $mrmlm ${1}.txt.hmp.txt $2 $col

mkdir csv
mv *.csv csv
mkdir log
mv *.log log
mkdir jpg
mv *.jpg jpg
原文地址:https://www.cnblogs.com/xiaosagege/p/15179150.html