安装
homer[安装参考]http://homer.ucsd.edu/homer/introduction/install.html
利用conda安装,
conda info -e # 先查看当前环境
conda create -n chipseq #创建chipseq环境
conda activate chipseq # 切换环境
conda install -c bioconda homer #可以直接conda安装,也可以按照上面链接,参考安装手册安装
数据准备
将上调或下调的差异基因准备成txt文件,第一列是基因名
输入数据格式.png
HOMER 可以接受的基因编号类型:
NCBI Entrez Gene IDs
NCBI Unigene IDs
NCBI Refseq IDs (mRNA, protein)
Ensembl Gene IDs
Gene Symbols (i.e. Official Gene names, like "Nfkb1" ) popular affymetrix probe IDs (MOE430, U133plus, U95, U75A)
运行 findMotifs.pl
[参考]http://homer.ucsd.edu/homer/microarray/index.html
findMotifs.pl 需要输入3个 inputdata:①上一步中的genelist(txt文件每行一个基因),②输入物种名mouse/human,③输出的结果目录名称(程序运行后在当前目录下自动生成)
#运行
#cd到upregulated_gene.txt 文件所在目录运行
findMotifs.pl upregulated_gene.txt mouse up_homer_res/ -start -400 -end 100 -len 8,10 -p 4
# This will search for motifs of length 8 and 10 from -400 to +100 relative to the TSS, using 4 threads (i.e. 4 CPUs)。
#/ -start -400 -end 100 -len 8,10 -p 4是默认参数可以不加
# 主要输出结果在 HTML files 中
在R中写一个汇总函数
[参考]https://blog.csdn.net/jaychouwong/article/details/119827776
# 这里主要看homerResults文件夹,为预测的潜在的TF结合motif
subString <- function(strings, idx, sep = NA){
strings = as.character(strings)
if(is.na(sep)){
res = as.character(lapply(strings, function(x) paste(strsplit(x, "")[[1]][idx], collapse = "")))
} else{
res = sapply(strsplit(strings, sep), function(x) x[idx])
}
return(res)
}
summaryHomer <- function(outFolder){
homerFolder = paste0(outFolder, "/homerResults")
xFiles = list.files(homerFolder, ".motif$")
xFiles = xFiles[-grep("similar", xFiles)]
xFiles = xFiles[-grep("RV", xFiles)]
xFiles = xFiles[order(as.numeric(gsub("\\.", "", gsub("motif", "", xFiles))))]
texts = sapply(paste0(homerFolder, "/", xFiles), readLines)
chunks = sapply(texts, function(x) strsplit(x[1], "[\t]"))
motif = sapply(chunks, function(x) subString(x[1], 2, ">"))
match = sapply(chunks, function(x) subString(subString(x[2], 2, "BestGuess:"), 1, "/"))
score = sapply(chunks, function(x) rev(strsplit(x[2], "[()]")[[1]])[1])
count = sapply(chunks, function(x) subString(x[6], 3, "[T:()]"))
ratio = sapply(chunks, function(x) subString(x[6], 2, "[()]"))
p_value = sapply(chunks, function(x) subString(x[6], 2, "P:"))
xresT = data.frame(motif,
match,
score = as.numeric(score),
count = as.numeric(count),
ratio_perc = as.numeric(gsub("%", "", ratio)),
p_value = as.numeric(p_value)
)
rownames(xresT) = gsub(".motif", "", basename(rownames(xresT)))
return(xresT)
}
upregulated_gene_res <- summaryHomer('~/project/homer/up_homer_res') # 只需要提供homer的输出目录,我们来使用一下:
motif: 预测的motif序列,正链
match: 预测的TF
score: 匹配度,1为完全匹配
count: 你输入的基因中包含该motif的基因个数
ratio: 你输入的基因中包含该motif的基因个数占总输入基因个数的比例
p_value: 置信度
下载 Homer Packages
[链接]http://homer.ucsd.edu/homer/introduction/configure.html
上述findMotifs.pl在分析motif时是需要指定物种的,其promotor数据包已经提前下载好了。Homer软件安装在~/programm/homer目录下,configureHomer.pl是安装homer和其数据包的脚本文件,利用此脚本可以下载homer软件及所有数据包(已下载好,在homer安装目录下) [configureHomer.pl] http://homer.ucsd.edu/homer/configureHomer.pl
# 需要cd到homer安装目录下进行如下操作
perl ~/programm/homer/configureHomer.pl -list #查看可供下载的数据包
#To install packages, simply use the -install option and the name(s) of the package(s).
perl ~/programm/homer/configureHomer.pl -install mouse-p (to download the mouse promoter set)
perl ~/programm/homer/configureHomer.pl -install mm8 (to download the mm8 version of the mouse genome)
perl ~/programm/homer/configureHomer.pl -install hg19 (to download the hg19 version of the human genome)
#Updating Homer. To update Homer, simply type:
perl ~/programm/homer/configureHomer.pl -update
#Or, alternatively you can simply force the reinstallation of the basic software...
perl ~/programm/homer/configureHomer.pl -install homer #将configureHomer.pl放在将要安装homer的目录下运行。
# 将PATH=$PATH:/Users/chucknorris/homer/bin/ 加入 ~/.bashrc中
网友评论