I've got some very old SNP data from Data Dryad. The BIM files uses coordinates from Hg18, but my dataset uses coordinates from Hg19.
I was wondering if anyone knows how to liftover coordinates in a Plink BIM file?
I've got some very old SNP data from Data Dryad. The BIM files uses coordinates from Hg18, but my dataset uses coordinates from Hg19.
I was wondering if anyone knows how to liftover coordinates in a Plink BIM file?
Share my script with you. It can do liftover automatically (be careful about chrX and chrY):
# download database and script
wget http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/liftOver
wget http://hgdownload.soe.ucsc.edu/goldenPath/hg18/liftOver/hg18ToHg19.over.chain.gz
wget http://hgdownload.soe.ucsc.edu/goldenPath/hg19/liftOver/hg19ToHg38.over.chain.gz
wget https://raw.githubusercontent.com/Shicheng-Guo/GscPythonUtility/master/liftOverPlink.py
wget https://raw.githubusercontent.com/Shicheng-Guo/Gscutility/master/ibdqc.pl
# rebuild plink file to avoid chromsome-miss-order problem
plink --bfile Th17Set1 --make-bed --out Th17Set1.sort
# space to tab to generate bed files for liftOver from hg18 to hg19
plink --bfile Th17Set1.sort --recode tab --out Th17Set1.tab
# apply liftOverPlink.py to update hg18 to hg19 or hg38
# Only works in BIRC10, Not HPC, Caused by Python version
mkdir liftOver
./liftOverPlink.py -m Th17Set1.tab.map -p Th17Set1.tab.ped -o Th17Set1.hg19 -c hg18ToHg19.over.chain.gz -e ./liftOver
When I running your scirpt at the end it shows this message: Converting MAP file to UCSC BED file... SUCC: map->bed succ Lifting BED file... sh: ./liftOver: cannot execute binary file Traceback (most recent call last): File "./liftOverPlink.py", line 172, in <module> makesure(liftBed(oldBed, newBed, unlifted, args.chainFile, liftOverPath), File "./liftOverPlink.py", line 64, in liftBed for ln in myopen(params['UNLIFTED']): File "./liftOverPlink.py", line 34, in myopen return open(fn) IOError: [Errno 2] No such file or directory: 'IMMUNO.hg19.bed.unlifted'
How can I solve ?
I have the same problem as you. Have you solved it and how ? my code like this: python liftOverPlink.py --map chr1.map --out lifted --chain hg18ToHg19.over.chain.gz
but shows this: Converting MAP file to UCSC BED file... SUCC: map->bed succ Lifting BED file... sh: 1: liftOver: not found Traceback (most recent call last): File "liftOverPlink.py", line 172, in <module> makesure(liftBed(oldBed, newBed, unlifted, args.chainFile, liftOverPath), File "liftOverPlink.py", line 64, in liftBed for ln in myopen(params['UNLIFTED']): File "liftOverPlink.py", line 34, in myopen return open(fn) IOError: [Errno 2] No such file or directory: 'lifted.bed.unlifted'
The http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/liftOver is the executable version and should be defined after -e $PATH to the location of the liftOver
executable
I think the safest method is to convert the Plink Format file to VCF Format first, and then we can use CrossMap to perform liftover. The reason is that CrossMap can check the consistency of REF and ALT in a VCF with the new ref genome, while liftover for the bedpe format focuses only on position.
For example, we can use the following codes to lift the Cohort_b37 to the GRCH38 position.
plink --bfile Cohort_b37 --keep-allele-order --recode vcf --out Cohort_b37
CrossMap vcf --chromid l ./hg19ToHg38.over.chain.gz Cohort_b37.vcf $referenceFasta_b38 Cohort_b38.vcf
plink --vcf Cohort_b38.vcf --make-bed --out Cohort_b38
Liftover does not natively process plink formatted files. But you can have a look to this wrapper: https://github.com/sritchie73/liftOverPlink/blob/master/README.md
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Had you searched, you would find plenty of resources, like here and here and here and here. Google even auto-fill your query for me.