LiftOver hg18/19

Plink file liftOver

 * 1) !/bin/bash

wget http://hgdownload-test.cse.ucsc.edu/goldenPath/hg18/liftOver/hg18ToHg19.over.chain.gz wget http://hgdownload-test.cse.ucsc.edu/goldenPath/hg19/liftOver/hg19ToHg18.over.chain.gz wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/liftOver

tped="/md1/synaptome/09-synaptome-r1r2r3/19-validation-paper/GATK_HCVR/gwas/gwas" subj="gwas"

cat $tped.tped | awk '{print "chr"$1"\t"$4-1"\t"$4"\t"$2}' > $subj.1.bed ./liftOver $subj.1.bed hg18ToHg19.over.chain.gz $subj.1.output.bed $subj.1.unlifted.bed

cat $subj.1.unlifted.bed | grep -v "^#" | awk '{print $4}' > $subj.1.unlifted.bed.2 plink --noweb --tfile $tped --exclude $subj.1.unlifted.bed.2 --recode --transpose --out tmp1

cat tmp1.tped | awk '{print "chr"$1"\t"$4-1"\t"$4"\t"$2}' > tmp1.1.bed ./liftOver tmp1.1.bed hg18ToHg19.over.chain.gz tmp1.1.output.bed tmp1.1.unlifted.bed

cat tmp1.1.output.bed | awk '{print $4"\t"$3}' > tmp1.1.output.bed.2

plink --noweb --tfile tmp1 --update-map tmp1.1.output.bed.2 --recode --transpose --out $tped.hg19 plink --noweb --tfile $tped.hg19 --make-bed --out $tped.hg19 rm -f tmp* $subj*

Using plink bim file:


 * 1) !/bin/bash


 * 1) command :
 * 2)   sh liftOver_hg18_to_hg19  /path/to/bim

subject_bim="$1"

cat $subject_bim | awk '{print "chr"$1"\t"$4-1"\t"$4"\t"$2}' | \ awk '{ gsub(/chrchr/, "chr"); print }' > $subject_bim.1.bed

mliftOver $subject_bim.1.bed /bin/hg18ToHg19.over.chain.gz \ $subject_bim.lifted.1.bed $subject_bim.1.unlifted.bed.2

cat $subject_bim.1.unlifted.bed.2 | grep -v "^#" |  \ awk '{print $4}' > $subject_bim.unlifted.bed cat $subject_bim.lifted.1.bed | cut -f 1,3,4 | awk '{ gsub(/chr/, ""); print }' | \ awk '{ print $3"\t"$1"\t"$2}' > $subject_bim.lifted.bed

rm -f $subject_bim.1.unlifted.bed.2 $subject_bim.1.bed $subject_bim.lifted.1.bed