본문 바로가기

R관련

liftover (genome location transformation)

728x90
반응형

library(GenomicRanges)
library(rtracklayer)
library(Homo.sapiens)
library(BiocGenerics)
library(liftOver)
source("http://bioconductor.org/workflows.R")
#workflowInstall("liftOver")


# Chain을 loading함

# chain file들은 http://hgdownload.cse.ucsc.edu/goldenPath/hg38/liftOver/ 에서 다운로드 가능함.

ch <- import.chain("C:/Users/osj118/Desktop/workdir/reference/liftover/hg38ToHg19.over.chain/hg38ToHg19.over.chain")

location 파일은 아래와 같음 (pos)

 chr     start       end                   identi
1  chr1 162780122 162780122 chr1:162780122:162780122
2  chr2 190998248 190998248 chr2:190998248:190998248
3  chr3 135201601 135201601 chr3:135201601:135201601
4  chr7  55173014  55173014   chr7:55173014:55173014
5 chr16  24219988  24219988  chr16:24219988:24219988
6 chr10  87952125  87952125  chr10:87952125:87952125


po2=makeGRangesFromDataFrame(pos,keep.extra.columns = T)


# liftover

hg19=liftOver(x=po2,chain=ch)

po3=as.data.frame(unlist(hg19),stringsAsFactors=F)



728x90
반응형

'R관련' 카테고리의 다른 글

biomaRt connection관련  (0) 2017.12.15
biomart  (0) 2017.12.01
R 단축키들 (R shortcut key)  (0) 2017.10.24
circular dendrogram 그리기  (0) 2017.10.16
gsub in r  (0) 2017.08.21