Get gene name from location
hg19
source("https://bioconductor.org/biocLite.R")
biocLite("Homo.sapiens")
https://www.biostars.org/p/167818/
library(Homo.sapiens)
library(dplyr)
genes(TxDb.Hsapiens.UCSC.hg19.knownGene)
rt<-read.table("macs.out.txt",header = T,skip=16,sep = "\t") #skip了16行
mycoords.gr<-rt[,1:3] %>% makeGRangesFromDataFrame # 前三列为chr 、 start、 end,构建符合条件数据结构
geneid<-subsetByOverlaps(genes(TxDb.Hsapiens.UCSC.hg19.knownGene), mycoords.gr) #获取基因id
write.csv(geneid,"geneid.csv")#输出结果
网友评论