Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save knmkr/970977ff5cf3d28f80e8 to your computer and use it in GitHub Desktop.
Save knmkr/970977ff5cf3d28f80e8 to your computer and use it in GitHub Desktop.
[bioinfo] Get current chromosome and position from old reference genome version

Download liftOver executable from UCSC

$ wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/liftOver
$ chmod +x liftOver

Download chain files (mapping information between different genome version) from UCSC

$ wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/liftOver/hg19ToHg38.over.chain.gz

Create query BED file (TAB delimited, 0-based coordinates), e.g., pos_from.bed

chr12	112241765	112241766	snp1

Execute liftOver

$ ./liftOver pos_from.bed ./hg19ToHg38.over.chain.gz pos_to.bed pos_unmapped.bed
$ cat pos_to.bed
chr12	111803961	111803962	snp1

cf: http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?rs=671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment